地铁二期项目正式开始

T_Cus_CustomerBase.cs 72KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  1. /** 版本信息模板在安装目录下,可自行修改。
  2. * T_Cus_CustomerBase.cs
  3. *
  4. * 功 能: N/A
  5. * 类 名: T_Cus_CustomerBase
  6. *
  7. * Ver 变更日期 负责人 变更内容
  8. * ───────────────────────────────────
  9. * V0.01 2015/2/27 16:05:58 N/A 初版
  10. *
  11. * Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
  12. *┌──────────────────────────────────┐
  13. *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │
  14. *│ 版权所有:动软卓越(北京)科技有限公司              │
  15. *└──────────────────────────────────┘
  16. */
  17. using System;
  18. using System.Data;
  19. using System.Text;
  20. using System.Data.SqlClient;
  21. using YTSoft.DBUtility;//Please add references
  22. namespace YTSoft.BaseCallCenter.DAL
  23. {
  24. /// <summary>
  25. /// 数据访问类:T_Cus_CustomerBase
  26. /// </summary>
  27. public partial class T_Cus_CustomerBase
  28. {
  29. public T_Cus_CustomerBase()
  30. { }
  31. #region BasicMethod
  32. /// <summary>
  33. /// 得到最大ID
  34. /// </summary>
  35. public int GetMaxId()
  36. {
  37. return DbHelperSQL.GetMaxID("F_CustomerId", "T_Cus_CustomerBase");
  38. }
  39. /// <summary>
  40. /// 是否存在该记录
  41. /// </summary>
  42. public bool Exists(int F_CustomerId)
  43. {
  44. StringBuilder strSql = new StringBuilder();
  45. strSql.Append("select count(1) from T_Cus_CustomerBase");
  46. strSql.Append(" where F_CustomerId=@F_CustomerId");
  47. SqlParameter[] parameters = {
  48. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
  49. };
  50. parameters[0].Value = F_CustomerId;
  51. return DbHelperSQL.Exists(strSql.ToString(), parameters);
  52. }
  53. /// <summary>
  54. /// 增加一条数据
  55. /// </summary>
  56. public int Add(YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model)
  57. {
  58. StringBuilder strSql = new StringBuilder();
  59. strSql.Append("insert into T_Cus_CustomerBase(");
  60. 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)");
  61. strSql.Append(" values (");
  62. 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)");
  63. strSql.Append(";select @@IDENTITY");
  64. SqlParameter[] parameters = {
  65. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
  66. new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
  67. new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,800),
  68. new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,50),
  69. new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
  70. new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,50),
  71. new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
  72. new SqlParameter("@F_TradeId", SqlDbType.Int,4),
  73. new SqlParameter("@F_RegionId", SqlDbType.Int,4),
  74. new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
  75. new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
  76. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  77. new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
  78. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
  79. new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
  80. new SqlParameter("@F_Email", SqlDbType.VarChar,200),
  81. new SqlParameter("@F_Website", SqlDbType.VarChar,200),
  82. new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
  83. new SqlParameter("@F_ScaleResume", SqlDbType.NVarChar,2000),
  84. new SqlParameter("@F_BusinessProfile", SqlDbType.NVarChar,2000),
  85. new SqlParameter("@F_BusinessLicenseID", SqlDbType.VarChar,80),
  86. new SqlParameter("@F_TaxID", SqlDbType.VarChar,80),
  87. new SqlParameter("@F_OpeningBank", SqlDbType.NVarChar,100),
  88. new SqlParameter("@F_BankAccount", SqlDbType.VarChar,80),
  89. new SqlParameter("@F_LegalRepresentative", SqlDbType.VarChar,50),
  90. new SqlParameter("@F_LegalRepresentativeCardID", SqlDbType.VarChar,30),
  91. new SqlParameter("@F_Nature", SqlDbType.NVarChar,80),
  92. new SqlParameter("@F_Kind", SqlDbType.NVarChar,80),
  93. new SqlParameter("@F_CustomerType", SqlDbType.Int,4),
  94. new SqlParameter("@F_MainProduct", SqlDbType.Text),
  95. new SqlParameter("@F_CustomerFrom", SqlDbType.NVarChar,200),
  96. new SqlParameter("@F_TrackInfo", SqlDbType.NVarChar,200),
  97. new SqlParameter("@F_TrackState", SqlDbType.NVarChar,50),
  98. new SqlParameter("@F_ImportDegree", SqlDbType.NVarChar,50),
  99. new SqlParameter("@F_IntentProduct", SqlDbType.Text),
  100. new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
  101. new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
  102. new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
  103. new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
  104. new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
  105. new SqlParameter("@F_StatusCode", SqlDbType.SmallInt,2),
  106. new SqlParameter("@F_ServiceDept", SqlDbType.NVarChar,20),
  107. new SqlParameter("@F_ChargeName", SqlDbType.NVarChar,20),
  108. new SqlParameter("@F_ChargeTelephone", SqlDbType.VarChar,15),
  109. new SqlParameter("@F_Province", SqlDbType.NVarChar,20),
  110. new SqlParameter("@F_ProductLine", SqlDbType.NVarChar,50),
  111. new SqlParameter("@F_ChargeDept", SqlDbType.NVarChar,20),
  112. new SqlParameter("@F_AfterSaleName", SqlDbType.NVarChar,20),
  113. new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,20),
  114. new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,10),
  115. new SqlParameter("@F_CustomerIndustry", SqlDbType.NVarChar,10),
  116. new SqlParameter("@F_RelationShipClass", SqlDbType.NVarChar,10),
  117. new SqlParameter("@F_CurrentVersion", SqlDbType.VarChar,100),
  118. new SqlParameter("@F_SystemStartTime", SqlDbType.DateTime),
  119. new SqlParameter("@F_QualityGuaranteeEndTime", SqlDbType.DateTime),
  120. new SqlParameter("@F_AfterSaleTelephone", SqlDbType.VarChar,15),
  121. new SqlParameter("@F_Notes", SqlDbType.NVarChar,500),
  122. new SqlParameter("@F_SystemType", SqlDbType.NVarChar,100),
  123. new SqlParameter("@F_City", SqlDbType.NVarChar,10),
  124. new SqlParameter("@F_CustomerStatus", SqlDbType.NVarChar,10),
  125. new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
  126. new SqlParameter("@F_MaintenanceType", SqlDbType.NVarChar,30),
  127. new SqlParameter("@F_ERPCustomerCode", SqlDbType.VarChar,100),
  128. new SqlParameter("@F_ServiceDeptID", SqlDbType.Int,4),
  129. new SqlParameter("@F_ProductLineID", SqlDbType.Int,4),
  130. new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
  131. new SqlParameter("@F_CustomerNatureID", SqlDbType.Int,4),
  132. new SqlParameter("@F_CustomerClassID", SqlDbType.Int,4),
  133. new SqlParameter("@F_RelationShipClassID", SqlDbType.Int,4),
  134. new SqlParameter("@F_CityID", SqlDbType.Int,4)};
  135. parameters[0].Value = model.F_CustomerName;
  136. parameters[1].Value = model.F_CustomerCode;
  137. parameters[2].Value = model.F_CustomerEName;
  138. parameters[3].Value = model.F_CustomerPym;
  139. parameters[4].Value = model.F_Layer;
  140. parameters[5].Value = model.F_CustomerLayer;
  141. parameters[6].Value = model.F_CategoryId;
  142. parameters[7].Value = model.F_TradeId;
  143. parameters[8].Value = model.F_RegionId;
  144. parameters[9].Value = model.F_IndustryId;
  145. parameters[10].Value = model.F_Address;
  146. parameters[11].Value = model.F_Url;
  147. parameters[12].Value = model.F_Telephone;
  148. parameters[13].Value = model.F_Mobile;
  149. parameters[14].Value = model.F_Fax;
  150. parameters[15].Value = model.F_Email;
  151. parameters[16].Value = model.F_Website;
  152. parameters[17].Value = model.F_PostCode;
  153. parameters[18].Value = model.F_ScaleResume;
  154. parameters[19].Value = model.F_BusinessProfile;
  155. parameters[20].Value = model.F_BusinessLicenseID;
  156. parameters[21].Value = model.F_TaxID;
  157. parameters[22].Value = model.F_OpeningBank;
  158. parameters[23].Value = model.F_BankAccount;
  159. parameters[24].Value = model.F_LegalRepresentative;
  160. parameters[25].Value = model.F_LegalRepresentativeCardID;
  161. parameters[26].Value = model.F_Nature;
  162. parameters[27].Value = model.F_Kind;
  163. parameters[28].Value = model.F_CustomerType;
  164. parameters[29].Value = model.F_MainProduct;
  165. parameters[30].Value = model.F_CustomerFrom;
  166. parameters[31].Value = model.F_TrackInfo;
  167. parameters[32].Value = model.F_TrackState;
  168. parameters[33].Value = model.F_ImportDegree;
  169. parameters[34].Value = model.F_IntentProduct;
  170. parameters[35].Value = model.F_CreateBy;
  171. parameters[36].Value = model.F_CreatedOn;
  172. parameters[37].Value = model.F_ModifyBy;
  173. parameters[38].Value = model.F_ModifiedOn;
  174. parameters[39].Value = model.F_DeleteFlag;
  175. parameters[40].Value = model.F_StatusCode;
  176. parameters[41].Value = model.F_ServiceDept;
  177. parameters[42].Value = model.F_ChargeName;
  178. parameters[43].Value = model.F_ChargeTelephone;
  179. parameters[44].Value = model.F_Province;
  180. parameters[45].Value = model.F_ProductLine;
  181. parameters[46].Value = model.F_ChargeDept;
  182. parameters[47].Value = model.F_AfterSaleName;
  183. parameters[48].Value = model.F_CustomerNature;
  184. parameters[49].Value = model.F_CustomerClass;
  185. parameters[50].Value = model.F_CustomerIndustry;
  186. parameters[51].Value = model.F_RelationShipClass;
  187. parameters[52].Value = model.F_CurrentVersion;
  188. parameters[53].Value = model.F_SystemStartTime;
  189. parameters[54].Value = model.F_QualityGuaranteeEndTime;
  190. parameters[55].Value = model.F_AfterSaleTelephone;
  191. parameters[56].Value = model.F_Notes;
  192. parameters[57].Value = model.F_SystemType;
  193. parameters[58].Value = model.F_City;
  194. parameters[59].Value = model.F_CustomerStatus;
  195. parameters[60].Value = model.F_DeviceCount;
  196. parameters[61].Value = model.F_MaintenanceType;
  197. parameters[62].Value = model.F_ERPCustomerCode;
  198. parameters[63].Value = model.F_ServiceDeptID;
  199. parameters[64].Value = model.F_ProductLineID;
  200. parameters[65].Value = model.F_AfterSaleNameID;
  201. parameters[66].Value = model.F_CustomerNatureID;
  202. parameters[67].Value = model.F_CustomerClassID;
  203. parameters[68].Value = model.F_RelationShipClassID;
  204. parameters[69].Value = model.F_CityID;
  205. object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
  206. if (obj == null)
  207. {
  208. return 0;
  209. }
  210. else
  211. {
  212. return Convert.ToInt32(obj);
  213. }
  214. }
  215. /// <summary>
  216. /// 更新一条数据
  217. /// </summary>
  218. public bool Update(YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model)
  219. {
  220. StringBuilder strSql = new StringBuilder();
  221. strSql.Append("update T_Cus_CustomerBase set ");
  222. strSql.Append("F_CustomerName=@F_CustomerName,");
  223. strSql.Append("F_CustomerCode=@F_CustomerCode,");
  224. strSql.Append("F_CustomerEName=@F_CustomerEName,");
  225. strSql.Append("F_CustomerPym=@F_CustomerPym,");
  226. strSql.Append("F_Layer=@F_Layer,");
  227. strSql.Append("F_CustomerLayer=@F_CustomerLayer,");
  228. strSql.Append("F_CategoryId=@F_CategoryId,");
  229. strSql.Append("F_TradeId=@F_TradeId,");
  230. strSql.Append("F_RegionId=@F_RegionId,");
  231. strSql.Append("F_IndustryId=@F_IndustryId,");
  232. strSql.Append("F_Address=@F_Address,");
  233. strSql.Append("F_Url=@F_Url,");
  234. strSql.Append("F_Telephone=@F_Telephone,");
  235. strSql.Append("F_Mobile=@F_Mobile,");
  236. strSql.Append("F_Fax=@F_Fax,");
  237. strSql.Append("F_Email=@F_Email,");
  238. strSql.Append("F_Website=@F_Website,");
  239. strSql.Append("F_PostCode=@F_PostCode,");
  240. strSql.Append("F_ScaleResume=@F_ScaleResume,");
  241. strSql.Append("F_BusinessProfile=@F_BusinessProfile,");
  242. strSql.Append("F_BusinessLicenseID=@F_BusinessLicenseID,");
  243. strSql.Append("F_TaxID=@F_TaxID,");
  244. strSql.Append("F_OpeningBank=@F_OpeningBank,");
  245. strSql.Append("F_BankAccount=@F_BankAccount,");
  246. strSql.Append("F_LegalRepresentative=@F_LegalRepresentative,");
  247. strSql.Append("F_LegalRepresentativeCardID=@F_LegalRepresentativeCardID,");
  248. strSql.Append("F_Nature=@F_Nature,");
  249. strSql.Append("F_Kind=@F_Kind,");
  250. strSql.Append("F_CustomerType=@F_CustomerType,");
  251. strSql.Append("F_MainProduct=@F_MainProduct,");
  252. strSql.Append("F_CustomerFrom=@F_CustomerFrom,");
  253. strSql.Append("F_TrackInfo=@F_TrackInfo,");
  254. strSql.Append("F_TrackState=@F_TrackState,");
  255. strSql.Append("F_ImportDegree=@F_ImportDegree,");
  256. strSql.Append("F_IntentProduct=@F_IntentProduct,");
  257. strSql.Append("F_CreateBy=@F_CreateBy,");
  258. strSql.Append("F_CreatedOn=@F_CreatedOn,");
  259. strSql.Append("F_ModifyBy=@F_ModifyBy,");
  260. strSql.Append("F_ModifiedOn=@F_ModifiedOn,");
  261. strSql.Append("F_DeleteFlag=@F_DeleteFlag,");
  262. strSql.Append("F_StatusCode=@F_StatusCode,");
  263. strSql.Append("F_ServiceDept=@F_ServiceDept,");
  264. strSql.Append("F_ChargeName=@F_ChargeName,");
  265. strSql.Append("F_ChargeTelephone=@F_ChargeTelephone,");
  266. strSql.Append("F_Province=@F_Province,");
  267. strSql.Append("F_ProductLine=@F_ProductLine,");
  268. strSql.Append("F_ChargeDept=@F_ChargeDept,");
  269. strSql.Append("F_AfterSaleName=@F_AfterSaleName,");
  270. strSql.Append("F_CustomerNature=@F_CustomerNature,");
  271. strSql.Append("F_CustomerClass=@F_CustomerClass,");
  272. strSql.Append("F_CustomerIndustry=@F_CustomerIndustry,");
  273. strSql.Append("F_RelationShipClass=@F_RelationShipClass,");
  274. strSql.Append("F_CurrentVersion=@F_CurrentVersion,");
  275. strSql.Append("F_SystemStartTime=@F_SystemStartTime,");
  276. strSql.Append("F_QualityGuaranteeEndTime=@F_QualityGuaranteeEndTime,");
  277. strSql.Append("F_AfterSaleTelephone=@F_AfterSaleTelephone,");
  278. strSql.Append("F_Notes=@F_Notes,");
  279. strSql.Append("F_SystemType=@F_SystemType,");
  280. strSql.Append("F_City=@F_City,");
  281. strSql.Append("F_CustomerStatus=@F_CustomerStatus,");
  282. strSql.Append("F_DeviceCount=@F_DeviceCount,");
  283. strSql.Append("F_MaintenanceType=@F_MaintenanceType,");
  284. strSql.Append("F_ERPCustomerCode=@F_ERPCustomerCode,");
  285. strSql.Append("F_ServiceDeptID=@F_ServiceDeptID,");
  286. strSql.Append("F_ProductLineID=@F_ProductLineID,");
  287. strSql.Append("F_AfterSaleNameID=@F_AfterSaleNameID,");
  288. strSql.Append("F_CustomerNatureID=@F_CustomerNatureID,");
  289. strSql.Append("F_CustomerClassID=@F_CustomerClassID,");
  290. strSql.Append("F_RelationShipClassID=@F_RelationShipClassID,");
  291. strSql.Append("F_CityID=@F_CityID");
  292. strSql.Append(" where F_CustomerId=@F_CustomerId");
  293. SqlParameter[] parameters = {
  294. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
  295. new SqlParameter("@F_CustomerCode", SqlDbType.VarChar,100),
  296. new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,800),
  297. new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,50),
  298. new SqlParameter("@F_Layer", SqlDbType.SmallInt,2),
  299. new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,50),
  300. new SqlParameter("@F_CategoryId", SqlDbType.Int,4),
  301. new SqlParameter("@F_TradeId", SqlDbType.Int,4),
  302. new SqlParameter("@F_RegionId", SqlDbType.Int,4),
  303. new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
  304. new SqlParameter("@F_Address", SqlDbType.NVarChar,300),
  305. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  306. new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
  307. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
  308. new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
  309. new SqlParameter("@F_Email", SqlDbType.VarChar,200),
  310. new SqlParameter("@F_Website", SqlDbType.VarChar,200),
  311. new SqlParameter("@F_PostCode", SqlDbType.NVarChar,50),
  312. new SqlParameter("@F_ScaleResume", SqlDbType.NVarChar,2000),
  313. new SqlParameter("@F_BusinessProfile", SqlDbType.NVarChar,2000),
  314. new SqlParameter("@F_BusinessLicenseID", SqlDbType.VarChar,80),
  315. new SqlParameter("@F_TaxID", SqlDbType.VarChar,80),
  316. new SqlParameter("@F_OpeningBank", SqlDbType.NVarChar,100),
  317. new SqlParameter("@F_BankAccount", SqlDbType.VarChar,80),
  318. new SqlParameter("@F_LegalRepresentative", SqlDbType.VarChar,50),
  319. new SqlParameter("@F_LegalRepresentativeCardID", SqlDbType.VarChar,30),
  320. new SqlParameter("@F_Nature", SqlDbType.NVarChar,80),
  321. new SqlParameter("@F_Kind", SqlDbType.NVarChar,80),
  322. new SqlParameter("@F_CustomerType", SqlDbType.Int,4),
  323. new SqlParameter("@F_MainProduct", SqlDbType.Text),
  324. new SqlParameter("@F_CustomerFrom", SqlDbType.NVarChar,200),
  325. new SqlParameter("@F_TrackInfo", SqlDbType.NVarChar,200),
  326. new SqlParameter("@F_TrackState", SqlDbType.NVarChar,50),
  327. new SqlParameter("@F_ImportDegree", SqlDbType.NVarChar,50),
  328. new SqlParameter("@F_IntentProduct", SqlDbType.Text),
  329. new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
  330. new SqlParameter("@F_CreatedOn", SqlDbType.DateTime),
  331. new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
  332. new SqlParameter("@F_ModifiedOn", SqlDbType.DateTime),
  333. new SqlParameter("@F_DeleteFlag", SqlDbType.SmallInt,2),
  334. new SqlParameter("@F_StatusCode", SqlDbType.SmallInt,2),
  335. new SqlParameter("@F_ServiceDept", SqlDbType.NVarChar,20),
  336. new SqlParameter("@F_ChargeName", SqlDbType.NVarChar,20),
  337. new SqlParameter("@F_ChargeTelephone", SqlDbType.VarChar,15),
  338. new SqlParameter("@F_Province", SqlDbType.NVarChar,20),
  339. new SqlParameter("@F_ProductLine", SqlDbType.NVarChar,50),
  340. new SqlParameter("@F_ChargeDept", SqlDbType.NVarChar,20),
  341. new SqlParameter("@F_AfterSaleName", SqlDbType.NVarChar,20),
  342. new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,20),
  343. new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,10),
  344. new SqlParameter("@F_CustomerIndustry", SqlDbType.NVarChar,10),
  345. new SqlParameter("@F_RelationShipClass", SqlDbType.NVarChar,10),
  346. new SqlParameter("@F_CurrentVersion", SqlDbType.VarChar,100),
  347. new SqlParameter("@F_SystemStartTime", SqlDbType.DateTime),
  348. new SqlParameter("@F_QualityGuaranteeEndTime", SqlDbType.DateTime),
  349. new SqlParameter("@F_AfterSaleTelephone", SqlDbType.VarChar,15),
  350. new SqlParameter("@F_Notes", SqlDbType.NVarChar,500),
  351. new SqlParameter("@F_SystemType", SqlDbType.NVarChar,100),
  352. new SqlParameter("@F_City", SqlDbType.NVarChar,10),
  353. new SqlParameter("@F_CustomerStatus", SqlDbType.NVarChar,10),
  354. new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
  355. new SqlParameter("@F_MaintenanceType", SqlDbType.NVarChar,30),
  356. new SqlParameter("@F_ERPCustomerCode", SqlDbType.VarChar,100),
  357. new SqlParameter("@F_ServiceDeptID", SqlDbType.Int,4),
  358. new SqlParameter("@F_ProductLineID", SqlDbType.Int,4),
  359. new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
  360. new SqlParameter("@F_CustomerNatureID", SqlDbType.Int,4),
  361. new SqlParameter("@F_CustomerClassID", SqlDbType.Int,4),
  362. new SqlParameter("@F_RelationShipClassID", SqlDbType.Int,4),
  363. new SqlParameter("@F_CityID", SqlDbType.Int,4),
  364. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)};
  365. parameters[0].Value = model.F_CustomerName;
  366. parameters[1].Value = model.F_CustomerCode;
  367. parameters[2].Value = model.F_CustomerEName;
  368. parameters[3].Value = model.F_CustomerPym;
  369. parameters[4].Value = model.F_Layer;
  370. parameters[5].Value = model.F_CustomerLayer;
  371. parameters[6].Value = model.F_CategoryId;
  372. parameters[7].Value = model.F_TradeId;
  373. parameters[8].Value = model.F_RegionId;
  374. parameters[9].Value = model.F_IndustryId;
  375. parameters[10].Value = model.F_Address;
  376. parameters[11].Value = model.F_Url;
  377. parameters[12].Value = model.F_Telephone;
  378. parameters[13].Value = model.F_Mobile;
  379. parameters[14].Value = model.F_Fax;
  380. parameters[15].Value = model.F_Email;
  381. parameters[16].Value = model.F_Website;
  382. parameters[17].Value = model.F_PostCode;
  383. parameters[18].Value = model.F_ScaleResume;
  384. parameters[19].Value = model.F_BusinessProfile;
  385. parameters[20].Value = model.F_BusinessLicenseID;
  386. parameters[21].Value = model.F_TaxID;
  387. parameters[22].Value = model.F_OpeningBank;
  388. parameters[23].Value = model.F_BankAccount;
  389. parameters[24].Value = model.F_LegalRepresentative;
  390. parameters[25].Value = model.F_LegalRepresentativeCardID;
  391. parameters[26].Value = model.F_Nature;
  392. parameters[27].Value = model.F_Kind;
  393. parameters[28].Value = model.F_CustomerType;
  394. parameters[29].Value = model.F_MainProduct;
  395. parameters[30].Value = model.F_CustomerFrom;
  396. parameters[31].Value = model.F_TrackInfo;
  397. parameters[32].Value = model.F_TrackState;
  398. parameters[33].Value = model.F_ImportDegree;
  399. parameters[34].Value = model.F_IntentProduct;
  400. parameters[35].Value = model.F_CreateBy;
  401. parameters[36].Value = model.F_CreatedOn;
  402. parameters[37].Value = model.F_ModifyBy;
  403. parameters[38].Value = model.F_ModifiedOn;
  404. parameters[39].Value = model.F_DeleteFlag;
  405. parameters[40].Value = model.F_StatusCode;
  406. parameters[41].Value = model.F_ServiceDept;
  407. parameters[42].Value = model.F_ChargeName;
  408. parameters[43].Value = model.F_ChargeTelephone;
  409. parameters[44].Value = model.F_Province;
  410. parameters[45].Value = model.F_ProductLine;
  411. parameters[46].Value = model.F_ChargeDept;
  412. parameters[47].Value = model.F_AfterSaleName;
  413. parameters[48].Value = model.F_CustomerNature;
  414. parameters[49].Value = model.F_CustomerClass;
  415. parameters[50].Value = model.F_CustomerIndustry;
  416. parameters[51].Value = model.F_RelationShipClass;
  417. parameters[52].Value = model.F_CurrentVersion;
  418. parameters[53].Value = model.F_SystemStartTime;
  419. parameters[54].Value = model.F_QualityGuaranteeEndTime;
  420. parameters[55].Value = model.F_AfterSaleTelephone;
  421. parameters[56].Value = model.F_Notes;
  422. parameters[57].Value = model.F_SystemType;
  423. parameters[58].Value = model.F_City;
  424. parameters[59].Value = model.F_CustomerStatus;
  425. parameters[60].Value = model.F_DeviceCount;
  426. parameters[61].Value = model.F_MaintenanceType;
  427. parameters[62].Value = model.F_ERPCustomerCode;
  428. parameters[63].Value = model.F_ServiceDeptID;
  429. parameters[64].Value = model.F_ProductLineID;
  430. parameters[65].Value = model.F_AfterSaleNameID;
  431. parameters[66].Value = model.F_CustomerNatureID;
  432. parameters[67].Value = model.F_CustomerClassID;
  433. parameters[68].Value = model.F_RelationShipClassID;
  434. parameters[69].Value = model.F_CityID;
  435. parameters[70].Value = model.F_CustomerId;
  436. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  437. if (rows > 0)
  438. {
  439. return true;
  440. }
  441. else
  442. {
  443. return false;
  444. }
  445. }
  446. /// <summary>
  447. /// 删除一条数据
  448. /// </summary>
  449. public bool Delete(int F_CustomerId)
  450. {
  451. StringBuilder strSql = new StringBuilder();
  452. //strSql.Append("delete from T_Cus_CustomerBase ");
  453. strSql.Append("update T_Cus_CustomerBase set F_DeleteFlag=1");
  454. strSql.Append(" where F_CustomerId=@F_CustomerId");
  455. SqlParameter[] parameters = {
  456. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
  457. };
  458. parameters[0].Value = F_CustomerId;
  459. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  460. if (rows > 0)
  461. {
  462. return true;
  463. }
  464. else
  465. {
  466. return false;
  467. }
  468. }
  469. /// <summary>
  470. /// 批量删除数据
  471. /// </summary>
  472. public bool DeleteList(string F_CustomerIdlist)
  473. {
  474. StringBuilder strSql = new StringBuilder();
  475. //strSql.Append("delete from T_Cus_CustomerBase ");
  476. strSql.Append("update T_Cus_CustomerBase set F_DeleteFlag=1");
  477. strSql.Append(" where F_CustomerId in (" + F_CustomerIdlist + ") ");
  478. int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
  479. if (rows > 0)
  480. {
  481. return true;
  482. }
  483. else
  484. {
  485. return false;
  486. }
  487. }
  488. /// <summary>
  489. /// 得到一个对象实体
  490. /// </summary>
  491. public YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase GetModel(int F_CustomerId)
  492. {
  493. StringBuilder strSql = new StringBuilder();
  494. 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 from T_Cus_CustomerBase ");
  495. strSql.Append(" where F_CustomerId=@F_CustomerId");
  496. SqlParameter[] parameters = {
  497. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
  498. };
  499. parameters[0].Value = F_CustomerId;
  500. YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model = new YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase();
  501. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  502. if (ds.Tables[0].Rows.Count > 0)
  503. {
  504. return DataRowToModel(ds.Tables[0].Rows[0]);
  505. }
  506. else
  507. {
  508. return null;
  509. }
  510. }
  511. /// <summary>
  512. /// 得到一个对象实体
  513. /// </summary>
  514. public YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase DataRowToModel(DataRow row)
  515. {
  516. YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model = new YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase();
  517. if (row != null)
  518. {
  519. if (row["F_CustomerId"] != null && row["F_CustomerId"].ToString() != "")
  520. {
  521. model.F_CustomerId = int.Parse(row["F_CustomerId"].ToString());
  522. }
  523. if (row["F_CustomerName"] != null)
  524. {
  525. model.F_CustomerName = row["F_CustomerName"].ToString();
  526. }
  527. if (row["F_CustomerCode"] != null)
  528. {
  529. model.F_CustomerCode = row["F_CustomerCode"].ToString();
  530. }
  531. if (row["F_CustomerEName"] != null)
  532. {
  533. model.F_CustomerEName = row["F_CustomerEName"].ToString();
  534. }
  535. if (row["F_CustomerPym"] != null)
  536. {
  537. model.F_CustomerPym = row["F_CustomerPym"].ToString();
  538. }
  539. if (row["F_Layer"] != null && row["F_Layer"].ToString() != "")
  540. {
  541. model.F_Layer = int.Parse(row["F_Layer"].ToString());
  542. }
  543. if (row["F_CustomerLayer"] != null)
  544. {
  545. model.F_CustomerLayer = row["F_CustomerLayer"].ToString();
  546. }
  547. if (row["F_CategoryId"] != null && row["F_CategoryId"].ToString() != "")
  548. {
  549. model.F_CategoryId = int.Parse(row["F_CategoryId"].ToString());
  550. }
  551. if (row["F_TradeId"] != null && row["F_TradeId"].ToString() != "")
  552. {
  553. model.F_TradeId = int.Parse(row["F_TradeId"].ToString());
  554. }
  555. if (row["F_RegionId"] != null && row["F_RegionId"].ToString() != "")
  556. {
  557. model.F_RegionId = int.Parse(row["F_RegionId"].ToString());
  558. }
  559. if (row["F_IndustryId"] != null && row["F_IndustryId"].ToString() != "")
  560. {
  561. model.F_IndustryId = int.Parse(row["F_IndustryId"].ToString());
  562. }
  563. if (row["F_Address"] != null)
  564. {
  565. model.F_Address = row["F_Address"].ToString();
  566. }
  567. if (row["F_Url"] != null)
  568. {
  569. model.F_Url = row["F_Url"].ToString();
  570. }
  571. if (row["F_Telephone"] != null)
  572. {
  573. model.F_Telephone = row["F_Telephone"].ToString();
  574. }
  575. if (row["F_Mobile"] != null)
  576. {
  577. model.F_Mobile = row["F_Mobile"].ToString();
  578. }
  579. if (row["F_Fax"] != null)
  580. {
  581. model.F_Fax = row["F_Fax"].ToString();
  582. }
  583. if (row["F_Email"] != null)
  584. {
  585. model.F_Email = row["F_Email"].ToString();
  586. }
  587. if (row["F_Website"] != null)
  588. {
  589. model.F_Website = row["F_Website"].ToString();
  590. }
  591. if (row["F_PostCode"] != null)
  592. {
  593. model.F_PostCode = row["F_PostCode"].ToString();
  594. }
  595. if (row["F_ScaleResume"] != null)
  596. {
  597. model.F_ScaleResume = row["F_ScaleResume"].ToString();
  598. }
  599. if (row["F_BusinessProfile"] != null)
  600. {
  601. model.F_BusinessProfile = row["F_BusinessProfile"].ToString();
  602. }
  603. if (row["F_BusinessLicenseID"] != null)
  604. {
  605. model.F_BusinessLicenseID = row["F_BusinessLicenseID"].ToString();
  606. }
  607. if (row["F_TaxID"] != null)
  608. {
  609. model.F_TaxID = row["F_TaxID"].ToString();
  610. }
  611. if (row["F_OpeningBank"] != null)
  612. {
  613. model.F_OpeningBank = row["F_OpeningBank"].ToString();
  614. }
  615. if (row["F_BankAccount"] != null)
  616. {
  617. model.F_BankAccount = row["F_BankAccount"].ToString();
  618. }
  619. if (row["F_LegalRepresentative"] != null)
  620. {
  621. model.F_LegalRepresentative = row["F_LegalRepresentative"].ToString();
  622. }
  623. if (row["F_LegalRepresentativeCardID"] != null)
  624. {
  625. model.F_LegalRepresentativeCardID = row["F_LegalRepresentativeCardID"].ToString();
  626. }
  627. if (row["F_Nature"] != null)
  628. {
  629. model.F_Nature = row["F_Nature"].ToString();
  630. }
  631. if (row["F_Kind"] != null)
  632. {
  633. model.F_Kind = row["F_Kind"].ToString();
  634. }
  635. if (row["F_CustomerType"] != null && row["F_CustomerType"].ToString() != "")
  636. {
  637. model.F_CustomerType = int.Parse(row["F_CustomerType"].ToString());
  638. }
  639. if (row["F_MainProduct"] != null)
  640. {
  641. model.F_MainProduct = row["F_MainProduct"].ToString();
  642. }
  643. if (row["F_CustomerFrom"] != null)
  644. {
  645. model.F_CustomerFrom = row["F_CustomerFrom"].ToString();
  646. }
  647. if (row["F_TrackInfo"] != null)
  648. {
  649. model.F_TrackInfo = row["F_TrackInfo"].ToString();
  650. }
  651. if (row["F_TrackState"] != null)
  652. {
  653. model.F_TrackState = row["F_TrackState"].ToString();
  654. }
  655. if (row["F_ImportDegree"] != null)
  656. {
  657. model.F_ImportDegree = row["F_ImportDegree"].ToString();
  658. }
  659. if (row["F_IntentProduct"] != null)
  660. {
  661. model.F_IntentProduct = row["F_IntentProduct"].ToString();
  662. }
  663. if (row["F_CreateBy"] != null && row["F_CreateBy"].ToString() != "")
  664. {
  665. model.F_CreateBy = int.Parse(row["F_CreateBy"].ToString());
  666. }
  667. if (row["F_CreatedOn"] != null && row["F_CreatedOn"].ToString() != "")
  668. {
  669. model.F_CreatedOn = DateTime.Parse(row["F_CreatedOn"].ToString());
  670. }
  671. if (row["F_ModifyBy"] != null && row["F_ModifyBy"].ToString() != "")
  672. {
  673. model.F_ModifyBy = int.Parse(row["F_ModifyBy"].ToString());
  674. }
  675. if (row["F_ModifiedOn"] != null && row["F_ModifiedOn"].ToString() != "")
  676. {
  677. model.F_ModifiedOn = DateTime.Parse(row["F_ModifiedOn"].ToString());
  678. }
  679. if (row["F_DeleteFlag"] != null && row["F_DeleteFlag"].ToString() != "")
  680. {
  681. model.F_DeleteFlag = int.Parse(row["F_DeleteFlag"].ToString());
  682. }
  683. if (row["F_StatusCode"] != null && row["F_StatusCode"].ToString() != "")
  684. {
  685. model.F_StatusCode = int.Parse(row["F_StatusCode"].ToString());
  686. }
  687. if (row["F_ServiceDept"] != null)
  688. {
  689. model.F_ServiceDept = row["F_ServiceDept"].ToString();
  690. }
  691. if (row["F_ChargeName"] != null)
  692. {
  693. model.F_ChargeName = row["F_ChargeName"].ToString();
  694. }
  695. if (row["F_ChargeTelephone"] != null)
  696. {
  697. model.F_ChargeTelephone = row["F_ChargeTelephone"].ToString();
  698. }
  699. if (row["F_Province"] != null)
  700. {
  701. model.F_Province = row["F_Province"].ToString();
  702. }
  703. if (row["F_ProductLine"] != null)
  704. {
  705. model.F_ProductLine = row["F_ProductLine"].ToString();
  706. }
  707. if (row["F_ChargeDept"] != null)
  708. {
  709. model.F_ChargeDept = row["F_ChargeDept"].ToString();
  710. }
  711. if (row["F_AfterSaleName"] != null)
  712. {
  713. model.F_AfterSaleName = row["F_AfterSaleName"].ToString();
  714. }
  715. if (row["F_CustomerNature"] != null)
  716. {
  717. model.F_CustomerNature = row["F_CustomerNature"].ToString();
  718. }
  719. if (row["F_CustomerClass"] != null)
  720. {
  721. model.F_CustomerClass = row["F_CustomerClass"].ToString();
  722. }
  723. if (row["F_CustomerIndustry"] != null)
  724. {
  725. model.F_CustomerIndustry = row["F_CustomerIndustry"].ToString();
  726. }
  727. if (row["F_RelationShipClass"] != null)
  728. {
  729. model.F_RelationShipClass = row["F_RelationShipClass"].ToString();
  730. }
  731. if (row["F_CurrentVersion"] != null)
  732. {
  733. model.F_CurrentVersion = row["F_CurrentVersion"].ToString();
  734. }
  735. if (row["F_SystemStartTime"] != null && row["F_SystemStartTime"].ToString() != "")
  736. {
  737. model.F_SystemStartTime = DateTime.Parse(row["F_SystemStartTime"].ToString());
  738. }
  739. if (row["F_QualityGuaranteeEndTime"] != null && row["F_QualityGuaranteeEndTime"].ToString() != "")
  740. {
  741. model.F_QualityGuaranteeEndTime = DateTime.Parse(row["F_QualityGuaranteeEndTime"].ToString());
  742. }
  743. if (row["F_AfterSaleTelephone"] != null)
  744. {
  745. model.F_AfterSaleTelephone = row["F_AfterSaleTelephone"].ToString();
  746. }
  747. if (row["F_Notes"] != null)
  748. {
  749. model.F_Notes = row["F_Notes"].ToString();
  750. }
  751. if (row["F_SystemType"] != null)
  752. {
  753. model.F_SystemType = row["F_SystemType"].ToString();
  754. }
  755. if (row["F_City"] != null)
  756. {
  757. model.F_City = row["F_City"].ToString();
  758. }
  759. if (row["F_CustomerStatus"] != null)
  760. {
  761. model.F_CustomerStatus = row["F_CustomerStatus"].ToString();
  762. }
  763. if (row["F_DeviceCount"] != null && row["F_DeviceCount"].ToString() != "")
  764. {
  765. model.F_DeviceCount = int.Parse(row["F_DeviceCount"].ToString());
  766. }
  767. if (row["F_MaintenanceType"] != null)
  768. {
  769. model.F_MaintenanceType = row["F_MaintenanceType"].ToString();
  770. }
  771. if (row["F_ERPCustomerCode"] != null)
  772. {
  773. model.F_ERPCustomerCode = row["F_ERPCustomerCode"].ToString();
  774. }
  775. if (row["F_ServiceDeptID"] != null && row["F_ServiceDeptID"].ToString() != "")
  776. {
  777. model.F_ServiceDeptID = int.Parse(row["F_ServiceDeptID"].ToString());
  778. }
  779. if (row["F_ProductLineID"] != null && row["F_ProductLineID"].ToString() != "")
  780. {
  781. model.F_ProductLineID = int.Parse(row["F_ProductLineID"].ToString());
  782. }
  783. if (row["F_AfterSaleNameID"] != null && row["F_AfterSaleNameID"].ToString() != "")
  784. {
  785. model.F_AfterSaleNameID = int.Parse(row["F_AfterSaleNameID"].ToString());
  786. }
  787. if (row["F_CustomerNatureID"] != null && row["F_CustomerNatureID"].ToString() != "")
  788. {
  789. model.F_CustomerNatureID = int.Parse(row["F_CustomerNatureID"].ToString());
  790. }
  791. if (row["F_CustomerClassID"] != null && row["F_CustomerClassID"].ToString() != "")
  792. {
  793. model.F_CustomerClassID = int.Parse(row["F_CustomerClassID"].ToString());
  794. }
  795. if (row["F_RelationShipClassID"] != null && row["F_RelationShipClassID"].ToString() != "")
  796. {
  797. model.F_RelationShipClassID = int.Parse(row["F_RelationShipClassID"].ToString());
  798. }
  799. if (row["F_CityID"] != null && row["F_CityID"].ToString() != "")
  800. {
  801. model.F_CityID = int.Parse(row["F_CityID"].ToString());
  802. }
  803. }
  804. return model;
  805. }
  806. /// <summary>
  807. /// 获得数据列表
  808. /// </summary>
  809. public DataSet GetList(string strWhere)
  810. {
  811. StringBuilder strSql = new StringBuilder();
  812. 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 ");
  813. strSql.Append(" FROM T_Cus_CustomerBase ");
  814. if (strWhere.Trim() != "")
  815. {
  816. strSql.Append(" where " + strWhere);
  817. }
  818. return DbHelperSQL.Query(strSql.ToString());
  819. }
  820. /// <summary>
  821. /// 获得前几行数据
  822. /// </summary>
  823. public DataSet GetList(int Top, string strWhere, string filedOrder)
  824. {
  825. StringBuilder strSql = new StringBuilder();
  826. strSql.Append("select ");
  827. if (Top > 0)
  828. {
  829. strSql.Append(" top " + Top.ToString());
  830. }
  831. 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 ");
  832. strSql.Append(" FROM T_Cus_CustomerBase ");
  833. if (strWhere.Trim() != "")
  834. {
  835. strSql.Append(" where " + strWhere);
  836. }
  837. strSql.Append(" order by " + filedOrder);
  838. return DbHelperSQL.Query(strSql.ToString());
  839. }
  840. /// <summary>
  841. /// 获取记录总数
  842. /// </summary>
  843. public int GetRecordCount(string strWhere)
  844. {
  845. StringBuilder strSql = new StringBuilder();
  846. strSql.Append("select count(1) FROM T_Cus_CustomerBase ");
  847. if (strWhere.Trim() != "")
  848. {
  849. strSql.Append(" where " + strWhere);
  850. }
  851. object obj = DbHelperSQL.GetSingle(strSql.ToString());
  852. if (obj == null)
  853. {
  854. return 0;
  855. }
  856. else
  857. {
  858. return Convert.ToInt32(obj);
  859. }
  860. }
  861. /// <summary>
  862. /// 分页获取数据列表
  863. /// </summary>
  864. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  865. {
  866. StringBuilder strSql = new StringBuilder();
  867. strSql.Append("SELECT * FROM ( ");
  868. strSql.Append(" SELECT ROW_NUMBER() OVER (");
  869. if (!string.IsNullOrEmpty(orderby.Trim()))
  870. {
  871. strSql.Append("order by T." + orderby);
  872. }
  873. else
  874. {
  875. strSql.Append("order by T.F_CustomerId desc");
  876. }
  877. strSql.Append(")AS Row, T.* from T_Cus_CustomerBase T ");
  878. if (!string.IsNullOrEmpty(strWhere.Trim()))
  879. {
  880. strSql.Append(" WHERE " + strWhere);
  881. }
  882. strSql.Append(" ) TT");
  883. strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
  884. return DbHelperSQL.Query(strSql.ToString());
  885. }
  886. /*
  887. /// <summary>
  888. /// 分页获取数据列表
  889. /// </summary>
  890. public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  891. {
  892. SqlParameter[] parameters = {
  893. new SqlParameter("@tblName", SqlDbType.VarChar, 255),
  894. new SqlParameter("@fldName", SqlDbType.VarChar, 255),
  895. new SqlParameter("@PageSize", SqlDbType.Int),
  896. new SqlParameter("@PageIndex", SqlDbType.Int),
  897. new SqlParameter("@IsReCount", SqlDbType.Bit),
  898. new SqlParameter("@OrderType", SqlDbType.Bit),
  899. new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
  900. };
  901. parameters[0].Value = "T_Cus_CustomerBase";
  902. parameters[1].Value = "F_CustomerId";
  903. parameters[2].Value = PageSize;
  904. parameters[3].Value = PageIndex;
  905. parameters[4].Value = 0;
  906. parameters[5].Value = 0;
  907. parameters[6].Value = strWhere;
  908. return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
  909. }*/
  910. #endregion BasicMethod
  911. #region 获取客户信息通过电话号码
  912. /// <summary>
  913. /// 获取客户信息通过电话号码
  914. /// </summary>
  915. /// <param name="pnoneNumber">电话号码</param>
  916. /// <returns></returns>
  917. public YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase GetCusInfoModel(string pnoneNumber)
  918. {
  919. StringBuilder strSql = new StringBuilder();
  920. strSql.Append("select top 1 * from T_Cus_CustomerBase ");
  921. strSql.Append(" where F_Telephone = '" + pnoneNumber + "' order by F_CustomerId desc ");
  922. YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model = new YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase();
  923. DataSet ds = DbHelperSQL.Query(strSql.ToString());
  924. if (ds.Tables[0].Rows.Count > 0)
  925. {
  926. return DataRowToModel(ds.Tables[0].Rows[0]);
  927. }
  928. else
  929. {
  930. return model;
  931. }
  932. }
  933. /// <summary>
  934. /// 获取客户信息通过微信号/微博号
  935. /// </summary>
  936. /// <param name="types">1、微信号/2、微博号</param>
  937. /// <param name="pnoneNumber">微信号/微博号</param>
  938. /// <returns></returns>
  939. public YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase GetCusInfoModel(int types, string pnoneNumber)
  940. {
  941. StringBuilder strSql = new StringBuilder();
  942. if (types == 1)//微信
  943. {
  944. strSql.Append("select top 1 * from T_Cus_CustomerBase ");
  945. strSql.Append(" where F_CustomerEName=@F_CustomerEName order by F_CustomerId desc ");
  946. SqlParameter[] parameters = {
  947. new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar ,50)
  948. };
  949. parameters[0].Value = pnoneNumber;
  950. YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model = new YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase();
  951. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  952. if (ds.Tables[0].Rows.Count > 0)
  953. {
  954. return DataRowToModel(ds.Tables[0].Rows[0]);
  955. }
  956. else
  957. {
  958. return model;
  959. }
  960. }
  961. else if (types == 2)//微博
  962. {
  963. strSql.Append("select top 1 * from T_Cus_CustomerBase ");
  964. strSql.Append(" where F_PostCode=@F_PostCode order by F_CustomerId desc ");
  965. SqlParameter[] parameters = {
  966. new SqlParameter("@F_PostCode", SqlDbType.NVarChar ,50)
  967. };
  968. parameters[0].Value = pnoneNumber;
  969. YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model = new YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase();
  970. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  971. if (ds.Tables[0].Rows.Count > 0)
  972. {
  973. return DataRowToModel(ds.Tables[0].Rows[0]);
  974. }
  975. else
  976. {
  977. return model;
  978. }
  979. }
  980. else
  981. {
  982. return new Model.T_Cus_CustomerBase();
  983. }
  984. }
  985. #endregion ExtensionMethod
  986. #region 编辑用户信息
  987. /// <summary>
  988. /// 获取客户信息通过电话号码
  989. /// </summary>
  990. /// <param name="pnoneNumber">电话号码</param>
  991. /// <returns></returns>
  992. public bool UpdateCusInfoModel(YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model)
  993. {
  994. StringBuilder strSql = new StringBuilder();
  995. if (model.F_CustomerId > 0)
  996. {
  997. strSql.Append("update T_Cus_CustomerBase set ");
  998. strSql.Append("F_CustomerName=@F_CustomerName,");
  999. strSql.Append("F_CustomerPym=@F_CustomerPym,");
  1000. strSql.Append("F_CustomerEName=@F_CustomerEName,");
  1001. strSql.Append("F_PostCode=@F_PostCode,");
  1002. strSql.Append("F_CustomerLayer=@F_CustomerLayer,");
  1003. strSql.Append("F_CustomerCode=@F_CustomerCode,");
  1004. strSql.Append("F_Telephone=@F_Telephone,");
  1005. strSql.Append("F_Kind=@F_Kind,");
  1006. strSql.Append("F_CustomerNature=@F_CustomerNature,");
  1007. strSql.Append("F_ScaleResume=@F_ScaleResume,");
  1008. strSql.Append("F_CustomerClass=@F_CustomerClass,");
  1009. strSql.Append("F_ModifyBy=@F_ModifyBy,");
  1010. strSql.Append("F_ModifiedOn=getdate()");
  1011. strSql.Append(" where F_CustomerId=@F_CustomerId");
  1012. SqlParameter[] parameters = {
  1013. new SqlParameter("@F_CustomerName", model.F_CustomerName),
  1014. new SqlParameter("@F_CustomerPym", model.F_CustomerPym),
  1015. new SqlParameter("@F_CustomerEName", model.F_CustomerEName),
  1016. new SqlParameter("@F_PostCode", model.F_PostCode),
  1017. new SqlParameter("@F_CustomerLayer", model.F_CustomerLayer),
  1018. new SqlParameter("@F_CustomerCode", model.F_CustomerCode),
  1019. new SqlParameter("@F_Telephone", model.F_Telephone),
  1020. new SqlParameter("@F_Kind", model.F_Kind),
  1021. new SqlParameter("@F_CustomerNature", model.F_CustomerNature),
  1022. new SqlParameter("@F_ScaleResume", model.F_ScaleResume),
  1023. new SqlParameter("@F_CustomerClass",model.F_CustomerClass),
  1024. new SqlParameter("@F_ModifyBy",model.F_ModifyBy),
  1025. new SqlParameter("@F_CustomerId", model.F_CustomerId)};
  1026. //parameters[0].Value = model.F_CustomerName;
  1027. //parameters[1].Value = model.F_CustomerPym;
  1028. //parameters[2].Value = model.F_CustomerEName;
  1029. //parameters[3].Value = model.F_PostCode;
  1030. //parameters[4].Value = model.F_CustomerLayer;
  1031. //parameters[5].Value = model.F_CustomerCode;
  1032. //parameters[6].Value = model.F_Telephone;
  1033. //parameters[7].Value = model.F_Kind;
  1034. //parameters[8].Value = model.F_CustomerNature;
  1035. //parameters[9].Value = model.F_ScaleResume;
  1036. //parameters[10].Value = model.F_CustomerClass;
  1037. //parameters[11].Value = model.F_ModifyBy;
  1038. //parameters[12].Value = model.F_CustomerId;
  1039. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  1040. if (rows > 0)
  1041. {
  1042. return true;
  1043. }
  1044. else
  1045. {
  1046. return false;
  1047. }
  1048. }
  1049. else
  1050. {
  1051. strSql.Append("insert into T_Cus_CustomerBase(");
  1052. strSql.Append("F_CustomerName,F_CustomerPym,F_CustomerEName,F_PostCode,F_CustomerLayer,F_CustomerCode,F_Telephone,F_Kind,F_CustomerNature,F_ScaleResume,F_CustomerClass,F_CreateBy,F_CreatedOn,F_ModifiedOn)");
  1053. strSql.Append(" values (@F_CustomerName,@F_CustomerPym,@F_CustomerEName,@F_PostCode,@F_CustomerLayer,@F_CustomerCode,@F_Telephone,@F_Kind,@F_CustomerNature,@F_ScaleResume,@F_CustomerClass,@F_CreateBy,getdate(),getdate())");
  1054. SqlParameter[] parameters = {
  1055. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
  1056. new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,200),
  1057. new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,200),
  1058. new SqlParameter("@F_PostCode", SqlDbType.NVarChar,200),
  1059. new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,200),
  1060. new SqlParameter("@F_CustomerCode", SqlDbType.NVarChar,200),
  1061. new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
  1062. new SqlParameter("@F_Kind", SqlDbType.Int,4),
  1063. new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,200),
  1064. new SqlParameter("@F_ScaleResume", SqlDbType.Int,4),
  1065. new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,200),
  1066. new SqlParameter("@F_CreateBy", SqlDbType.Int,4) };
  1067. parameters[0].Value = model.F_CustomerName;
  1068. parameters[1].Value = model.F_CustomerPym;
  1069. parameters[2].Value = model.F_CustomerEName;
  1070. parameters[3].Value = model.F_PostCode;
  1071. parameters[4].Value = model.F_CustomerLayer;
  1072. parameters[5].Value = model.F_CustomerCode;
  1073. parameters[6].Value = model.F_Telephone;
  1074. parameters[7].Value = model.F_Kind;
  1075. parameters[8].Value = model.F_CustomerNature;
  1076. parameters[9].Value = model.F_ScaleResume;
  1077. parameters[10].Value = model.F_CustomerClass;
  1078. parameters[11].Value = model.F_CreateBy;
  1079. int obj = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  1080. if (obj > 0)
  1081. {
  1082. return true;
  1083. }
  1084. else
  1085. {
  1086. return false;
  1087. }
  1088. }
  1089. }
  1090. /// <summary>
  1091. /// 包含工单信息的客户信息
  1092. /// </summary>
  1093. /// <param name="pnoneNumber">电话号码</param>
  1094. /// <returns></returns>
  1095. public int EditCusInfoModel(YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase model)
  1096. {
  1097. StringBuilder strSql = new StringBuilder();
  1098. if (model.F_CustomerId > 1)
  1099. {
  1100. strSql.Append("update T_Cus_CustomerBase set ");
  1101. strSql.Append("F_CustomerName=@F_CustomerName,");
  1102. strSql.Append("F_CustomerPym=@F_CustomerPym,");
  1103. strSql.Append("F_CustomerCode=@F_CustomerCode,");
  1104. strSql.Append("F_Kind=@F_Kind,");
  1105. strSql.Append("F_CustomerNature=@F_CustomerNature,");
  1106. //strSql.Append("F_ScaleResume=@F_ScaleResume,");//客户等级
  1107. //strSql.Append("F_CustomerClass=@F_CustomerClass,");
  1108. strSql.Append("F_DeviceCount=@F_DeviceCount,");
  1109. strSql.Append("F_Fax=@F_Fax,");
  1110. strSql.Append("F_AfterSaleNameID=@F_AfterSaleNameID,");
  1111. strSql.Append("F_Email=@F_Email,");
  1112. strSql.Append("F_IndustryId=@F_IndustryId,");
  1113. strSql.Append("F_Url=@F_Url,");
  1114. strSql.Append("F_ModifyBy=@F_ModifyBy,");
  1115. strSql.Append("F_Mobile=@F_Mobile,");
  1116. strSql.Append("F_ModifiedOn=getdate()");
  1117. strSql.Append(" where F_CustomerId=@F_CustomerId");
  1118. SqlParameter[] parameters = {
  1119. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
  1120. new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,200),
  1121. new SqlParameter("@F_CustomerCode", SqlDbType.NVarChar,200),
  1122. new SqlParameter("@F_Kind", SqlDbType.Int,4),
  1123. new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,200),
  1124. //new SqlParameter("@F_ScaleResume", SqlDbType.Int,4),
  1125. //new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,200),
  1126. new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
  1127. new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
  1128. new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
  1129. new SqlParameter("@F_Email", SqlDbType.NVarChar,200),
  1130. new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
  1131. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  1132. new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
  1133. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
  1134. new SqlParameter("@F_CustomerId", SqlDbType.Int,4)};
  1135. parameters[0].Value = model.F_CustomerName;
  1136. parameters[1].Value = model.F_CustomerPym;
  1137. parameters[2].Value = model.F_CustomerCode;
  1138. parameters[3].Value = model.F_Kind;
  1139. parameters[4].Value = model.F_CustomerNature;
  1140. //parameters[5].Value = model.F_ScaleResume;
  1141. //parameters[6].Value = model.F_CustomerClass;
  1142. parameters[5].Value = model.F_DeviceCount;
  1143. parameters[6].Value = model.F_Fax;
  1144. parameters[7].Value = model.F_AfterSaleNameID;
  1145. parameters[8].Value = model.F_Email;
  1146. parameters[9].Value = model.F_IndustryId;
  1147. parameters[10].Value = model.F_Url;
  1148. parameters[11].Value = model.F_ModifyBy;
  1149. parameters[12].Value = model.F_Mobile;
  1150. parameters[13].Value = model.F_CustomerId;
  1151. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  1152. if (rows > 0)
  1153. {
  1154. return model.F_CustomerId;
  1155. }
  1156. else
  1157. {
  1158. return 0;
  1159. }
  1160. }
  1161. else
  1162. {
  1163. strSql.Append("insert into T_Cus_CustomerBase(");
  1164. strSql.Append("F_CustomerName,F_CustomerPym,F_CustomerEName,F_PostCode,F_CustomerLayer,F_CustomerCode,F_Telephone,F_Kind,F_CustomerNature,F_ScaleResume,F_CustomerClass,F_DeviceCount,F_Fax,F_AfterSaleNameID,F_Email,F_IndustryId,F_Url,F_Mobile,F_CreateBy,F_CreatedOn,F_ModifiedOn)");
  1165. strSql.Append(" values (@F_CustomerName,@F_CustomerPym,@F_CustomerEName,@F_PostCode,@F_CustomerLayer,@F_CustomerCode,@F_Telephone,@F_Kind,@F_CustomerNature,@F_ScaleResume,@F_CustomerClass,@F_DeviceCount,@F_Fax,@F_AfterSaleNameID,@F_Email,@F_IndustryId,@F_Url,@F_Mobile,@F_CreateBy,getdate(),getdate())");
  1166. strSql.Append(";select @@IDENTITY");
  1167. SqlParameter[] parameters = {
  1168. new SqlParameter("@F_CustomerName", SqlDbType.NVarChar,200),
  1169. new SqlParameter("@F_CustomerPym", SqlDbType.NVarChar,200),
  1170. new SqlParameter("@F_CustomerEName", SqlDbType.NVarChar,200),
  1171. new SqlParameter("@F_PostCode", SqlDbType.NVarChar,200),
  1172. new SqlParameter("@F_CustomerLayer", SqlDbType.NVarChar,200),
  1173. new SqlParameter("@F_CustomerCode", SqlDbType.NVarChar,200),
  1174. new SqlParameter("@F_Telephone", SqlDbType.NVarChar,200),
  1175. new SqlParameter("@F_Kind", SqlDbType.Int,4),
  1176. new SqlParameter("@F_CustomerNature", SqlDbType.NVarChar,200),
  1177. new SqlParameter("@F_ScaleResume", SqlDbType.Int,4),
  1178. new SqlParameter("@F_CustomerClass", SqlDbType.NVarChar,200),
  1179. new SqlParameter("@F_DeviceCount", SqlDbType.Int,4),
  1180. new SqlParameter("@F_Fax", SqlDbType.NVarChar,200),
  1181. new SqlParameter("@F_AfterSaleNameID", SqlDbType.Int,4),
  1182. new SqlParameter("@F_Email", SqlDbType.NVarChar,200),
  1183. new SqlParameter("@F_IndustryId", SqlDbType.Int,4),
  1184. new SqlParameter("@F_Url", SqlDbType.NVarChar,200),
  1185. new SqlParameter("@F_Mobile", SqlDbType.NVarChar,200),
  1186. new SqlParameter("@F_CreateBy", SqlDbType.Int,4) };
  1187. parameters[0].Value = model.F_CustomerName;
  1188. parameters[1].Value = model.F_CustomerPym;
  1189. parameters[2].Value = model.F_CustomerEName;
  1190. parameters[3].Value = model.F_PostCode;
  1191. parameters[4].Value = model.F_CustomerLayer;
  1192. parameters[5].Value = model.F_CustomerCode;
  1193. parameters[6].Value = model.F_Telephone;
  1194. parameters[7].Value = model.F_Kind;
  1195. parameters[8].Value = model.F_CustomerNature;
  1196. parameters[9].Value = model.F_ScaleResume;
  1197. parameters[10].Value = model.F_CustomerClass;
  1198. parameters[11].Value = model.F_DeviceCount;
  1199. parameters[12].Value = model.F_Fax;
  1200. parameters[13].Value = model.F_AfterSaleNameID;
  1201. parameters[14].Value = model.F_Email;
  1202. parameters[15].Value = model.F_IndustryId;
  1203. parameters[16].Value = model.F_Url;
  1204. parameters[17].Value = model.F_Mobile;
  1205. parameters[18].Value = model.F_CreateBy;
  1206. object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
  1207. if (obj == null)
  1208. {
  1209. return 0;
  1210. }
  1211. else
  1212. {
  1213. return Convert.ToInt32(obj);
  1214. }
  1215. }
  1216. }
  1217. #endregion ExtensionMethod
  1218. #region 编辑用户状态
  1219. /// <summary>
  1220. /// 获取客户信息通过电话号码
  1221. /// </summary>
  1222. /// <param name="pnoneNumber">电话号码</param>
  1223. /// <returns></returns>
  1224. public bool EditCustonStatus(string fidStr, int status)
  1225. {
  1226. bool result = false;
  1227. StringBuilder strSql = new StringBuilder();
  1228. if (!string.IsNullOrEmpty(fidStr) && status > 0)
  1229. {
  1230. string statusName = "一般客户";
  1231. if (status == 1)
  1232. {
  1233. statusName = "一般客户";
  1234. #region 取消黑名单
  1235. try
  1236. {
  1237. string arrid = "";
  1238. foreach (string cid in fidStr.Split(','))
  1239. {
  1240. arrid += "'" + cid.Trim() + "',";
  1241. }
  1242. arrid += "!@#";
  1243. arrid = arrid.Replace(",!@#", "").Replace("!@#", "");
  1244. int c = DbHelperSQL.ExecuteSql("UPDATE [T_Call_Blacklist] SET [F_IsDelete] = 1 WHERE [F_CallId] in(" + arrid + ")");
  1245. }
  1246. catch
  1247. {
  1248. }
  1249. #endregion
  1250. }
  1251. else if (status == 2)
  1252. {
  1253. statusName = "特别关注";
  1254. #region 取消黑名单
  1255. try
  1256. {
  1257. string arrid = "";
  1258. foreach (string cid in fidStr.Split(','))
  1259. {
  1260. arrid += "'" + cid.Trim() + "',";
  1261. }
  1262. arrid += "!@#";
  1263. arrid = arrid.Replace(",!@#", "").Replace("!@#", "");
  1264. int c = DbHelperSQL.ExecuteSql("UPDATE [T_Call_Blacklist] SET [F_IsDelete] = 1 WHERE [F_CallId] in(" + arrid + ")");
  1265. }
  1266. catch
  1267. {
  1268. }
  1269. #endregion
  1270. }
  1271. else if (status == 3)
  1272. {
  1273. statusName = "黑名单";
  1274. #region 添加到黑名单表
  1275. DataTable dt = new DataTable();
  1276. try
  1277. {
  1278. dt = GetList(" F_CustomerId in (" + fidStr + ") ").Tables[0];
  1279. foreach (DataRow dr in dt.Rows)
  1280. {
  1281. try
  1282. {
  1283. string phone = dr["F_Telephone"].ToString();
  1284. if (phone == "" || phone == "null")
  1285. {
  1286. phone = dr["F_Mobile"].ToString();
  1287. }
  1288. if (phone != "")
  1289. {
  1290. #region 判断是否为白名单
  1291. if (GetRecordCount(string.Format(" F_CustomerClass='白名单' and (F_Telephone='{0}' or F_Mobile='{0}')", phone)) > 0)
  1292. {
  1293. //白名单不能加入黑名单 客户没有要求,先注释
  1294. //continue;
  1295. }
  1296. #endregion
  1297. Model.T_Call_Blacklist orderModel = new Model.T_Call_Blacklist();
  1298. orderModel.F_TelPhone = phone;
  1299. orderModel.F_CallId = dr["F_CustomerId"].ToString().Trim();
  1300. orderModel.F_SetTime = DateTime.Now;
  1301. orderModel.F_RemoveTime = DateTime.Now.AddYears(10);
  1302. orderModel.F_Describe = "客户id:" + dr["F_CustomerId"].ToString();
  1303. orderModel.F_InterceptNum = 0;
  1304. int count = new T_Call_Blacklist().Add(orderModel);
  1305. }
  1306. }
  1307. catch
  1308. { }
  1309. }
  1310. }
  1311. catch
  1312. {
  1313. }
  1314. finally
  1315. {
  1316. dt.Clear();
  1317. dt.Dispose();
  1318. }
  1319. #endregion
  1320. }
  1321. else if (status == 4)
  1322. {
  1323. statusName = "白名单";
  1324. #region 取消黑名单
  1325. try
  1326. {
  1327. string arrid = "";
  1328. foreach (string cid in fidStr.Split(','))
  1329. {
  1330. arrid += "'" + cid.Trim() + "',";
  1331. }
  1332. arrid += "!@#";
  1333. arrid = arrid.Replace(",!@#", "").Replace("!@#", "");
  1334. int c = DbHelperSQL.ExecuteSql("UPDATE [T_Call_Blacklist] SET [F_IsDelete] = 1 WHERE [F_CallId] in(" + arrid + ")");
  1335. }
  1336. catch
  1337. {
  1338. }
  1339. #endregion
  1340. }
  1341. strSql.Append("update T_Cus_CustomerBase set ");
  1342. strSql.Append("F_ScaleResume=" + status + ",");
  1343. strSql.Append("F_CustomerClass='" + statusName + "'");
  1344. strSql.Append(" where F_CustomerId in (" + fidStr + ")");
  1345. return DbHelperSQL.ExecuteSql(strSql.ToString()) > 0;
  1346. }
  1347. return result;
  1348. }
  1349. #endregion
  1350. }
  1351. }