|  |  | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using Pub_Class; | 
 |  |  | using System; | 
 |  |  | using System.Collections; | 
 |  |  | 
 |  |  |         /// </summary> | 
 |  |  |         [Route("Gy_Supplier/list")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object list(string sWhere) | 
 |  |  |         public object list(string sWhere,string user,string Organization) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_Gy_SupplierList " + sWhere, "h_v_Gy_SupplierList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     string sql1 = "select * from h_v_Gy_SupplierList where 1 = 1 "; | 
 |  |  |                     string sql = sql1 + sWhere; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Gy_SupplierList"); | 
 |  |  |                 } | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //编辑权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log_second("Gy_Supplier", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "false!"; | 
 |  |  |                     objJsonResult.Message = "无查看权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 string sql1 = string.Format(@"select * from h_v_Gy_SupplierList where 组织名称='" + Organization + "'"); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn(sql1 + sWhere + " order by 供应商代码", "h_v_Gy_SupplierList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "Sucess!"; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     string sql = sql1 + sWhere + " order by 供应商代码 "; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Gy_SupplierList"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ds = oCN.RunProcReturn("select * from Gy_Supplier where HItemID=" + HInterID, "Gy_Supplier"); | 
 |  |  |                 string sql = string.Format(@"select  s.HItemID,s.HNumber 编码,s.HName 名称,s.HHelpCode  助记码,s.HShortName 简称,s.HAddress 地址,s.HLinkMan 联系人,s.HLinkPhone 联系电话 | 
 |  |  |                                             ,s.HMobilePhone 手机,s.HFax 传真,s.HPostalCode 邮编,s.HEmail 电子邮件,s.HCorMan 法人代表,s.HBank 开户银行,s.HBankAccount 银行账号, | 
 |  |  |                                            s.HTaxNum 税务登记号,s.HEnglishName 英文名称,s.HEngLishAddress 英文地址,s.HCountry 国家,s.HStopflag 禁用标志 | 
 |  |  |                                            ,s.HRemark 备注,s.HAreaID 地区ID,a.HName 地区名称,s.HTaxRate 增值税率,s.HCurID 默认货币ID,r.HName 默认货币, | 
 |  |  |                                            s.HSSID 结算方式ID,e.HName 结算方式 from Gy_Supplier s | 
 |  |  |                                            left join Gy_AreaSet a on s.HAreaID=a.HItemID | 
 |  |  |                                            left join Gy_Currency r on s.HCurID=r.HItemID  | 
 |  |  |                                            left  join Gy_SettleStyle e on s.HSSID=e.HItemID | 
 |  |  |                                            where s.HItemID='" + HInterID + "'"); | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "Gy_Supplier"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |                     ",HTaxNum,HTaxRate,HCountry,HCorMan,HEnglishName" + | 
 |  |  |                     ",HEnglishAddress,HCurID,HSSID,HAreaID) " + | 
 |  |  |                 " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HParentID + "'" + | 
 |  |  |                 "," + HLevel + ",'0','0','" + HRemark + "'" + | 
 |  |  |                 "," + HLevel + ",0,'" + HStopflag + "','" + HRemark + "'" + | 
 |  |  |                 ",'" + HShortName + "','" + HAddress + "','" + HLinkMan + "','" + HLinkPhone + "','" + HMobilePhone + "'" + | 
 |  |  |                 ",'" + HFax + "','" + HPostalCode + "','" + HEmail + "','" + HBank + "','" + HBankAccount + "'" + | 
 |  |  |                 ",'" + HTaxNum + "','" + HTaxRate + "','" + HCountry + "','" + HCorMan + "','" + HEnglishName + "'" + | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //判断权限 | 
 |  |  |                 if (!ClsPub.Security_Log(msg5, 1, true, msg4)) | 
 |  |  |                 if (!ClsPub.Security_Log(msg5, 1, false, msg4)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "没有找到该功能模块!"; | 
 |  |  |                     objJsonResult.Message = "无保存权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |             DAL.ClsGy_Supplier_View oGroupHlp = new DAL.ClsGy_Supplier_View(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, false, User)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; |