PingAnYeXianSZCG_API 接口代码

T_Cus_CustomerBase.cs 51KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  1. using CallCenterApi.DB;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Data.SqlClient;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace CallCenterApi.DAL
  10. {
  11. /// <summary>
  12. /// 数据访问类:T_Cus_CustomerBase
  13. /// </summary>
  14. public partial class T_Cus_CustomerBase
  15. {
  16. public T_Cus_CustomerBase()
  17. { }
  18. #region BasicMethod
  19. /// <summary>
  20. /// 得到最大ID
  21. /// </summary>
  22. public int GetMaxId()
  23. {
  24. return DbHelperSQL.GetMaxID("F_CustomerId", "T_Cus_CustomerBase");
  25. }
  26. /// <summary>
  27. /// 是否存在该记录
  28. /// </summary>
  29. public bool Exists(int F_CustomerId)
  30. {
  31. StringBuilder strSql = new StringBuilder();
  32. strSql.Append("select count(1) from T_Cus_CustomerBase");
  33. strSql.Append(" where F_CustomerId=@F_CustomerId");
  34. SqlParameter[] parameters = {
  35. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
  36. };
  37. parameters[0].Value = F_CustomerId;
  38. return DbHelperSQL.Exists(strSql.ToString(), parameters);
  39. }
  40. /// <summary>
  41. /// 增加一条数据
  42. /// </summary>
  43. public int Add(CallCenterApi.Model.T_Cus_CustomerBase model)
  44. {
  45. StringBuilder strSql = new StringBuilder();
  46. strSql.Append("insert into T_Cus_CustomerBase(");
  47. strSql.Append("F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID,F_AutoFlag,F_Result)");
  48. strSql.Append(" values (");
  49. strSql.Append("@F_CustomerName,@F_CustomerCode,@F_CustomerEName,@F_CustomerPym,@F_Layer,@F_CustomerLayer,@F_CategoryId,@F_TradeId,@F_RegionId,@F_IndustryId,@F_Address,@F_Url,@F_Telephone,@F_Mobile,@F_Fax,@F_Email,@F_Website,@F_PostCode,@F_ScaleResume,@F_BusinessProfile,@F_BusinessLicenseID,@F_TaxID,@F_OpeningBank,@F_BankAccount,@F_LegalRepresentative,@F_LegalRepresentativeCardID,@F_Nature,@F_Kind,@F_CustomerType,@F_MainProduct,@F_CustomerFrom,@F_TrackInfo,@F_TrackState,@F_ImportDegree,@F_IntentProduct,@F_CreateBy,@F_CreatedOn,@F_ModifyBy,@F_ModifiedOn,@F_DeleteFlag,@F_StatusCode,@F_ServiceDept,@F_ChargeName,@F_ChargeTelephone,@F_Province,@F_ProductLine,@F_ChargeDept,@F_AfterSaleName,@F_CustomerNature,@F_CustomerClass,@F_CustomerIndustry,@F_RelationShipClass,@F_CurrentVersion,@F_SystemStartTime,@F_QualityGuaranteeEndTime,@F_AfterSaleTelephone,@F_Notes,@F_SystemType,@F_City,@F_CustomerStatus,@F_DeviceCount,@F_MaintenanceType,@F_ERPCustomerCode,@F_ServiceDeptID,@F_ProductLineID,@F_AfterSaleNameID,@F_CustomerNatureID,@F_CustomerClassID,@F_RelationShipClassID,@F_CityID,@F_AutoFlag,@F_Result)");
  50. strSql.Append(";select @@IDENTITY");
  51. SqlParameter[] parameters = {
  52. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
  53. new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
  54. new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,800),
  55. new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,50),
  56. new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
  57. new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,50),
  58. new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
  59. new SqlParameter("@F_TradeId", SqlDbType.Int,4),
  60. new SqlParameter("@F_RegionId", SqlDbType.Int,4),
  61. new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
  62. new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
  63. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  64. new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
  65. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
  66. new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
  67. new SqlParameter("@F_Email", SqlDbType.VarChar,200),
  68. new SqlParameter("@F_Website", SqlDbType.VarChar,200),
  69. new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
  70. new SqlParameter("@F_ScaleResume", SqlDbType.NVarChar,2000),
  71. new SqlParameter("@F_BusinessProfile", SqlDbType.NVarChar,2000),
  72. new SqlParameter("@F_BusinessLicenseID", SqlDbType.VarChar,80),
  73. new SqlParameter("@F_TaxID", SqlDbType.VarChar,80),
  74. new SqlParameter("@F_OpeningBank", SqlDbType.NVarChar,100),
  75. new SqlParameter("@F_BankAccount", SqlDbType.VarChar,80),
  76. new SqlParameter("@F_LegalRepresentative", SqlDbType.VarChar,50),
  77. new SqlParameter("@F_LegalRepresentativeCardID", SqlDbType.VarChar,30),
  78. new SqlParameter("@F_Nature", SqlDbType.NVarChar,80),
  79. new SqlParameter("@F_Kind", SqlDbType.NVarChar,80),
  80. new SqlParameter("@F_CustomerType", SqlDbType.Int,4),
  81. new SqlParameter("@F_MainProduct", SqlDbType.Text),
  82. new SqlParameter("@F_CustomerFrom", SqlDbType.NVarChar,200),
  83. new SqlParameter("@F_TrackInfo", SqlDbType.NVarChar,200),
  84. new SqlParameter("@F_TrackState", SqlDbType.NVarChar,50),
  85. new SqlParameter("@F_ImportDegree", SqlDbType.NVarChar,50),
  86. new SqlParameter("@F_IntentProduct", SqlDbType.Text),
  87. new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
  88. new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
  89. new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
  90. new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
  91. new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
  92. new SqlParameter("@F_StatusCode", SqlDbType.SmallInt,2),
  93. new SqlParameter("@F_ServiceDept", SqlDbType.NVarChar,20),
  94. new SqlParameter("@F_ChargeName", SqlDbType.NVarChar,20),
  95. new SqlParameter("@F_ChargeTelephone", SqlDbType.VarChar,15),
  96. new SqlParameter("@F_Province", SqlDbType.NVarChar,20),
  97. new SqlParameter("@F_ProductLine", SqlDbType.NVarChar,50),
  98. new SqlParameter("@F_ChargeDept", SqlDbType.NVarChar,20),
  99. new SqlParameter("@F_AfterSaleName", SqlDbType.NVarChar,20),
  100. new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,20),
  101. new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,10),
  102. new SqlParameter("@F_CustomerIndustry", SqlDbType.NVarChar,10),
  103. new SqlParameter("@F_RelationShipClass", SqlDbType.NVarChar,10),
  104. new SqlParameter("@F_CurrentVersion", SqlDbType.VarChar,100),
  105. new SqlParameter("@F_SystemStartTime", SqlDbType.DateTime),
  106. new SqlParameter("@F_QualityGuaranteeEndTime", SqlDbType.DateTime),
  107. new SqlParameter("@F_AfterSaleTelephone", SqlDbType.VarChar,15),
  108. new SqlParameter("@F_Notes", SqlDbType.NVarChar,500),
  109. new SqlParameter("@F_SystemType", SqlDbType.NVarChar,100),
  110. new SqlParameter("@F_City", SqlDbType.NVarChar,10),
  111. new SqlParameter("@F_CustomerStatus", SqlDbType.NVarChar,10),
  112. new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
  113. new SqlParameter("@F_MaintenanceType", SqlDbType.NVarChar,30),
  114. new SqlParameter("@F_ERPCustomerCode", SqlDbType.VarChar,100),
  115. new SqlParameter("@F_ServiceDeptID", SqlDbType.Int,4),
  116. new SqlParameter("@F_ProductLineID", SqlDbType.Int,4),
  117. new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
  118. new SqlParameter("@F_CustomerNatureID", SqlDbType.Int,4),
  119. new SqlParameter("@F_CustomerClassID", SqlDbType.Int,4),
  120. new SqlParameter("@F_RelationShipClassID", SqlDbType.Int,4),
  121. new SqlParameter("@F_CityID", SqlDbType.Int,4),
  122. new SqlParameter("@F_AutoFlag", SqlDbType.SmallInt,2),
  123. new SqlParameter("@F_Result", SqlDbType.NVarChar,100)
  124. };
  125. parameters[0].Value = model.F_CustomerName;
  126. parameters[1].Value = model.F_CustomerCode;
  127. parameters[2].Value = model.F_CustomerEName;
  128. parameters[3].Value = model.F_CustomerPym;
  129. parameters[4].Value = model.F_Layer;
  130. parameters[5].Value = model.F_CustomerLayer;
  131. parameters[6].Value = model.F_CategoryId;
  132. parameters[7].Value = model.F_TradeId;
  133. parameters[8].Value = model.F_RegionId;
  134. parameters[9].Value = model.F_IndustryId;
  135. parameters[10].Value = model.F_Address;
  136. parameters[11].Value = model.F_Url;
  137. parameters[12].Value = model.F_Telephone;
  138. parameters[13].Value = model.F_Mobile;
  139. parameters[14].Value = model.F_Fax;
  140. parameters[15].Value = model.F_Email;
  141. parameters[16].Value = model.F_Website;
  142. parameters[17].Value = model.F_PostCode;
  143. parameters[18].Value = model.F_ScaleResume;
  144. parameters[19].Value = model.F_BusinessProfile;
  145. parameters[20].Value = model.F_BusinessLicenseID;
  146. parameters[21].Value = model.F_TaxID;
  147. parameters[22].Value = model.F_OpeningBank;
  148. parameters[23].Value = model.F_BankAccount;
  149. parameters[24].Value = model.F_LegalRepresentative;
  150. parameters[25].Value = model.F_LegalRepresentativeCardID;
  151. parameters[26].Value = model.F_Nature;
  152. parameters[27].Value = model.F_Kind;
  153. parameters[28].Value = model.F_CustomerType;
  154. parameters[29].Value = model.F_MainProduct;
  155. parameters[30].Value = model.F_CustomerFrom;
  156. parameters[31].Value = model.F_TrackInfo;
  157. parameters[32].Value = model.F_TrackState;
  158. parameters[33].Value = model.F_ImportDegree;
  159. parameters[34].Value = model.F_IntentProduct;
  160. parameters[35].Value = model.F_CreateBy;
  161. parameters[36].Value = model.F_CreatedOn;
  162. parameters[37].Value = model.F_ModifyBy;
  163. parameters[38].Value = model.F_ModifiedOn;
  164. parameters[39].Value = model.F_DeleteFlag;
  165. parameters[40].Value = model.F_StatusCode;
  166. parameters[41].Value = model.F_ServiceDept;
  167. parameters[42].Value = model.F_ChargeName;
  168. parameters[43].Value = model.F_ChargeTelephone;
  169. parameters[44].Value = model.F_Province;
  170. parameters[45].Value = model.F_ProductLine;
  171. parameters[46].Value = model.F_ChargeDept;
  172. parameters[47].Value = model.F_AfterSaleName;
  173. parameters[48].Value = model.F_CustomerNature;
  174. parameters[49].Value = model.F_CustomerClass;
  175. parameters[50].Value = model.F_CustomerIndustry;
  176. parameters[51].Value = model.F_RelationShipClass;
  177. parameters[52].Value = model.F_CurrentVersion;
  178. parameters[53].Value = model.F_SystemStartTime;
  179. parameters[54].Value = model.F_QualityGuaranteeEndTime;
  180. parameters[55].Value = model.F_AfterSaleTelephone;
  181. parameters[56].Value = model.F_Notes;
  182. parameters[57].Value = model.F_SystemType;
  183. parameters[58].Value = model.F_City;
  184. parameters[59].Value = model.F_CustomerStatus;
  185. parameters[60].Value = model.F_DeviceCount;
  186. parameters[61].Value = model.F_MaintenanceType;
  187. parameters[62].Value = model.F_ERPCustomerCode;
  188. parameters[63].Value = model.F_ServiceDeptID;
  189. parameters[64].Value = model.F_ProductLineID;
  190. parameters[65].Value = model.F_AfterSaleNameID;
  191. parameters[66].Value = model.F_CustomerNatureID;
  192. parameters[67].Value = model.F_CustomerClassID;
  193. parameters[68].Value = model.F_RelationShipClassID;
  194. parameters[69].Value = model.F_CityID;
  195. parameters[70].Value = model.F_AutoFlag;
  196. parameters[71].Value = model.F_Result;
  197. object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
  198. if (obj == null)
  199. {
  200. return 0;
  201. }
  202. else
  203. {
  204. return Convert.ToInt32(obj);
  205. }
  206. }
  207. /// <summary>
  208. /// 更新一条数据
  209. /// </summary>
  210. public bool Update(CallCenterApi.Model.T_Cus_CustomerBase model)
  211. {
  212. StringBuilder strSql = new StringBuilder();
  213. strSql.Append("update T_Cus_CustomerBase set ");
  214. strSql.Append("F_CustomerName=@F_CustomerName,");
  215. strSql.Append("F_CustomerCode=@F_CustomerCode,");
  216. strSql.Append("F_CustomerEName=@F_CustomerEName,");
  217. strSql.Append("F_CustomerPym=@F_CustomerPym,");
  218. strSql.Append("F_Layer=@F_Layer,");
  219. strSql.Append("F_CustomerLayer=@F_CustomerLayer,");
  220. strSql.Append("F_CategoryId=@F_CategoryId,");
  221. strSql.Append("F_TradeId=@F_TradeId,");
  222. strSql.Append("F_RegionId=@F_RegionId,");
  223. strSql.Append("F_IndustryId=@F_IndustryId,");
  224. strSql.Append("F_Address=@F_Address,");
  225. strSql.Append("F_Url=@F_Url,");
  226. strSql.Append("F_Telephone=@F_Telephone,");
  227. strSql.Append("F_Mobile=@F_Mobile,");
  228. strSql.Append("F_Fax=@F_Fax,");
  229. strSql.Append("F_Email=@F_Email,");
  230. strSql.Append("F_Website=@F_Website,");
  231. strSql.Append("F_PostCode=@F_PostCode,");
  232. strSql.Append("F_ScaleResume=@F_ScaleResume,");
  233. strSql.Append("F_BusinessProfile=@F_BusinessProfile,");
  234. strSql.Append("F_BusinessLicenseID=@F_BusinessLicenseID,");
  235. strSql.Append("F_TaxID=@F_TaxID,");
  236. strSql.Append("F_OpeningBank=@F_OpeningBank,");
  237. strSql.Append("F_BankAccount=@F_BankAccount,");
  238. strSql.Append("F_LegalRepresentative=@F_LegalRepresentative,");
  239. strSql.Append("F_LegalRepresentativeCardID=@F_LegalRepresentativeCardID,");
  240. strSql.Append("F_Nature=@F_Nature,");
  241. strSql.Append("F_Kind=@F_Kind,");
  242. strSql.Append("F_CustomerType=@F_CustomerType,");
  243. strSql.Append("F_MainProduct=@F_MainProduct,");
  244. strSql.Append("F_CustomerFrom=@F_CustomerFrom,");
  245. strSql.Append("F_TrackInfo=@F_TrackInfo,");
  246. strSql.Append("F_TrackState=@F_TrackState,");
  247. strSql.Append("F_ImportDegree=@F_ImportDegree,");
  248. strSql.Append("F_IntentProduct=@F_IntentProduct,");
  249. strSql.Append("F_CreateBy=@F_CreateBy,");
  250. strSql.Append("F_CreatedOn=@F_CreatedOn,");
  251. strSql.Append("F_ModifyBy=@F_ModifyBy,");
  252. strSql.Append("F_ModifiedOn=@F_ModifiedOn,");
  253. strSql.Append("F_DeleteFlag=@F_DeleteFlag,");
  254. strSql.Append("F_StatusCode=@F_StatusCode,");
  255. strSql.Append("F_ServiceDept=@F_ServiceDept,");
  256. strSql.Append("F_ChargeName=@F_ChargeName,");
  257. strSql.Append("F_ChargeTelephone=@F_ChargeTelephone,");
  258. strSql.Append("F_Province=@F_Province,");
  259. strSql.Append("F_ProductLine=@F_ProductLine,");
  260. strSql.Append("F_ChargeDept=@F_ChargeDept,");
  261. strSql.Append("F_AfterSaleName=@F_AfterSaleName,");
  262. strSql.Append("F_CustomerNature=@F_CustomerNature,");
  263. strSql.Append("F_CustomerClass=@F_CustomerClass,");
  264. strSql.Append("F_CustomerIndustry=@F_CustomerIndustry,");
  265. strSql.Append("F_RelationShipClass=@F_RelationShipClass,");
  266. strSql.Append("F_CurrentVersion=@F_CurrentVersion,");
  267. strSql.Append("F_SystemStartTime=@F_SystemStartTime,");
  268. strSql.Append("F_QualityGuaranteeEndTime=@F_QualityGuaranteeEndTime,");
  269. strSql.Append("F_AfterSaleTelephone=@F_AfterSaleTelephone,");
  270. strSql.Append("F_Notes=@F_Notes,");
  271. strSql.Append("F_SystemType=@F_SystemType,");
  272. strSql.Append("F_City=@F_City,");
  273. strSql.Append("F_CustomerStatus=@F_CustomerStatus,");
  274. strSql.Append("F_DeviceCount=@F_DeviceCount,");
  275. strSql.Append("F_MaintenanceType=@F_MaintenanceType,");
  276. strSql.Append("F_ERPCustomerCode=@F_ERPCustomerCode,");
  277. strSql.Append("F_ServiceDeptID=@F_ServiceDeptID,");
  278. strSql.Append("F_ProductLineID=@F_ProductLineID,");
  279. strSql.Append("F_AfterSaleNameID=@F_AfterSaleNameID,");
  280. strSql.Append("F_CustomerNatureID=@F_CustomerNatureID,");
  281. strSql.Append("F_CustomerClassID=@F_CustomerClassID,");
  282. strSql.Append("F_RelationShipClassID=@F_RelationShipClassID,");
  283. strSql.Append("F_CityID=@F_CityID,");
  284. strSql.Append("F_AutoFlag=@F_AutoFlag,");
  285. strSql.Append("F_Result=@F_Result");
  286. strSql.Append(" where F_CustomerId=@F_CustomerId");
  287. SqlParameter[] parameters = {
  288. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
  289. new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
  290. new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,800),
  291. new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,50),
  292. new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
  293. new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,50),
  294. new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
  295. new SqlParameter("@F_TradeId", SqlDbType.Int,4),
  296. new SqlParameter("@F_RegionId", SqlDbType.Int,4),
  297. new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
  298. new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
  299. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  300. new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
  301. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
  302. new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
  303. new SqlParameter("@F_Email", SqlDbType.VarChar,200),
  304. new SqlParameter("@F_Website", SqlDbType.VarChar,200),
  305. new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
  306. new SqlParameter("@F_ScaleResume", SqlDbType.NVarChar,2000),
  307. new SqlParameter("@F_BusinessProfile", SqlDbType.NVarChar,2000),
  308. new SqlParameter("@F_BusinessLicenseID", SqlDbType.VarChar,80),
  309. new SqlParameter("@F_TaxID", SqlDbType.VarChar,80),
  310. new SqlParameter("@F_OpeningBank", SqlDbType.NVarChar,100),
  311. new SqlParameter("@F_BankAccount", SqlDbType.VarChar,80),
  312. new SqlParameter("@F_LegalRepresentative", SqlDbType.VarChar,50),
  313. new SqlParameter("@F_LegalRepresentativeCardID", SqlDbType.VarChar,30),
  314. new SqlParameter("@F_Nature", SqlDbType.NVarChar,80),
  315. new SqlParameter("@F_Kind", SqlDbType.NVarChar,80),
  316. new SqlParameter("@F_CustomerType", SqlDbType.Int,4),
  317. new SqlParameter("@F_MainProduct", SqlDbType.Text),
  318. new SqlParameter("@F_CustomerFrom", SqlDbType.NVarChar,200),
  319. new SqlParameter("@F_TrackInfo", SqlDbType.NVarChar,200),
  320. new SqlParameter("@F_TrackState", SqlDbType.NVarChar,50),
  321. new SqlParameter("@F_ImportDegree", SqlDbType.NVarChar,50),
  322. new SqlParameter("@F_IntentProduct", SqlDbType.Text),
  323. new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
  324. new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
  325. new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
  326. new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
  327. new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
  328. new SqlParameter("@F_StatusCode", SqlDbType.SmallInt,2),
  329. new SqlParameter("@F_ServiceDept", SqlDbType.NVarChar,20),
  330. new SqlParameter("@F_ChargeName", SqlDbType.NVarChar,20),
  331. new SqlParameter("@F_ChargeTelephone", SqlDbType.VarChar,15),
  332. new SqlParameter("@F_Province", SqlDbType.NVarChar,20),
  333. new SqlParameter("@F_ProductLine", SqlDbType.NVarChar,50),
  334. new SqlParameter("@F_ChargeDept", SqlDbType.NVarChar,20),
  335. new SqlParameter("@F_AfterSaleName", SqlDbType.NVarChar,20),
  336. new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,20),
  337. new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,10),
  338. new SqlParameter("@F_CustomerIndustry", SqlDbType.NVarChar,10),
  339. new SqlParameter("@F_RelationShipClass", SqlDbType.NVarChar,10),
  340. new SqlParameter("@F_CurrentVersion", SqlDbType.VarChar,100),
  341. new SqlParameter("@F_SystemStartTime", SqlDbType.DateTime),
  342. new SqlParameter("@F_QualityGuaranteeEndTime", SqlDbType.DateTime),
  343. new SqlParameter("@F_AfterSaleTelephone", SqlDbType.VarChar,15),
  344. new SqlParameter("@F_Notes", SqlDbType.NVarChar,500),
  345. new SqlParameter("@F_SystemType", SqlDbType.NVarChar,100),
  346. new SqlParameter("@F_City", SqlDbType.NVarChar,10),
  347. new SqlParameter("@F_CustomerStatus", SqlDbType.NVarChar,10),
  348. new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
  349. new SqlParameter("@F_MaintenanceType", SqlDbType.NVarChar,30),
  350. new SqlParameter("@F_ERPCustomerCode", SqlDbType.VarChar,100),
  351. new SqlParameter("@F_ServiceDeptID", SqlDbType.Int,4),
  352. new SqlParameter("@F_ProductLineID", SqlDbType.Int,4),
  353. new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
  354. new SqlParameter("@F_CustomerNatureID", SqlDbType.Int,4),
  355. new SqlParameter("@F_CustomerClassID", SqlDbType.Int,4),
  356. new SqlParameter("@F_RelationShipClassID", SqlDbType.Int,4),
  357. new SqlParameter("@F_CityID", SqlDbType.Int,4),
  358. new SqlParameter("@F_CustomerId", SqlDbType.Int,4),
  359. new SqlParameter("@F_AutoFlag", SqlDbType.SmallInt,2),
  360. new SqlParameter("@F_Result", SqlDbType.NVarChar,20)};
  361. parameters[0].Value = model.F_CustomerName;
  362. parameters[1].Value = model.F_CustomerCode;
  363. parameters[2].Value = model.F_CustomerEName;
  364. parameters[3].Value = model.F_CustomerPym;
  365. parameters[4].Value = model.F_Layer;
  366. parameters[5].Value = model.F_CustomerLayer;
  367. parameters[6].Value = model.F_CategoryId;
  368. parameters[7].Value = model.F_TradeId;
  369. parameters[8].Value = model.F_RegionId;
  370. parameters[9].Value = model.F_IndustryId;
  371. parameters[10].Value = model.F_Address;
  372. parameters[11].Value = model.F_Url;
  373. parameters[12].Value = model.F_Telephone;
  374. parameters[13].Value = model.F_Mobile;
  375. parameters[14].Value = model.F_Fax;
  376. parameters[15].Value = model.F_Email;
  377. parameters[16].Value = model.F_Website;
  378. parameters[17].Value = model.F_PostCode;
  379. parameters[18].Value = model.F_ScaleResume;
  380. parameters[19].Value = model.F_BusinessProfile;
  381. parameters[20].Value = model.F_BusinessLicenseID;
  382. parameters[21].Value = model.F_TaxID;
  383. parameters[22].Value = model.F_OpeningBank;
  384. parameters[23].Value = model.F_BankAccount;
  385. parameters[24].Value = model.F_LegalRepresentative;
  386. parameters[25].Value = model.F_LegalRepresentativeCardID;
  387. parameters[26].Value = model.F_Nature;
  388. parameters[27].Value = model.F_Kind;
  389. parameters[28].Value = model.F_CustomerType;
  390. parameters[29].Value = model.F_MainProduct;
  391. parameters[30].Value = model.F_CustomerFrom;
  392. parameters[31].Value = model.F_TrackInfo;
  393. parameters[32].Value = model.F_TrackState;
  394. parameters[33].Value = model.F_ImportDegree;
  395. parameters[34].Value = model.F_IntentProduct;
  396. parameters[35].Value = model.F_CreateBy;
  397. parameters[36].Value = model.F_CreatedOn;
  398. parameters[37].Value = model.F_ModifyBy;
  399. parameters[38].Value = model.F_ModifiedOn;
  400. parameters[39].Value = model.F_DeleteFlag;
  401. parameters[40].Value = model.F_StatusCode;
  402. parameters[41].Value = model.F_ServiceDept;
  403. parameters[42].Value = model.F_ChargeName;
  404. parameters[43].Value = model.F_ChargeTelephone;
  405. parameters[44].Value = model.F_Province;
  406. parameters[45].Value = model.F_ProductLine;
  407. parameters[46].Value = model.F_ChargeDept;
  408. parameters[47].Value = model.F_AfterSaleName;
  409. parameters[48].Value = model.F_CustomerNature;
  410. parameters[49].Value = model.F_CustomerClass;
  411. parameters[50].Value = model.F_CustomerIndustry;
  412. parameters[51].Value = model.F_RelationShipClass;
  413. parameters[52].Value = model.F_CurrentVersion;
  414. parameters[53].Value = model.F_SystemStartTime;
  415. parameters[54].Value = model.F_QualityGuaranteeEndTime;
  416. parameters[55].Value = model.F_AfterSaleTelephone;
  417. parameters[56].Value = model.F_Notes;
  418. parameters[57].Value = model.F_SystemType;
  419. parameters[58].Value = model.F_City;
  420. parameters[59].Value = model.F_CustomerStatus;
  421. parameters[60].Value = model.F_DeviceCount;
  422. parameters[61].Value = model.F_MaintenanceType;
  423. parameters[62].Value = model.F_ERPCustomerCode;
  424. parameters[63].Value = model.F_ServiceDeptID;
  425. parameters[64].Value = model.F_ProductLineID;
  426. parameters[65].Value = model.F_AfterSaleNameID;
  427. parameters[66].Value = model.F_CustomerNatureID;
  428. parameters[67].Value = model.F_CustomerClassID;
  429. parameters[68].Value = model.F_RelationShipClassID;
  430. parameters[69].Value = model.F_CityID;
  431. parameters[70].Value = model.F_CustomerId;
  432. parameters[71].Value = model.F_AutoFlag;
  433. parameters[72].Value = model.F_Result;
  434. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  435. if (rows > 0)
  436. {
  437. return true;
  438. }
  439. else
  440. {
  441. return false;
  442. }
  443. }
  444. /// <summary>
  445. /// 删除一条数据
  446. /// </summary>
  447. public bool Delete(int F_CustomerId)
  448. {
  449. StringBuilder strSql = new StringBuilder();
  450. //strSql.Append("delete from T_Cus_CustomerBase ");
  451. strSql.Append("update T_Cus_CustomerBase set F_DeleteFlag=1");
  452. strSql.Append(" where F_CustomerId=@F_CustomerId");
  453. SqlParameter[] parameters = {
  454. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
  455. };
  456. parameters[0].Value = F_CustomerId;
  457. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  458. if (rows > 0)
  459. {
  460. return true;
  461. }
  462. else
  463. {
  464. return false;
  465. }
  466. }
  467. /// <summary>
  468. /// 批量删除数据
  469. /// </summary>
  470. public bool DeleteList(string F_CustomerIdlist)
  471. {
  472. StringBuilder strSql = new StringBuilder();
  473. //strSql.Append("delete from T_Cus_CustomerBase ");
  474. strSql.Append("update T_Cus_CustomerBase set F_DeleteFlag=1");
  475. strSql.Append(" where F_CustomerId in (" + F_CustomerIdlist + ") ");
  476. int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
  477. if (rows > 0)
  478. {
  479. return true;
  480. }
  481. else
  482. {
  483. return false;
  484. }
  485. }
  486. /// <summary>
  487. /// 得到一个对象实体
  488. /// </summary>
  489. public CallCenterApi.Model.T_Cus_CustomerBase GetModel(int F_CustomerId)
  490. {
  491. StringBuilder strSql = new StringBuilder();
  492. strSql.Append("select top 1 F_CustomerId,F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID,F_Result,F_AutoFlag from T_Cus_CustomerBase ");
  493. strSql.Append(" where F_CustomerId=@F_CustomerId");
  494. SqlParameter[] parameters = {
  495. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
  496. };
  497. parameters[0].Value = F_CustomerId;
  498. CallCenterApi.Model.T_Cus_CustomerBase model = new CallCenterApi.Model.T_Cus_CustomerBase();
  499. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  500. if (ds.Tables[0].Rows.Count > 0)
  501. {
  502. return DataRowToModel(ds.Tables[0].Rows[0]);
  503. }
  504. else
  505. {
  506. return null;
  507. }
  508. }
  509. /// <summary>
  510. /// 得到一个对象实体
  511. /// </summary>
  512. public CallCenterApi.Model.T_Cus_CustomerBase DataRowToModel(DataRow row)
  513. {
  514. CallCenterApi.Model.T_Cus_CustomerBase model = new CallCenterApi.Model.T_Cus_CustomerBase();
  515. if (row != null)
  516. {
  517. if (row["F_CustomerId"] != null && row["F_CustomerId"].ToString() != "")
  518. {
  519. model.F_CustomerId = int.Parse(row["F_CustomerId"].ToString());
  520. }
  521. if (row["F_CustomerName"] != null)
  522. {
  523. model.F_CustomerName = row["F_CustomerName"].ToString();
  524. }
  525. if (row["F_CustomerCode"] != null)
  526. {
  527. model.F_CustomerCode = row["F_CustomerCode"].ToString();
  528. }
  529. if (row["F_CustomerEName"] != null)
  530. {
  531. model.F_CustomerEName = row["F_CustomerEName"].ToString();
  532. }
  533. if (row["F_CustomerPym"] != null)
  534. {
  535. model.F_CustomerPym = row["F_CustomerPym"].ToString();
  536. }
  537. if (row["F_Layer"] != null && row["F_Layer"].ToString() != "")
  538. {
  539. model.F_Layer = int.Parse(row["F_Layer"].ToString());
  540. }
  541. if (row["F_CustomerLayer"] != null)
  542. {
  543. model.F_CustomerLayer = row["F_CustomerLayer"].ToString();
  544. }
  545. if (row["F_CategoryId"] != null && row["F_CategoryId"].ToString() != "")
  546. {
  547. model.F_CategoryId = int.Parse(row["F_CategoryId"].ToString());
  548. }
  549. if (row["F_TradeId"] != null && row["F_TradeId"].ToString() != "")
  550. {
  551. model.F_TradeId = int.Parse(row["F_TradeId"].ToString());
  552. }
  553. if (row["F_RegionId"] != null && row["F_RegionId"].ToString() != "")
  554. {
  555. model.F_RegionId = int.Parse(row["F_RegionId"].ToString());
  556. }
  557. if (row["F_IndustryId"] != null && row["F_IndustryId"].ToString() != "")
  558. {
  559. model.F_IndustryId = int.Parse(row["F_IndustryId"].ToString());
  560. }
  561. if (row["F_Address"] != null)
  562. {
  563. model.F_Address = row["F_Address"].ToString();
  564. }
  565. if (row["F_Url"] != null)
  566. {
  567. model.F_Url = row["F_Url"].ToString();
  568. }
  569. if (row["F_Telephone"] != null)
  570. {
  571. model.F_Telephone = row["F_Telephone"].ToString();
  572. }
  573. if (row["F_Mobile"] != null)
  574. {
  575. model.F_Mobile = row["F_Mobile"].ToString();
  576. }
  577. if (row["F_Fax"] != null)
  578. {
  579. model.F_Fax = row["F_Fax"].ToString();
  580. }
  581. if (row["F_Email"] != null)
  582. {
  583. model.F_Email = row["F_Email"].ToString();
  584. }
  585. if (row["F_Website"] != null)
  586. {
  587. model.F_Website = row["F_Website"].ToString();
  588. }
  589. if (row["F_PostCode"] != null)
  590. {
  591. model.F_PostCode = row["F_PostCode"].ToString();
  592. }
  593. if (row["F_ScaleResume"] != null)
  594. {
  595. model.F_ScaleResume = row["F_ScaleResume"].ToString();
  596. }
  597. if (row["F_BusinessProfile"] != null)
  598. {
  599. model.F_BusinessProfile = row["F_BusinessProfile"].ToString();
  600. }
  601. if (row["F_BusinessLicenseID"] != null)
  602. {
  603. model.F_BusinessLicenseID = row["F_BusinessLicenseID"].ToString();
  604. }
  605. if (row["F_TaxID"] != null)
  606. {
  607. model.F_TaxID = row["F_TaxID"].ToString();
  608. }
  609. if (row["F_OpeningBank"] != null)
  610. {
  611. model.F_OpeningBank = row["F_OpeningBank"].ToString();
  612. }
  613. if (row["F_BankAccount"] != null)
  614. {
  615. model.F_BankAccount = row["F_BankAccount"].ToString();
  616. }
  617. if (row["F_LegalRepresentative"] != null)
  618. {
  619. model.F_LegalRepresentative = row["F_LegalRepresentative"].ToString();
  620. }
  621. if (row["F_LegalRepresentativeCardID"] != null)
  622. {
  623. model.F_LegalRepresentativeCardID = row["F_LegalRepresentativeCardID"].ToString();
  624. }
  625. if (row["F_Nature"] != null)
  626. {
  627. model.F_Nature = row["F_Nature"].ToString();
  628. }
  629. if (row["F_Kind"] != null)
  630. {
  631. model.F_Kind = row["F_Kind"].ToString();
  632. }
  633. if (row["F_CustomerType"] != null && row["F_CustomerType"].ToString() != "")
  634. {
  635. model.F_CustomerType = int.Parse(row["F_CustomerType"].ToString());
  636. }
  637. if (row["F_MainProduct"] != null)
  638. {
  639. model.F_MainProduct = row["F_MainProduct"].ToString();
  640. }
  641. if (row["F_CustomerFrom"] != null)
  642. {
  643. model.F_CustomerFrom = row["F_CustomerFrom"].ToString();
  644. }
  645. if (row["F_TrackInfo"] != null)
  646. {
  647. model.F_TrackInfo = row["F_TrackInfo"].ToString();
  648. }
  649. if (row["F_TrackState"] != null)
  650. {
  651. model.F_TrackState = row["F_TrackState"].ToString();
  652. }
  653. if (row["F_ImportDegree"] != null)
  654. {
  655. model.F_ImportDegree = row["F_ImportDegree"].ToString();
  656. }
  657. if (row["F_IntentProduct"] != null)
  658. {
  659. model.F_IntentProduct = row["F_IntentProduct"].ToString();
  660. }
  661. if (row["F_CreateBy"] != null && row["F_CreateBy"].ToString() != "")
  662. {
  663. model.F_CreateBy = int.Parse(row["F_CreateBy"].ToString());
  664. }
  665. if (row["F_CreatedOn"] != null && row["F_CreatedOn"].ToString() != "")
  666. {
  667. model.F_CreatedOn = DateTime.Parse(row["F_CreatedOn"].ToString());
  668. }
  669. if (row["F_ModifyBy"] != null && row["F_ModifyBy"].ToString() != "")
  670. {
  671. model.F_ModifyBy = int.Parse(row["F_ModifyBy"].ToString());
  672. }
  673. if (row["F_ModifiedOn"] != null && row["F_ModifiedOn"].ToString() != "")
  674. {
  675. model.F_ModifiedOn = DateTime.Parse(row["F_ModifiedOn"].ToString());
  676. }
  677. if (row["F_DeleteFlag"] != null && row["F_DeleteFlag"].ToString() != "")
  678. {
  679. model.F_DeleteFlag = int.Parse(row["F_DeleteFlag"].ToString());
  680. }
  681. if (row["F_StatusCode"] != null && row["F_StatusCode"].ToString() != "")
  682. {
  683. model.F_StatusCode = int.Parse(row["F_StatusCode"].ToString());
  684. }
  685. if (row["F_ServiceDept"] != null)
  686. {
  687. model.F_ServiceDept = row["F_ServiceDept"].ToString();
  688. }
  689. if (row["F_ChargeName"] != null)
  690. {
  691. model.F_ChargeName = row["F_ChargeName"].ToString();
  692. }
  693. if (row["F_ChargeTelephone"] != null)
  694. {
  695. model.F_ChargeTelephone = row["F_ChargeTelephone"].ToString();
  696. }
  697. if (row["F_Province"] != null)
  698. {
  699. model.F_Province = row["F_Province"].ToString();
  700. }
  701. if (row["F_ProductLine"] != null)
  702. {
  703. model.F_ProductLine = row["F_ProductLine"].ToString();
  704. }
  705. if (row["F_ChargeDept"] != null)
  706. {
  707. model.F_ChargeDept = row["F_ChargeDept"].ToString();
  708. }
  709. if (row["F_AfterSaleName"] != null)
  710. {
  711. model.F_AfterSaleName = row["F_AfterSaleName"].ToString();
  712. }
  713. if (row["F_CustomerNature"] != null)
  714. {
  715. model.F_CustomerNature = row["F_CustomerNature"].ToString();
  716. }
  717. if (row["F_CustomerClass"] != null)
  718. {
  719. model.F_CustomerClass = row["F_CustomerClass"].ToString();
  720. }
  721. if (row["F_CustomerIndustry"] != null)
  722. {
  723. model.F_CustomerIndustry = row["F_CustomerIndustry"].ToString();
  724. }
  725. if (row["F_RelationShipClass"] != null)
  726. {
  727. model.F_RelationShipClass = row["F_RelationShipClass"].ToString();
  728. }
  729. if (row["F_CurrentVersion"] != null)
  730. {
  731. model.F_CurrentVersion = row["F_CurrentVersion"].ToString();
  732. }
  733. if (row["F_SystemStartTime"] != null && row["F_SystemStartTime"].ToString() != "")
  734. {
  735. model.F_SystemStartTime = DateTime.Parse(row["F_SystemStartTime"].ToString());
  736. }
  737. if (row["F_QualityGuaranteeEndTime"] != null && row["F_QualityGuaranteeEndTime"].ToString() != "")
  738. {
  739. model.F_QualityGuaranteeEndTime = DateTime.Parse(row["F_QualityGuaranteeEndTime"].ToString());
  740. }
  741. if (row["F_AfterSaleTelephone"] != null)
  742. {
  743. model.F_AfterSaleTelephone = row["F_AfterSaleTelephone"].ToString();
  744. }
  745. if (row["F_Notes"] != null)
  746. {
  747. model.F_Notes = row["F_Notes"].ToString();
  748. }
  749. if (row["F_SystemType"] != null)
  750. {
  751. model.F_SystemType = row["F_SystemType"].ToString();
  752. }
  753. if (row["F_City"] != null)
  754. {
  755. model.F_City = row["F_City"].ToString();
  756. }
  757. if (row["F_CustomerStatus"] != null)
  758. {
  759. model.F_CustomerStatus = row["F_CustomerStatus"].ToString();
  760. }
  761. if (row["F_DeviceCount"] != null && row["F_DeviceCount"].ToString() != "")
  762. {
  763. model.F_DeviceCount = int.Parse(row["F_DeviceCount"].ToString());
  764. }
  765. if (row["F_MaintenanceType"] != null)
  766. {
  767. model.F_MaintenanceType = row["F_MaintenanceType"].ToString();
  768. }
  769. if (row["F_ERPCustomerCode"] != null)
  770. {
  771. model.F_ERPCustomerCode = row["F_ERPCustomerCode"].ToString();
  772. }
  773. if (row["F_ServiceDeptID"] != null && row["F_ServiceDeptID"].ToString() != "")
  774. {
  775. model.F_ServiceDeptID = int.Parse(row["F_ServiceDeptID"].ToString());
  776. }
  777. if (row["F_ProductLineID"] != null && row["F_ProductLineID"].ToString() != "")
  778. {
  779. model.F_ProductLineID = int.Parse(row["F_ProductLineID"].ToString());
  780. }
  781. if (row["F_AfterSaleNameID"] != null && row["F_AfterSaleNameID"].ToString() != "")
  782. {
  783. model.F_AfterSaleNameID = int.Parse(row["F_AfterSaleNameID"].ToString());
  784. }
  785. if (row["F_CustomerNatureID"] != null && row["F_CustomerNatureID"].ToString() != "")
  786. {
  787. model.F_CustomerNatureID = int.Parse(row["F_CustomerNatureID"].ToString());
  788. }
  789. if (row["F_CustomerClassID"] != null && row["F_CustomerClassID"].ToString() != "")
  790. {
  791. model.F_CustomerClassID = int.Parse(row["F_CustomerClassID"].ToString());
  792. }
  793. if (row["F_RelationShipClassID"] != null && row["F_RelationShipClassID"].ToString() != "")
  794. {
  795. model.F_RelationShipClassID = int.Parse(row["F_RelationShipClassID"].ToString());
  796. }
  797. if (row["F_CityID"] != null && row["F_CityID"].ToString() != "")
  798. {
  799. model.F_CityID = int.Parse(row["F_CityID"].ToString());
  800. }
  801. //2017-11-2
  802. if (row["F_AutoFlag"] != null && row["F_AutoFlag"].ToString() != "")
  803. {
  804. model.F_AutoFlag = int.Parse(row["F_AutoFlag"].ToString());
  805. }
  806. if (row["F_Result"] != null)
  807. {
  808. model.F_Result = row["F_Result"].ToString();
  809. }
  810. }
  811. return model;
  812. }
  813. /// <summary>
  814. /// 获得数据列表
  815. /// </summary>
  816. public DataSet GetList(string strWhere)
  817. {
  818. StringBuilder strSql = new StringBuilder();
  819. strSql.Append("select F_CustomerId,F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID ");
  820. strSql.Append(" FROM T_Cus_CustomerBase ");
  821. if (strWhere.Trim() != "")
  822. {
  823. strSql.Append(" where " + strWhere);
  824. }
  825. return DbHelperSQL.Query(strSql.ToString());
  826. }
  827. /// <summary>
  828. /// 获得前几行数据
  829. /// </summary>
  830. public DataSet GetList(int Top, string strWhere, string filedOrder)
  831. {
  832. StringBuilder strSql = new StringBuilder();
  833. strSql.Append("select ");
  834. if (Top > 0)
  835. {
  836. strSql.Append(" top " + Top.ToString());
  837. }
  838. strSql.Append(" F_CustomerId,F_CustomerName,F_CustomerCode,F_CustomerEName,F_CustomerPym,F_Layer,F_CustomerLayer,F_CategoryId,F_TradeId,F_RegionId,F_IndustryId,F_Address,F_Url,F_Telephone,F_Mobile,F_Fax,F_Email,F_Website,F_PostCode,F_ScaleResume,F_BusinessProfile,F_BusinessLicenseID,F_TaxID,F_OpeningBank,F_BankAccount,F_LegalRepresentative,F_LegalRepresentativeCardID,F_Nature,F_Kind,F_CustomerType,F_MainProduct,F_CustomerFrom,F_TrackInfo,F_TrackState,F_ImportDegree,F_IntentProduct,F_CreateBy,F_CreatedOn,F_ModifyBy,F_ModifiedOn,F_DeleteFlag,F_StatusCode,F_ServiceDept,F_ChargeName,F_ChargeTelephone,F_Province,F_ProductLine,F_ChargeDept,F_AfterSaleName,F_CustomerNature,F_CustomerClass,F_CustomerIndustry,F_RelationShipClass,F_CurrentVersion,F_SystemStartTime,F_QualityGuaranteeEndTime,F_AfterSaleTelephone,F_Notes,F_SystemType,F_City,F_CustomerStatus,F_DeviceCount,F_MaintenanceType,F_ERPCustomerCode,F_ServiceDeptID,F_ProductLineID,F_AfterSaleNameID,F_CustomerNatureID,F_CustomerClassID,F_RelationShipClassID,F_CityID ");
  839. strSql.Append(" FROM T_Cus_CustomerBase ");
  840. if (strWhere.Trim() != "")
  841. {
  842. strSql.Append(" where " + strWhere);
  843. }
  844. strSql.Append(" order by " + filedOrder);
  845. return DbHelperSQL.Query(strSql.ToString());
  846. }
  847. /// <summary>
  848. /// 获取记录总数
  849. /// </summary>
  850. public int GetRecordCount(string strWhere)
  851. {
  852. StringBuilder strSql = new StringBuilder();
  853. strSql.Append("select count(1) FROM T_Cus_CustomerBase ");
  854. if (strWhere.Trim() != "")
  855. {
  856. strSql.Append(" where " + strWhere);
  857. }
  858. object obj = DbHelperSQL.GetSingle(strSql.ToString());
  859. if (obj == null)
  860. {
  861. return 0;
  862. }
  863. else
  864. {
  865. return Convert.ToInt32(obj);
  866. }
  867. }
  868. /// <summary>
  869. /// 分页获取数据列表
  870. /// </summary>
  871. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  872. {
  873. StringBuilder strSql = new StringBuilder();
  874. strSql.Append("SELECT * FROM ( ");
  875. strSql.Append(" SELECT ROW_NUMBER() OVER (");
  876. if (!string.IsNullOrEmpty(orderby.Trim()))
  877. {
  878. strSql.Append("order by T." + orderby);
  879. }
  880. else
  881. {
  882. strSql.Append("order by T.F_CustomerId desc");
  883. }
  884. strSql.Append(")AS Row, T.* from T_Cus_CustomerBase T ");
  885. if (!string.IsNullOrEmpty(strWhere.Trim()))
  886. {
  887. strSql.Append(" WHERE " + strWhere);
  888. }
  889. strSql.Append(" ) TT");
  890. strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
  891. return DbHelperSQL.Query(strSql.ToString());
  892. }
  893. /*
  894. /// <summary>
  895. /// 分页获取数据列表
  896. /// </summary>
  897. public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  898. {
  899. SqlParameter[] parameters = {
  900. new SqlParameter("@tblName", SqlDbType.VarChar, 255),
  901. new SqlParameter("@fldName", SqlDbType.VarChar, 255),
  902. new SqlParameter("@PageSize", SqlDbType.Int),
  903. new SqlParameter("@PageIndex", SqlDbType.Int),
  904. new SqlParameter("@IsReCount", SqlDbType.Bit),
  905. new SqlParameter("@OrderType", SqlDbType.Bit),
  906. new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
  907. };
  908. parameters[0].Value = "T_Cus_CustomerBase";
  909. parameters[1].Value = "F_CustomerId";
  910. parameters[2].Value = PageSize;
  911. parameters[3].Value = PageIndex;
  912. parameters[4].Value = 0;
  913. parameters[5].Value = 0;
  914. parameters[6].Value = strWhere;
  915. return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
  916. }*/
  917. //2017-11-2
  918. /// <summary>
  919. /// 是否存在该记录
  920. /// </summary>
  921. public bool PhoneExists(string F_Mobile)
  922. {
  923. StringBuilder strSql = new StringBuilder();
  924. strSql.Append("select count(1) from T_Cus_CustomerBase");
  925. strSql.Append(" where F_Mobile=@F_Mobile");
  926. SqlParameter[] parameters = {
  927. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,100)
  928. };
  929. parameters[0].Value = F_Mobile;
  930. return DbHelperSQL.Exists(strSql.ToString(), parameters);
  931. }
  932. /// <summary>
  933. /// 根据手机号删除一条数据
  934. /// </summary>
  935. public bool PhoneDelete(string F_Mobile)
  936. {
  937. StringBuilder strSql = new StringBuilder();
  938. //strSql.Append("delete from T_Cus_CustomerBase ");
  939. strSql.Append("update T_Cus_CustomerBase set F_DeleteFlag=1");
  940. strSql.Append(" where F_Mobile=@F_Mobile");
  941. SqlParameter[] parameters = {
  942. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,100)
  943. };
  944. parameters[0].Value = F_Mobile;
  945. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  946. if (rows > 0)
  947. {
  948. return true;
  949. }
  950. else
  951. {
  952. return false;
  953. }
  954. }
  955. #endregion BasicMethod
  956. #region ExtensionMethod
  957. #endregion ExtensionMethod
  958. }
  959. }