CM.cs
上传用户:xuming1973
上传日期:2014-02-27
资源大小:17511k
文件大小:52k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using System.Collections;
  5. namespace UDS.Components
  6. {
  7. /// <summary>
  8. /// CM 的摘要说明。
  9. /// </summary>
  10. public class CM
  11. {
  12. public CM(){}
  13. #region 添加客户
  14. /// <summary>
  15. /// 添加客户
  16. /// </summary>
  17. /// <param name="client"></param>
  18. /// <returns>返回客户id</returns>
  19. public int AddClinet(ClientInfo client)
  20. {
  21. Database data = new Database();
  22. SqlParameter[] prams = {
  23.     data.MakeInParam("@birthday",  SqlDbType.DateTime, 8, client.Birthday),
  24.     data.MakeInParam("@chieflinkmanid", SqlDbType.Int, 4, client.ChiefLinkmanID),
  25.     data.MakeInParam("@UpdateTime", SqlDbType.DateTime, 8, DateTime.Now),
  26.     data.MakeInParam("@AddmanID",SqlDbType.Int,4,client.AddManID),
  27.     data.MakeInParam("@ShortName",SqlDbType.VarChar,100,client.ClientShortName),
  28.     data.MakeInParam("@Name",SqlDbType.VarChar,100,client.ClientName),
  29.     data.MakeInParam("@ContactTimes",SqlDbType.Int,4,client.ContactTimes),
  30. data.MakeInParam("@SellPhase",SqlDbType.VarChar,100,client.SellPhase),
  31. data.MakeInParam("@BargainPrognosis",SqlDbType.VarChar,100,client.BargainPrognosis),
  32. data.MakeInParam("@Fee",SqlDbType.Int,4,client.Fee),
  33. data.MakeInParam("@Linkman_Telephone",SqlDbType.VarChar,100,client.Linkman_Telephone),
  34. data.MakeInParam("@CurStatus",SqlDbType.VarChar,100,client.CurStatus),
  35. data.MakeInParam("@Type",SqlDbType.VarChar,100,client.Type),
  36. data.MakeInParam("@Affiliatedarea",SqlDbType.VarChar,100,client.Affiliatedarea),
  37. data.MakeInParam("@URL",SqlDbType.VarChar,100,client.URL),
  38. data.MakeInParam("@ZIP",SqlDbType.VarChar,100,client.ZIP),
  39. data.MakeInParam("@Address",SqlDbType.VarChar,200,client.Address),
  40. data.MakeInParam("@CompanyProperty",SqlDbType.VarChar,100,client.EnterpriseType),
  41. data.MakeInParam("@Calling",SqlDbType.VarChar,2000,client.Calling),
  42. data.MakeInParam("@CompanySize",SqlDbType.VarChar,100,client.CompanySize),
  43. data.MakeInParam("@Money",SqlDbType.VarChar,100,client.Money),
  44. data.MakeInParam("@Operation",SqlDbType.VarChar,100,client.Operation),
  45. data.MakeInParam("@Introduce",SqlDbType.VarChar,1000,client.Introduce),
  46. data.MakeInParam("@ITGrade",SqlDbType.VarChar,1000,client.ITGrade),
  47. data.MakeInParam("@PCNumber",SqlDbType.Int,4,client.PCNumber),
  48. data.MakeInParam("@Net",SqlDbType.VarChar,100,client.Net),
  49. data.MakeInParam("@ITStaffs",SqlDbType.Int,4,client.ITStaffs),
  50. data.MakeInParam("@ITDepartment",SqlDbType.VarChar,100,client.ITDepartment),
  51. data.MakeInParam("@Principal",SqlDbType.VarChar,100,client.Principal),
  52. data.MakeInParam("@System",SqlDbType.VarChar,100,client.System),
  53. data.MakeInParam("@Customer",SqlDbType.VarChar,100,client.ClientSource),
  54. data.MakeInParam("@ClientInitiative",SqlDbType.VarChar,100,client.ClientInitiative)
  55. };
  56. return(data.RunProc ("sp_CM_AddClient",prams));
  57. }
  58. #endregion 
  59. #region 修改客户
  60. /// <summary>
  61. /// 修改客户
  62. /// </summary>
  63. /// <param name="client"></param>
  64. public void UpdateClient(ClientInfo client)
  65. {
  66. Database data = new Database();
  67. SqlParameter[] prams = {
  68.    data.MakeInParam("@ID",SqlDbType.Int,4,client.ID),
  69.    data.MakeInParam("@birthday",  SqlDbType.DateTime, 8, client.Birthday),
  70.    data.MakeInParam("@chieflinkmanid", SqlDbType.Int, 4, client.ChiefLinkmanID),
  71.    data.MakeInParam("@UpdateTime", SqlDbType.DateTime, 8, DateTime.Now),
  72.    data.MakeInParam("@AddmanID",SqlDbType.Int,4,client.AddManID),
  73.    data.MakeInParam("@ShortName",SqlDbType.VarChar,100,client.ClientShortName),
  74.    data.MakeInParam("@Name",SqlDbType.VarChar,100,client.ClientName),
  75.    data.MakeInParam("@ContactTimes",SqlDbType.Int,4,client.ContactTimes),
  76.    data.MakeInParam("@SellPhase",SqlDbType.VarChar,100,client.SellPhase),
  77.    data.MakeInParam("@BargainPrognosis",SqlDbType.VarChar,100,client.BargainPrognosis),
  78.    data.MakeInParam("@Fee",SqlDbType.Int,4,client.Fee),
  79.    data.MakeInParam("@Linkman_Telephone",SqlDbType.VarChar,100,client.Linkman_Telephone),
  80.    data.MakeInParam("@CurStatus",SqlDbType.VarChar,100,client.CurStatus),
  81.    data.MakeInParam("@Type",SqlDbType.VarChar,100,client.Type),
  82.    data.MakeInParam("@Affiliatedarea",SqlDbType.VarChar,100,client.Affiliatedarea),
  83.    data.MakeInParam("@URL",SqlDbType.VarChar,100,client.URL),
  84.    data.MakeInParam("@ZIP",SqlDbType.VarChar,100,client.ZIP),
  85.    data.MakeInParam("@Address",SqlDbType.VarChar,200,client.Address),
  86.    data.MakeInParam("@CompanyProperty",SqlDbType.VarChar,100,client.EnterpriseType),
  87.    data.MakeInParam("@Calling",SqlDbType.VarChar,2000,client.Calling),
  88.    data.MakeInParam("@CompanySize",SqlDbType.VarChar,100,client.CompanySize),
  89.    data.MakeInParam("@Money",SqlDbType.VarChar,100,client.Money),
  90.    data.MakeInParam("@Operation",SqlDbType.VarChar,100,client.Operation),
  91.    data.MakeInParam("@Introduce",SqlDbType.VarChar,1000,client.Introduce),
  92.    data.MakeInParam("@ITGrade",SqlDbType.VarChar,1000,client.ITGrade),
  93.    data.MakeInParam("@PCNumber",SqlDbType.Int,4,client.PCNumber),
  94.    data.MakeInParam("@Net",SqlDbType.VarChar,100,client.Net),
  95.    data.MakeInParam("@ITStaffs",SqlDbType.Int,4,client.ITStaffs),
  96.    data.MakeInParam("@ITDepartment",SqlDbType.VarChar,100,client.ITDepartment),
  97.    data.MakeInParam("@Principal",SqlDbType.VarChar,100,client.Principal),
  98.    data.MakeInParam("@System",SqlDbType.VarChar,100,client.System),
  99.    data.MakeInParam("@Customer",SqlDbType.VarChar,100,client.ClientSource),
  100.    data.MakeInParam("@ClientInitiative",SqlDbType.VarChar,100,client.ClientInitiative),
  101.    data.MakeInParam("@FirstContactTime",SqlDbType.DateTime,8,client.FirstContactTime),
  102.    data.MakeInParam("@NextContactTime",SqlDbType.DateTime,8,client.NextContactTime),
  103.    data.MakeInParam("@ContactTime",SqlDbType.DateTime,8,client.ContactTime)
  104. };
  105. data.RunProc ("sp_CM_UpdateClient",prams);
  106. }
  107. #endregion
  108. #region 删除客户
  109. /// <summary>
  110. /// 删除客户
  111. /// </summary>
  112. /// <param name="id">客户id</param>
  113. public void DelClient(int id)
  114. {
  115. Database data = new Database();
  116. SqlParameter[] prams = {
  117. data.MakeInParam("@clientid",SqlDbType.Int,4,id)
  118.    };
  119. data.RunProc("sp_CM_DelClient",prams);
  120. }
  121. #endregion
  122. #region 得到所有客户
  123. public SqlDataReader GetAllClient()
  124. {
  125. Database data = new Database();
  126. SqlDataReader dr = null;
  127. data.RunProc ("sp_CM_GetAllClient",out dr);
  128. return(dr);
  129. }
  130. #endregion
  131. #region 根据客户id得到联络人
  132. public SqlDataReader GetLinkmanFromClient(int clientid)
  133. {
  134. Database data = new Database();
  135. SqlDataReader dr = null;
  136. SqlParameter[] prams = {
  137.    data.MakeInParam("@clientid",  SqlDbType.Int, 4, clientid)
  138. };
  139. data.RunProc ("sp_CM_GetAllLinkmanFromClient",prams,out dr);
  140. return(dr);
  141. }
  142. #endregion
  143. #region 根据客户名称得到客户id
  144. public SqlDataReader GetClientIDByName(string clientname)
  145. {
  146. Database data = new Database();
  147. SqlDataReader dr = null;
  148. SqlParameter[] prams = {
  149.    data.MakeInParam("@name",  SqlDbType.VarChar, 100, clientname)
  150.    };
  151. data.RunProc ("sp_CM_GetClientIDByName",prams,out dr);
  152. return(dr);
  153. }
  154. #endregion
  155. #region 根据客户name得到客户信息
  156. public SqlDataReader GetClientInfoByName(string clientname)
  157. {
  158. Database data = new Database();
  159. SqlDataReader dr = null;
  160. SqlParameter[] prams = {
  161.    data.MakeInParam("@clientname",  SqlDbType.VarChar, 100, clientname)
  162.    };
  163. data.RunProc ("sp_CM_GetClientInfoByName",prams,out dr);
  164. return(dr);
  165. }
  166. #endregion
  167. #region 根据客户id得到客户信息(客户id=0得到全部客户)
  168. public SqlDataReader GetClientInfo(int clientid)
  169. {
  170. Database data = new Database();
  171. SqlDataReader dr = null;
  172. SqlParameter[] prams = {
  173.    data.MakeInParam("@clientid",  SqlDbType.Int, 4, clientid)
  174.    };
  175. data.RunProc ("sp_CM_GetClientInfo",prams,out dr);
  176. return(dr);
  177. }
  178. public ClientInfo GetClientAllInfo(int clientid)
  179. {
  180. ClientInfo client = new ClientInfo();
  181. Database data = new Database();
  182. SqlDataReader dr = null;
  183. SqlParameter[] prams = {
  184.    data.MakeInParam("@clientid",  SqlDbType.Int, 4, clientid)
  185.    };
  186. data.RunProc ("sp_CM_GetClientAllInfo",prams,out dr);
  187. while(dr.Read())
  188. {
  189. client.ID = Int32.Parse(dr["id"].ToString());
  190. client.ClientName = dr["Name"].ToString();
  191. client.ClientShortName = dr["ShortName"].ToString();
  192. client.ChiefLinkmanID = Int32.Parse(dr["ChiefLinkmanID"].ToString());
  193. client.Birthday = DateTime.Parse(dr["Birthday"].ToString());
  194. client.UpdateTime = DateTime.Parse(dr["UpdateTime"].ToString());
  195. client.ContactTimes = Int32.Parse(dr["ContactTimes"].ToString());
  196. client.SellPhase = dr["SellPhase"].ToString();
  197. client.BargainPrognosis = dr["BargainPrognosis"].ToString();
  198. client.Fee = Int32.Parse(dr["Fee"].ToString());
  199. client.AddManID = Int32.Parse(dr["AddManID"].ToString());
  200. client.Linkman_Telephone = dr["Linkman_Telephone"].ToString();
  201. client.CurStatus = dr["CurStatus"].ToString();
  202. client.Address = dr["address"].ToString();
  203. client.Affiliatedarea = dr["affiliatedarea"].ToString();
  204. client.Calling = dr["calling"].ToString();
  205. client.ClientInitiative = dr["ClientInitiative"].ToString();
  206. client.ClientSource = dr["customer"].ToString();
  207. client.ClientTrade = dr["calling"].ToString();
  208. client.ClientType = dr["type"].ToString();
  209. client.CompanyProperty = dr["companyproperty"].ToString();
  210. client.CompanySize = dr["companysize"].ToString();
  211. client.CurStatus = dr["curstatus"].ToString();
  212. client.Customer = dr["customer"].ToString();
  213. client.EnterpriseType = dr["CompanyProperty"].ToString();
  214. client.Introduce = dr["introduce"].ToString();
  215. client.ITDepartment = dr["itdepartment"].ToString();
  216. client.ITGrade = dr["itgrade"].ToString();
  217. client.ITStaffs = Int32.Parse(dr["itstaffs"].ToString());
  218. client.Linkman_Telephone = dr["Linkman_Telephone"].ToString();
  219. client.Money = dr["money"].ToString();
  220. client.Net = dr["Net"].ToString();
  221. client.Operation = dr["operation"].ToString();
  222. client.PCNumber = Int32.Parse(dr["pcnumber"].ToString());
  223. client.Principal = dr["principal"].ToString();
  224. client.SellPhase = dr["sellphase"].ToString();
  225. client.System = dr["system"].ToString();
  226. client.Type = dr["type"].ToString();
  227. client.URL = dr["URL"].ToString();
  228. client.ZIP = dr["ZIP"].ToString();
  229. if(dr["ContactTime"]!=DBNull.Value) 
  230. client.ContactTime = DateTime.Parse(dr["ContactTime"].ToString());
  231. else
  232. client.ContactTime = DateTime.Parse("1900-1-1");
  233. if(dr["firstcontacttime"]!=DBNull.Value) 
  234. client.FirstContactTime = DateTime.Parse(dr["firstcontacttime"].ToString());
  235. else
  236. client.FirstContactTime = DateTime.Parse("1900-1-1");
  237. if(dr["nextcontacttime"]!=DBNull.Value) 
  238. client.NextContactTime = DateTime.Parse(dr["nextcontacttime"].ToString());
  239. else
  240. client.NextContactTime = DateTime.Parse("1900-1-1");
  241. }
  242. return(client);
  243. }
  244. #endregion
  245. #region 根据协同人id得到客户信息
  246. public SqlDataReader GetClientInfoBycooperatorID(int cooperatorID)
  247. {
  248. Database data = new Database();
  249. SqlDataReader dr = null;
  250. SqlParameter[] prams = {
  251.    data.MakeInParam("@cooperatorID",  SqlDbType.Int, 4, cooperatorID)
  252.    };
  253. data.RunProc ("sp_CM_GetClientInfoByCooperatorID",prams,out dr);
  254. return(dr);
  255. }
  256. #endregion
  257. #region 添加联系人
  258. public int AddLinkman(Linkman linkman)
  259. {
  260. Database data = new Database();
  261. SqlParameter[] prams = {
  262.     data.MakeInParam("@ClientID",  SqlDbType.Int, 4, linkman.ClientID),
  263.     data.MakeInParam("@name", SqlDbType.VarChar, 50,linkman.Name),
  264.     data.MakeInParam("@mobile", SqlDbType.VarChar,50, linkman.Mobile),
  265.     data.MakeInParam("@telephone", SqlDbType.VarChar,50, linkman.Telephone),
  266. data.MakeInParam("@position", SqlDbType.VarChar,50, linkman.Position),
  267. data.MakeInParam("@email",SqlDbType.VarChar,50,linkman.Email),
  268. data.MakeInParam("@gender",SqlDbType.Bit,1,linkman.Gender),
  269. data.MakeInParam("@description",SqlDbType.VarChar,50,linkman.Description),
  270. data.MakeInParam("@address",SqlDbType.VarChar,100,linkman.Address),
  271. data.MakeInParam("@family",SqlDbType.VarChar,200,linkman.Family),
  272. };
  273. return(data.RunProc ("sp_CM_AddLinkman",prams));
  274. }
  275. #endregion
  276. #region 修改联系人
  277. public void UpdateLinkman(Linkman linkman)
  278. {
  279. Database data = new Database();
  280. SqlParameter[] prams = {
  281.    data.MakeInParam("@ID",  SqlDbType.Int, 4, linkman.ID),
  282.    data.MakeInParam("@ClientID",  SqlDbType.Int, 4, linkman.ClientID),
  283.    data.MakeInParam("@name", SqlDbType.VarChar, 50,linkman.Name),
  284.    data.MakeInParam("@mobile", SqlDbType.VarChar,50, linkman.Mobile),
  285.    data.MakeInParam("@telephone", SqlDbType.VarChar,50, linkman.Telephone),
  286.    data.MakeInParam("@position", SqlDbType.VarChar,50, linkman.Position),
  287.    data.MakeInParam("@email",SqlDbType.VarChar,50,linkman.Email),
  288.    data.MakeInParam("@gender",SqlDbType.Bit,1,linkman.Gender),
  289.    data.MakeInParam("@description",SqlDbType.VarChar,50,linkman.Description),
  290.    data.MakeInParam("@address",SqlDbType.VarChar,100,linkman.Address),
  291.    data.MakeInParam("@family",SqlDbType.VarChar,200,linkman.Family),
  292. };
  293. data.RunProc ("sp_CM_UpdateLinkman",prams);
  294. }
  295. #endregion
  296. #region 删除联系人
  297. public bool DelLinkman(Linkman linkman)
  298. {
  299. Database data = new Database();
  300. SqlParameter[] prams = {
  301.    data.MakeInParam("@LinkmanID",  SqlDbType.Int, 4, linkman.ID),
  302.    
  303. };
  304. return(data.RunProc ("sp_CM_DelLinkman",prams)==0?true:false);
  305. }
  306. #endregion
  307. #region 得到所有联系人
  308. public SqlDataReader GetAllLinkman()
  309. {
  310. Database data = new Database();
  311. SqlDataReader dr = null;
  312. data.RunProc ("sp_CM_GetAllLinkman",out dr);
  313. return(dr);
  314. }
  315. public SqlDataReader GetAllContactLinkman()
  316. {
  317. Database data = new Database();
  318. SqlDataReader dr = null;
  319. data.RunProc ("sp_CM_GetAllContactLinkman",out dr);
  320. return(dr);
  321. }
  322. #endregion
  323. #region 根据id得到联系人
  324. public SqlDataReader GetLinkmanByID(string linkmanid)
  325. {
  326. Database data = new Database();
  327. SqlDataReader dr = null;
  328. SqlParameter[] prams = {
  329.    data.MakeInParam("@LinkmanID",  SqlDbType.VarChar, 100, linkmanid)
  330.    };
  331. data.RunProc ("sp_CM_GetLinkmanByID",prams,out dr);
  332. return(dr);
  333. }
  334. public Linkman GetLinkmanStructByID(string linkmanid)
  335. {
  336. Database data = new Database();
  337. Linkman linkman = new Linkman();
  338. SqlDataReader dr = null;
  339. SqlParameter[] prams = {
  340.    data.MakeInParam("@LinkmanID",  SqlDbType.VarChar, 100, linkmanid)
  341.    };
  342. data.RunProc ("sp_CM_GetLinkmanByID",prams,out dr);
  343. while(dr.Read())
  344. {
  345. linkman.Address = dr["address"].ToString();
  346. linkman.ClientID = Int32.Parse(dr["clientid"].ToString());
  347. linkman.Description = dr["description"].ToString();
  348. linkman.Email = dr["email"].ToString();
  349. linkman.Family = dr["family"].ToString();
  350. linkman.Gender = Convert.ToBoolean(dr["gender"]);
  351. linkman.ID = Int32.Parse(dr["id"].ToString());
  352. linkman.Mobile = dr["mobile"].ToString();
  353. linkman.Name = dr["name"].ToString();
  354. linkman.Position = dr["position"].ToString();
  355. linkman.Telephone = dr["telephone"].ToString();
  356. }
  357. return(linkman);
  358. }
  359. #endregion
  360. #region 得到除了给定ids的其他联系人
  361. public SqlDataReader GetRemainLinkmen(string ids)
  362. {
  363. SqlDataReader dataReader = null;
  364. Database data = new Database();
  365. SqlParameter[] prams = {
  366.    data.MakeInParam("@ids",SqlDbType.VarChar,300,ids)
  367.    };
  368. try 
  369. {
  370. // run the stored procedure
  371. data.RunProc("sp_CM_GetRemainLinkmen", prams,out dataReader);
  372. return(dataReader);
  373. }
  374. catch (Exception ex) 
  375. {
  376. Error.Log(ex.ToString());
  377. return null;
  378. }
  379. finally
  380. {
  381. data = null;
  382. }
  383. }
  384. #endregion
  385. #region 根据客户添加人得到与其有关的联系人
  386. public SqlDataReader GetLinkmenByClientAddmanID(int id)
  387. {
  388. SqlDataReader dataReader = null;
  389. Database data = new Database();
  390. SqlParameter[] prams = {
  391.    data.MakeInParam("@id",SqlDbType.Int,4,id)
  392.    };
  393. try 
  394. {
  395. // run the stored procedure
  396. data.RunProc("sp_CM_GetLinkmenByClientAddmanID", prams,out dataReader);
  397. return(dataReader);
  398. }
  399. catch (Exception ex) 
  400. {
  401. Error.Log(ex.ToString());
  402. return null;
  403. }
  404. finally
  405. {
  406. data = null;
  407. }
  408. }
  409. #endregion
  410. #region 添加接触情况
  411. public int AddContact(Contact contact)
  412. {
  413. Database data = new Database();
  414. SqlParameter[] prams = {
  415.     data.MakeInParam("@ClientID",  SqlDbType.Int, 4, contact.ClientID),
  416.     data.MakeInParam("@MarketmanID", SqlDbType.Int, 4,contact.StaffID),
  417.     data.MakeInParam("@UpdateTime", SqlDbType.DateTime,8, contact.UpdateTime),
  418.     data.MakeInParam("@ContactTime",SqlDbType.DateTime,8,contact.ContactTime),
  419. data.MakeInParam("@ContactAim",SqlDbType.VarChar,500,contact.ContactAim),
  420. data.MakeInParam("@SellMoney",SqlDbType.Int,4,contact.SellMoney),
  421. data.MakeInParam("@ContactTimes", SqlDbType.Int,4, contact.ContactTimes),
  422.     data.MakeInParam("@BargainPrognosis",SqlDbType.VarChar,50,contact.BargainPrognosis),
  423. data.MakeInParam("@ContactType",SqlDbType.VarChar,50,contact.ContactType),
  424.     data.MakeInParam("@CurStatus",SqlDbType.VarChar,100,contact.ContactStatus),
  425. data.MakeInParam("@Fee",SqlDbType.Int,4,contact.ThisFee),
  426.     data.MakeInParam("@FeeUsed",SqlDbType.VarChar,100,contact.FeeUsed),
  427. data.MakeInParam("@ContactContent",SqlDbType.VarChar,1000,contact.ContactContent),
  428. data.MakeInParam("@NextContactAim",SqlDbType.VarChar,1000,contact.NextContactAim),
  429. data.MakeInParam("@NextContactTime",SqlDbType.DateTime,8,contact.NextContactTime),
  430.    
  431. };
  432. contact.ID = data.RunProc ("sp_CM_AddContact",prams);
  433. foreach(Cooperater cooperater in contact.arrCooperater)
  434. {
  435. SqlParameter[] prams1 = new SqlParameter[]{
  436. data.MakeInParam("@staffid",SqlDbType.Int,4,cooperater.StaffID),
  437. data.MakeInParam("@contactid",SqlDbType.Int,4,contact.ID)
  438. };
  439. data.RunProc("sp_CM_AddContact_Cooperater",prams1);
  440. }
  441. foreach(Linkman linkman in contact.arrLinkman)
  442. {
  443. SqlParameter[] prams2 = new SqlParameter[]{
  444.   data.MakeInParam("@staffid",SqlDbType.Int,4,linkman.ID),
  445.   data.MakeInParam("@contactid",SqlDbType.Int,4,contact.ID)
  446. };
  447. data.RunProc("sp_CM_AddContact_Linkman",prams2);
  448. }
  449. return(contact.ID);
  450. }
  451. #endregion
  452. #region 修改接触情况
  453. public void UpdateContact(Contact contact)
  454. {
  455. Database data = new Database();
  456. SqlParameter[] prams = {
  457.    data.MakeInParam("@ID",SqlDbType.Int,4,contact.ID),
  458.    data.MakeInParam("@ClientID",  SqlDbType.Int, 4, contact.ClientID),
  459.    data.MakeInParam("@MarketmanID", SqlDbType.Int, 4,contact.StaffID),
  460.    data.MakeInParam("@UpdateTime", SqlDbType.DateTime,8, contact.ContactTime),
  461.    data.MakeInParam("@ContactTime",SqlDbType.DateTime,8,contact.ContactTime),
  462.    data.MakeInParam("@ContactAim",SqlDbType.VarChar,500,contact.ContactAim),
  463.    data.MakeInParam("@SellMoney",SqlDbType.Int,4,contact.SellMoney),
  464.    data.MakeInParam("@BargainPrognosis",SqlDbType.VarChar,50,contact.BargainPrognosis),
  465.    data.MakeInParam("@ContactType",SqlDbType.VarChar,50,contact.ContactType),
  466.    data.MakeInParam("@CurStatus",SqlDbType.VarChar,100,contact.ContactStatus),
  467.    data.MakeInParam("@Fee",SqlDbType.Int,4,contact.ThisFee),
  468.    data.MakeInParam("@FeeUsed",SqlDbType.VarChar,100,contact.FeeUsed),
  469.    data.MakeInParam("@ContactContent",SqlDbType.VarChar,1000,contact.ContactContent),
  470.    data.MakeInParam("@NextContactAim",SqlDbType.VarChar,1000,contact.NextContactAim),
  471.    data.MakeInParam("@NextContactTime",SqlDbType.DateTime,8,contact.NextContactTime),    
  472. };
  473. data.RunProc("sp_CM_UpdateContact",prams);
  474. SqlParameter[] prams3 = new SqlParameter[]{
  475.   data.MakeInParam("@contactid",SqlDbType.Int,4,contact.ID)
  476.   };
  477. data.RunProc("sp_CM_DelContact_Linkman",prams3);
  478. SqlParameter[] prams4 = new SqlParameter[]{
  479.   data.MakeInParam("@contactid",SqlDbType.Int,4,contact.ID)
  480.   };
  481. data.RunProc("sp_CM_DelContact_Cooperater",prams4);
  482. foreach(Cooperater cooperater in contact.arrCooperater)
  483. {
  484. SqlParameter[] prams1 = new SqlParameter[]{
  485.   data.MakeInParam("@staffid",SqlDbType.Int,4,cooperater.StaffID),
  486.   data.MakeInParam("@contactid",SqlDbType.Int,4,contact.ID)
  487.   };
  488. data.RunProc("sp_CM_AddContact_Cooperater",prams1);
  489. }
  490. foreach(Linkman linkman in contact.arrLinkman)
  491. {
  492. SqlParameter[] prams2 = new SqlParameter[]{
  493.   data.MakeInParam("@staffid",SqlDbType.Int,4,linkman.ID),
  494.   data.MakeInParam("@contactid",SqlDbType.Int,4,contact.ID)
  495.   };
  496. data.RunProc("sp_CM_AddContact_Linkman",prams2);
  497. }
  498. }
  499. #endregion
  500. #region 根据客户ID得到接触信息
  501. public SqlDataReader GetClientContactInfo(int clientid)
  502. {
  503. Database data = new Database();
  504. SqlDataReader dr = null;
  505. SqlParameter[] prams = {
  506.    data.MakeInParam("@clientid",  SqlDbType.Int, 4, clientid)
  507.    };
  508. data.RunProc ("sp_CM_GetClientContactInfo",prams,out dr);
  509. return(dr);
  510. }
  511. #endregion
  512. #region 根据客户ID得到本周内接触信息
  513. public SqlDataReader GetClientContactInfo_thisWeek(int clientid)
  514. {
  515. Database data = new Database();
  516. SqlDataReader dr = null;
  517. SqlParameter[] prams = {
  518.    data.MakeInParam("@clientid",  SqlDbType.Int, 4, clientid)
  519.    };
  520. data.RunProc ("sp_CM_GetClientContactInfo_thisWeek",prams,out dr);
  521. return(dr);
  522. }
  523. #endregion
  524. #region 根据接触id得到接触信息
  525. public Contact GetClientContactStruct(int contactid)
  526. {
  527. Contact contact = new Contact();
  528. CM cm = new CM();
  529. Database data = new Database();
  530. SqlDataReader dr = null;
  531. SqlParameter[] prams = {
  532.    data.MakeInParam("@contactid",  SqlDbType.Int, 4, contactid)
  533.    };
  534. data.RunProc("sp_CM_GetContactByID",prams,out dr);
  535. while(dr.Read())
  536. {
  537. contact.BargainPrognosis = dr["BargainPrognosis"].ToString();
  538. contact.ClientID = Int32.Parse(dr["ClientID"].ToString());
  539. contact.ContactAim = dr["ContactAim"].ToString();
  540. contact.ContactContent = dr["ContactContent"].ToString();
  541. contact.ContactStatus = dr["CurStatus"].ToString();
  542. contact.ContactTimes = Int32.Parse(dr["ContactTimes"].ToString());
  543. contact.ContactType = dr["ContactType"].ToString();
  544. contact.FeeUsed = dr["FeeUsed"].ToString();
  545. contact.ID = Int32.Parse(dr["ID"].ToString());
  546. contact.NextContactAim = dr["NextContactAim"].ToString();
  547. contact.NextContactTime = DateTime.Parse(dr["NextContactTime"].ToString());
  548. contact.SellMoney = dr["SellMoney"].ToString();
  549. if(dr["contacttime"]!=DBNull.Value) 
  550. contact.ContactTime = DateTime.Parse(dr["contacttime"].ToString());
  551. else
  552. contact.ContactTime = DateTime.Parse("1900-1-1");
  553. }
  554. dr.Close();
  555. SqlParameter[] prams1 = {
  556.    data.MakeInParam("@contactid",  SqlDbType.Int, 4, contactid)
  557.    };
  558. data.RunProc("sp_CM_GetContactLinkman",prams1,out dr);
  559. while(dr.Read())
  560. {
  561. Linkman linkman = new Linkman();
  562. linkman.Address = dr["Address"].ToString();
  563. linkman.ClientID = Int32.Parse(dr["ClientID"].ToString());
  564. linkman.Description = dr["Description"].ToString();
  565. linkman.Email = dr["Email"].ToString();
  566. linkman.Family = dr["Family"].ToString();
  567. linkman.Gender = Convert.ToBoolean(dr["Gender"]);
  568. linkman.ID = Int32.Parse(dr["ID"].ToString());
  569. linkman.Mobile = dr["Mobile"].ToString();
  570. linkman.Name = dr["Name"].ToString();
  571. linkman.Position = dr["Position"].ToString();
  572. linkman.Telephone = dr["Telephone"].ToString();
  573. contact.AddLinkman(linkman);
  574. }
  575. dr.Close();
  576. SqlParameter[] prams2 = {
  577. data.MakeInParam("@contactid",  SqlDbType.Int, 4, contactid)
  578. };
  579. data.RunProc("sp_CM_GetContactCooperater",prams2,out dr);
  580. while(dr.Read())
  581. {
  582. Cooperater cooperater = new Cooperater();
  583. cooperater.StaffID = Int32.Parse(dr["CooperatingmanID"].ToString());
  584. contact.AddCooperater(cooperater);
  585. }
  586. return(contact);
  587. }
  588. #endregion
  589. #region 得到所有协同人
  590. public SqlDataReader GetAllCooperater()
  591. {
  592. Database data = new Database();
  593. SqlDataReader dr = null;
  594. data.RunProc ("sp_CM_GetAllCooperater",out dr);
  595. return(dr);
  596. }
  597. #endregion
  598. #region 根据客户id得到协同人
  599. public SqlDataReader GetCooperaterByClientID(int clientid)
  600. {
  601. Database data = new Database();
  602. SqlDataReader dr = null;
  603. SqlParameter[] prams = {
  604.     data.MakeInParam("@ClientID",SqlDbType.Int,4,clientid)
  605. };
  606. data.RunProc ("sp_CM_GetCooperaterByClientID",prams,out dr);
  607. return(dr);
  608. }
  609. #endregion
  610. #region 根据人员id得到客户列表
  611. public SqlDataReader GetMyClients(int staffid)
  612. {
  613. Database data = new Database();
  614. SqlDataReader dr = null;
  615. SqlParameter[] prams = {
  616.    data.MakeInParam("@staffid",  SqlDbType.Int, 4, staffid)
  617.    };
  618. data.RunProc ("sp_CM_GetClientsByStaff",prams,out dr);
  619. return(dr);
  620. }
  621. #endregion
  622. #region 根据人员id得到时间段内的接触情况
  623. public SqlDataReader GetContactByStaffIDandTime(int staffid,DateTime begintime,DateTime endtime)
  624. {
  625. Database data = new Database();
  626. SqlDataReader dr = null;
  627. SqlParameter[] prams = {
  628.    data.MakeInParam("@staffid",  SqlDbType.Int, 4, staffid),
  629.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  630.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  631.    };
  632. data.RunProc ("sp_CM_GetContactByStaff",prams,out dr);
  633. return(dr);
  634. }
  635. #endregion
  636. #region 在时间范围内得到销售人员列表
  637. public SqlDataReader GetSellman(DateTime begintime,DateTime endtime)
  638. {
  639. Database data = new Database();
  640. SqlDataReader dr = null;
  641. SqlParameter[] prams = {
  642.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  643.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  644.    };
  645. data.RunProc ("sp_CM_GetSellman",prams,out dr);
  646. return(dr);
  647. }
  648. #endregion
  649. #region 得到时间段接触情况
  650. public SqlDataReader GetContactInfo(DateTime begintime,DateTime endtime)
  651. {
  652. Database data = new Database();
  653. SqlDataReader dr = null;
  654. SqlParameter[] prams = {
  655.   
  656.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  657.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  658.    };
  659. data.RunProc ("sp_CM_GetContactInfo",prams,out dr);
  660. return(dr);
  661. }
  662. #endregion
  663. #region 得到时间段拜访客户接触情况
  664. public SqlDataReader GetCallinContactInfo(DateTime begintime,DateTime endtime)
  665. {
  666. Database data = new Database();
  667. SqlDataReader dr = null;
  668. SqlParameter[] prams = {
  669.   
  670.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  671.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  672.    };
  673. data.RunProc ("sp_CM_GetCallinContact",prams,out dr);
  674. return(dr);
  675. }
  676. #endregion
  677. #region 得到时间段内的新客户情况
  678. public SqlDataReader GetNewClient(DateTime begintime,DateTime endtime)
  679. {
  680. Database data = new Database();
  681. SqlDataReader dr = null;
  682. SqlParameter[] prams = {
  683.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  684.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  685.    };
  686. data.RunProc ("sp_CM_GetNewClient",prams,out dr);
  687. return(dr);
  688. }
  689. #endregion
  690. #region 得到时间段内的进入谈判的客户情况
  691. public SqlDataReader GetNegotiateClient()
  692. {
  693. Database data = new Database();
  694. SqlDataReader dr = null;
  695. data.RunProc ("sp_CM_GetNegotiateClient",out dr);
  696. return(dr);
  697. }
  698. #endregion
  699. #region 得到时间段内的进入谈判的新客户情况
  700. public SqlDataReader GetNewNegotiateClient(DateTime begintime,DateTime endtime)
  701. {
  702. Database data = new Database();
  703. SqlDataReader dr = null;
  704. SqlParameter[] prams = {
  705.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  706.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  707.    };
  708. data.RunProc ("sp_CM_GetNewNegotiateClient",prams,out dr);
  709. return(dr);
  710. }
  711. #endregion
  712. #region 根据sellmanid得到时间内的新客户情况
  713. public SqlDataReader GetNewClientBySellman(int sellmanid, DateTime begintime,DateTime endtime)
  714. {
  715. Database data = new Database();
  716. SqlDataReader dr = null;
  717. SqlParameter[] prams = {
  718.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  719.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  720.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  721.    };
  722. data.RunProc ("sp_CM_GetNewClientBySellmanID",prams,out dr);
  723. return(dr);
  724. }
  725. #endregion
  726. #region 得到时间段的3星客户情况
  727. public SqlDataReader GetNew3StarClient(DateTime begintime,DateTime endtime)
  728. {
  729. Database data = new Database();
  730. SqlDataReader dr = null;
  731. SqlParameter[] prams = {
  732.   
  733.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  734.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  735.    };
  736. data.RunProc ("sp_CM_GetNew3StarClient",prams,out dr);
  737. return(dr);
  738. }
  739. #endregion
  740. #region 得到全部3星客户情况
  741. public SqlDataReader Get3StarClient()
  742. {
  743. Database data = new Database();
  744. SqlDataReader dr = null;
  745. data.RunProc ("sp_CM_Get3StarClient",out dr);
  746. return(dr);
  747. }
  748. #endregion
  749. #region 根据sellmanid得到时间段的3星客户情况
  750. public SqlDataReader GetNew3StarClientBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  751. {
  752. Database data = new Database();
  753. SqlDataReader dr = null;
  754. SqlParameter[] prams = {
  755.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  756.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  757.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  758.    };
  759. data.RunProc ("sp_CM_GetNew3StarClientBySellmanID",prams,out dr);
  760. return(dr);
  761. }
  762. #endregion
  763. #region 根据sellmanid得到时间段的接触过的客户情况
  764. public SqlDataReader GetContactedClientBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  765. {
  766. Database data = new Database();
  767. SqlDataReader dr = null;
  768. SqlParameter[] prams = {
  769.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  770.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  771.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  772.    };
  773. data.RunProc ("sp_CM_GetContactedClientBySellman",prams,out dr);
  774. return(dr);
  775. }
  776. #endregion
  777. #region 根据sellmanid得到时间的拜访过的客户情况
  778. public SqlDataReader GetCallinClientBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  779. {
  780. Database data = new Database();
  781. SqlDataReader dr = null;
  782. SqlParameter[] prams = {
  783.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  784.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  785.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  786.    };
  787. data.RunProc ("sp_CM_GetCallinContactBySellmanID",prams,out dr);
  788. return(dr);
  789. }
  790. #endregion
  791. #region 根据sellmanid得到时间段内的接触情况
  792. public SqlDataReader GetContactBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  793. {
  794. Database data = new Database();
  795. SqlDataReader dr = null;
  796. SqlParameter[] prams = {
  797.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  798.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  799.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  800.    };
  801. data.RunProc ("sp_CM_GetContactBySellmanID",prams,out dr);
  802. return(dr);
  803. }
  804. #endregion
  805. #region 根据sellmanid得到时间段内的拜访接触情况
  806. public SqlDataReader GeCallinContactBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  807. {
  808. Database data = new Database();
  809. SqlDataReader dr = null;
  810. SqlParameter[] prams = {
  811.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  812.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  813.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  814.    };
  815. data.RunProc ("sp_CM_GetCallinContactBySellmanID",prams,out dr);
  816. return(dr);
  817. }
  818. #endregion
  819. #region 得到时间段内销售人员费用情况
  820. public SqlDataReader GetFeeBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  821. {
  822. Database data = new Database();
  823. SqlDataReader dr = null;
  824. SqlParameter[] prams = {
  825.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  826.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  827.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  828.    };
  829. data.RunProc ("sp_CM_GetContactFeeBySellmanID",prams,out dr);
  830. return(dr);
  831. }
  832. #endregion
  833. #region 根据sellmanid得到时间段内的差旅费用
  834. public int GetTravelFeeBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  835. {
  836. int result = 0;
  837. Database data = new Database();
  838. SqlDataReader dr = null;
  839. SqlParameter[] prams = {
  840.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  841.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  842.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  843.    };
  844. data.RunProc ("sp_CM_GetTravelFeeBySellmanID",prams,out dr);
  845. while(dr.Read())
  846. {
  847. if(dr["fee"]!=DBNull.Value)
  848. result = Int32.Parse(dr["fee"].ToString());
  849. }
  850. return(result);
  851. }
  852. #endregion
  853. #region 根据sellmanid得到时间段内的餐饮费用
  854. public int GetFoodFeeBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  855. {
  856. int result = 0;
  857. Database data = new Database();
  858. SqlDataReader dr = null;
  859. SqlParameter[] prams = {
  860.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  861.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  862.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  863.    };
  864. data.RunProc ("sp_CM_GetFoodFeeBySellmanID",prams,out dr);
  865. while(dr.Read())
  866. {
  867. if(dr["fee"]!=DBNull.Value)
  868. result = Int32.Parse(dr["fee"].ToString());
  869. }
  870. return(result);
  871. }
  872. #endregion
  873. #region 根据sellmanid得到时间段内的礼品费用
  874. public int GetGiftFeeBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  875. {
  876. int result = 0;
  877. Database data = new Database();
  878. SqlDataReader dr = null;
  879. SqlParameter[] prams = {
  880.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  881.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  882.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  883.    };
  884. data.RunProc ("sp_CM_GetGiftFeeBySellmanID",prams,out dr);
  885. while(dr.Read())
  886. {
  887. if(dr["fee"]!=DBNull.Value)
  888. result = Int32.Parse(dr["fee"].ToString());
  889. }
  890. return(result);
  891. }
  892. #endregion
  893. #region 根据sellmanid得到时间段内的公关费用
  894. public int GetOuterFeeBySellmanID(int sellmanid,DateTime begintime,DateTime endtime)
  895. {
  896. int result = 0;
  897. Database data = new Database();
  898. SqlDataReader dr = null;
  899. SqlParameter[] prams = {
  900.    data.MakeInParam("@sellmanid",SqlDbType.Int,4,sellmanid),
  901.    data.MakeInParam("@begintime",SqlDbType.DateTime,8,begintime),
  902.    data.MakeInParam("@endtime",SqlDbType.DateTime,8,endtime)
  903.    };
  904. data.RunProc ("sp_CM_GetOuterFeeBySellmanID",prams,out dr);
  905. while(dr.Read())
  906. {
  907. if(dr["fee"]!=DBNull.Value)
  908. result = Int32.Parse(dr["fee"].ToString());
  909. }
  910. return(result);
  911. }
  912. #endregion
  913. #region 上传一个文件得到id号
  914. public int InsertFile(string path,string type,int pertainid,string extension)
  915. {
  916. Database data = new Database();
  917. SqlParameter[] prams = {
  918.    data.MakeInParam("@path",SqlDbType.VarChar,500,path),
  919.    data.MakeInParam("@type",SqlDbType.VarChar,50,type),
  920.    data.MakeInParam("@pertainID",SqlDbType.Int,4,pertainid),
  921.    data.MakeInParam("@extension",SqlDbType.VarChar,100,extension)
  922.    };
  923. return(data.RunProc ("sp_CM_AddFile",prams));
  924. }
  925. #endregion
  926. #region 根据contactid得到上传附件信息
  927. public SqlDataReader GetAttachmentByContactID(int contactid)
  928. {
  929. Database data = new Database();
  930. SqlDataReader dr = null;
  931. SqlParameter[] prams = {
  932.    data.MakeInParam("@contactid",SqlDbType.Int,4,contactid)
  933.    };
  934. data.RunProc ("sp_CM_GetAttachmentByContactID",prams,out dr);
  935. return(dr);
  936. }
  937. #endregion
  938. #region 根据clientid得到上传附件信息
  939. public SqlDataReader GetAttachmentByClientID(int clientid)
  940. {
  941. Database data = new Database();
  942. SqlDataReader dr = null;
  943. SqlParameter[] prams = {
  944.    data.MakeInParam("@clientid",SqlDbType.Int,4,clientid)
  945.    };
  946. data.RunProc ("sp_CM_GetAttachmentByClientID",prams,out dr);
  947. return(dr);
  948. }
  949. #endregion
  950. }
  951. #region 数据结构
  952. #region 客户结构
  953. /// <summary>
  954. /// 客户信息
  955. /// </summary>
  956. public class ClientInfo
  957. {
  958. private int id = 0;
  959. private DateTime birthday = DateTime.Now;
  960. private DateTime updatetime = DateTime.Now;
  961. private string clientshortname = "";
  962. private string clientname = "";
  963. private int chieflinkmanid = 0;
  964. private string linkman_telephone = "";
  965. private string clienttype = "";
  966. private string enterprisetype = "";
  967. private string clienttrade = "";
  968. private string clientsource = "";
  969. private string clientinitiative = "";
  970. private int addmanid = 0;
  971. private int contacttimes = 0;
  972. private string sellphase = "";
  973. private string bargainprognosis = "";
  974. private float fee = 0;
  975. private string curstatus = "";
  976. private string type = "";
  977. /// <summary>
  978. /// 客户ID
  979. /// </summary>
  980. public int ID
  981. {
  982. get{return id;}
  983. set{id = value; }
  984. }
  985. /// <summary>
  986. /// 添加日期
  987. /// </summary>
  988. public DateTime Birthday
  989. {
  990. get{return birthday;}
  991. set{birthday = value;}
  992. }
  993. /// <summary>
  994. /// 最后更新日期
  995. /// </summary>
  996. public DateTime UpdateTime
  997. {
  998. get{return updatetime;}
  999. set{updatetime = value;}
  1000. }
  1001. /// <summary>
  1002. /// 添加人ID
  1003. /// </summary>
  1004. public int AddManID
  1005. {
  1006. get{return addmanid;}
  1007. set{addmanid = value;}
  1008. }
  1009. /// <summary>
  1010. /// 客户简称
  1011. /// </summary>
  1012. public string ClientShortName
  1013. {
  1014. get{return clientshortname;}
  1015. set{clientshortname = value;}
  1016. }
  1017. /// <summary>
  1018. /// 主要联系人ID
  1019. /// </summary>
  1020. public int ChiefLinkmanID
  1021. {
  1022. get{return chieflinkmanid;}
  1023. set{chieflinkmanid = value;}
  1024. }
  1025. /// <summary>
  1026. /// 客户全称
  1027. /// </summary>
  1028. public string ClientName
  1029. {
  1030. get{return clientname;}
  1031. set{clientname = value;}
  1032. }
  1033. /// <summary>
  1034. /// 客户分类
  1035. /// </summary>
  1036. public string ClientType
  1037. {
  1038. get{return clienttype;}
  1039. set{clienttype = value;}
  1040. }
  1041. /// <summary>
  1042. /// 企业性质
  1043. /// </summary>
  1044. public string EnterpriseType
  1045. {
  1046. get{return enterprisetype;}
  1047. set{enterprisetype = value;}
  1048. }
  1049. /// <summary>
  1050. /// 所处行业
  1051. /// </summary>
  1052. public string ClientTrade
  1053. {
  1054. get{return clienttrade;}
  1055. set{clienttrade = value;}
  1056. }
  1057. /// <summary>
  1058. /// 客户来源
  1059. /// </summary>
  1060. public string ClientSource
  1061. {
  1062. get{return clientsource;}
  1063. set{clientsource = value;}
  1064. }
  1065. /// <summary>
  1066. /// 客户主动
  1067. /// </summary>
  1068. public string ClientInitiative
  1069. {
  1070. get{return clientinitiative;}
  1071. set{clientinitiative = value;}
  1072. }
  1073. /// <summary>
  1074. /// 接触次数
  1075. /// </summary>
  1076. public int ContactTimes
  1077. {
  1078. get{return contacttimes;}
  1079. set{contacttimes = value;}
  1080. }
  1081. /// <summary>
  1082. /// 销售阶段
  1083. /// </summary>
  1084. public string SellPhase
  1085. {
  1086. get{return sellphase;}
  1087. set{sellphase = value;}
  1088. }
  1089. /// <summary>
  1090. /// 成交评估
  1091. /// </summary>
  1092. public string BargainPrognosis
  1093. {
  1094. get{return bargainprognosis;}
  1095. set{bargainprognosis = value;}
  1096. }
  1097. /// <summary>
  1098. /// 发生费用
  1099. /// </summary>
  1100. public float Fee
  1101. {
  1102. get{return fee;}
  1103. set{fee = value;}
  1104. }
  1105. /// <summary>
  1106. /// 联系人电话
  1107. /// </summary>
  1108. public string Linkman_Telephone
  1109. {
  1110. get{return linkman_telephone;}
  1111. set{linkman_telephone = value;}
  1112. }
  1113. /// <summary>
  1114. /// 当前状态
  1115. /// </summary>
  1116. public string CurStatus
  1117. {
  1118. get{return curstatus;}
  1119. set{curstatus = value;}
  1120. }
  1121. /// <summary>
  1122. /// 客户分类
  1123. /// </summary>
  1124. public string Type
  1125. {
  1126. get{return type;}
  1127. set{type = value;}
  1128. }
  1129. private string affiliatedarea = "";
  1130. /// <summary>
  1131. /// 隶属区域
  1132. /// </summary>
  1133. public string Affiliatedarea
  1134. {
  1135. get{return affiliatedarea;}
  1136. set{affiliatedarea = value;}
  1137. }
  1138. private string url = "";
  1139. /// <summary>
  1140. /// 网址
  1141. /// </summary>
  1142. public string URL
  1143. {
  1144. get{return url;}
  1145. set{url = value;}
  1146. }
  1147. private string zip = "";
  1148. /// <summary>
  1149. /// 邮编
  1150. /// </summary>
  1151. public string ZIP
  1152. {
  1153. get{return zip;}
  1154. set{zip = value;}
  1155. }
  1156. private string address = "";
  1157. /// <summary>
  1158. /// 地址
  1159. /// </summary>
  1160. public string Address
  1161. {
  1162. get{return address;}
  1163. set{address = value;}
  1164. }
  1165. private string companyproperty = "";
  1166. /// <summary>
  1167. /// 公司性质
  1168. /// </summary>
  1169. public string CompanyProperty
  1170. {
  1171. get{return companyproperty;}
  1172. set{companyproperty = value;}
  1173. }
  1174. private string calling = "";
  1175. /// <summary>
  1176. /// 所处行业
  1177. /// </summary>
  1178. public string Calling
  1179. {
  1180. get{return calling;}
  1181. set{calling = value;}
  1182. }
  1183. private string companysize = "";
  1184. /// <summary>
  1185. /// 公司规模
  1186. /// </summary>
  1187. public string CompanySize
  1188. {
  1189. get{return companysize;}
  1190. set{companysize = value;}
  1191. }
  1192. private string money = "";
  1193. /// <summary>
  1194. /// 注册资金
  1195. /// </summary>
  1196. public string Money
  1197. {
  1198. get{return money;}
  1199. set{money = value;}
  1200. }
  1201. private string operation = "";
  1202. /// <summary>
  1203. /// 主营业务
  1204. /// </summary>
  1205. public string Operation
  1206. {
  1207. get{return operation;}
  1208. set{operation = value;}
  1209. }
  1210. private string introduce = "";
  1211. /// <summary>
  1212. /// 企业简介
  1213. /// </summary>
  1214. public string Introduce
  1215. {
  1216. get{return introduce;}
  1217. set{introduce = value;}
  1218. }
  1219. private string itgrade = "";
  1220. /// <summary>
  1221. /// 信息化程度
  1222. /// </summary>
  1223. public string ITGrade
  1224. {
  1225. get{return itgrade;}
  1226. set{itgrade = value;}
  1227. }
  1228. private int pcnumber = 0;
  1229. /// <summary>
  1230. /// 电脑数量
  1231. /// </summary>
  1232. public  int PCNumber
  1233. {
  1234. get{return pcnumber;}
  1235. set{pcnumber = value;}
  1236. }
  1237. private string net = "";
  1238. /// <summary>
  1239. /// 网络状况
  1240. /// </summary>
  1241. public string Net
  1242. {
  1243. get{return net;}
  1244. set{net = value;}
  1245. }
  1246. private int itstaffs = 0;
  1247. /// <summary>
  1248. /// 专业IT人员
  1249. /// </summary>
  1250. public int ITStaffs
  1251. {
  1252. get{return itstaffs;}
  1253. set{itstaffs = value;}
  1254. }
  1255. private string itdepartment = "";
  1256. /// <summary>
  1257. /// IT部门
  1258. /// </summary>
  1259. public string ITDepartment
  1260. {
  1261. get{return itdepartment;}
  1262. set{itdepartment = value;}
  1263. }
  1264. private string principal;
  1265. /// <summary>
  1266. /// 负责人
  1267. /// </summary>
  1268. public string Principal
  1269. {
  1270. get{return principal;}
  1271. set{principal = value;}
  1272. }
  1273. private string system = "";
  1274. /// <summary>
  1275. /// 系统
  1276. /// </summary>
  1277. public string System
  1278. {
  1279. get{return system;}
  1280. set{system = value;}
  1281. }
  1282. private string customer = "";
  1283. /// <summary>
  1284. /// 客户来源
  1285. /// </summary>
  1286. public string Customer
  1287. {
  1288. get{return customer;}
  1289. set{customer = value;}
  1290. }
  1291. private DateTime firstcontacttime;
  1292. /// <summary>
  1293. /// 首次接触时间
  1294. /// </summary>
  1295. public DateTime FirstContactTime
  1296. {
  1297. get{return firstcontacttime;}
  1298. set{firstcontacttime = value;}
  1299. }
  1300. private DateTime nextcontacttime;
  1301. /// <summary>
  1302. /// 下次接触时间
  1303. /// </summary>
  1304. public DateTime NextContactTime
  1305. {
  1306. get{return nextcontacttime;}
  1307. set{nextcontacttime = value;}
  1308. }
  1309. private DateTime contacttime;
  1310. /// <summary>
  1311. /// 接触时间
  1312. /// </summary>
  1313. public DateTime ContactTime
  1314. {
  1315. get{return contacttime;}
  1316. set{contacttime = value;}
  1317. }
  1318. }
  1319. /// <summary>
  1320. /// 客户类别
  1321. /// </summary>
  1322. enum ClientType {terminal,channal,social,media};
  1323. /// <summary>
  1324. /// 企业性质
  1325. /// </summary>
  1326. enum EnterpriseType {government,contry,oversea,stock,privateowned}
  1327. /// <summary>
  1328. /// 所处行业
  1329. /// </summary>
  1330. enum ClientTrade 
  1331. {
  1332. realty,IT,business,telecom,post,refer,travel,bus,stock,insurance,tax,make,he,clothe,food,medicine,engine,auto,mechanism
  1333. };
  1334. /// <summary>
  1335. /// 网络状况
  1336. /// </summary>
  1337. enum ClientNet
  1338. {LAN,WAN,INTERNET};
  1339. /// <summary>
  1340. /// 客户来源
  1341. /// </summary>
  1342. enum ClientSource
  1343. {
  1344. sellman,familiar,introduce,client
  1345. };
  1346. /// <summary>
  1347. /// 客户主动
  1348. /// </summary>
  1349. enum ClientInitiative 
  1350. {
  1351. media,searchweb,proseminar,exhibition,post,email,
  1352. };
  1353. #endregion
  1354. #region 联系人结构
  1355. public class Linkman
  1356. {
  1357. private int id = 0;
  1358. private int clientid = 0;
  1359. private string name = "";
  1360. private string mobile = "";
  1361. private string telephone = "";
  1362. private string position = "";
  1363. private string email = "";
  1364. private bool gender = true;
  1365. private string description = "";
  1366. private string address = "";
  1367. private string family = "";
  1368. /// <summary>
  1369. /// 联系人id
  1370. /// </summary>
  1371. public int ID
  1372. {
  1373. get{return id;}
  1374. set{id = value;}
  1375. }
  1376. /// <summary>
  1377. /// 联系人名字
  1378. /// </summary>
  1379. public string Name
  1380. {
  1381. get{return name;}
  1382. set{name = value;}
  1383. }
  1384. /// <summary>
  1385. /// 客户ID
  1386. /// </summary>
  1387. public int ClientID
  1388. {
  1389. get{return clientid;}
  1390. set{clientid = value;}
  1391. }
  1392. /// <summary>
  1393. /// 手机号码
  1394. /// </summary>
  1395. public string Mobile
  1396. {
  1397. get{return mobile;}
  1398. set{mobile = value;}
  1399. }
  1400. /// <summary>
  1401. /// 电话
  1402. /// </summary>
  1403. public string Telephone
  1404. {
  1405. get{return telephone;}
  1406. set{telephone = value;}
  1407. }
  1408. /// <summary>
  1409. /// 职位
  1410. /// </summary>
  1411. public string Position
  1412. {
  1413. get{return position;}
  1414. set{position = value;}
  1415. }
  1416. public string Email
  1417. {
  1418. get{return email;}
  1419. set{email = value;}
  1420. }
  1421. /// <summary>
  1422. /// 性别
  1423. /// </summary>
  1424. public bool Gender
  1425. {
  1426. get{return gender;}
  1427. set{gender = value;}
  1428. }
  1429. /// <summary>
  1430. /// 本人说明
  1431. /// </summary>
  1432. public string Description
  1433. {
  1434. get{return description;}
  1435. set{description = value;}
  1436. }
  1437. /// <summary>
  1438. /// 子女情况
  1439. /// </summary>
  1440. public string Family
  1441. {
  1442. get{return family;}
  1443. set{family = value;}
  1444. }
  1445. /// <summary>
  1446. /// 家庭住址
  1447. /// </summary>
  1448. public string Address
  1449. {
  1450. get{return address;}
  1451. set{address = value;}
  1452. }
  1453. }
  1454. #endregion
  1455. #region 协同人员结构
  1456. public class Cooperater
  1457. {
  1458. private int staffid;
  1459. /// <summary>
  1460. /// 协同人员ID
  1461. /// </summary>
  1462. public int StaffID
  1463. {
  1464. get{return staffid;}
  1465. set{staffid = value;}
  1466. }
  1467. }
  1468. #endregion
  1469. #region 接触情况结构
  1470. public class Contact
  1471. {
  1472. private int id = 0;
  1473. private int staffid = 0;
  1474. private int clientid = 0;
  1475. private string contactaim = "";
  1476. private string sellmoney = "";
  1477. private string bargainprognosis = "";
  1478. private string contacttype = "";
  1479. private float thisfee = 0;
  1480. private string contactstatus = "";
  1481. private string feeused = "";
  1482. private string contactcontent = "";
  1483. private string nextcontactaim = "";
  1484. private DateTime nextcontacttime = DateTime.Now;
  1485. private DateTime contacttime = DateTime.Now;
  1486. private DateTime updatetime = DateTime.Now;
  1487. private int contacttimes = 0;
  1488. public ArrayList arrCooperater = new ArrayList(); 
  1489. public ArrayList arrLinkman = new ArrayList();
  1490. /// <summary>
  1491. /// 添加协同人员
  1492. /// </summary>
  1493. /// <param name="cooperater"></param>
  1494. public void AddCooperater(Cooperater cooperater)
  1495. {
  1496. if(!arrCooperater.Contains(cooperater))
  1497. arrCooperater.Add(cooperater);
  1498. }
  1499. /// <summary>
  1500. /// 移除协同人员
  1501. /// </summary>
  1502. /// <param name="cooperater"></param>
  1503. public void DelCooperater(Cooperater cooperater)
  1504. {
  1505. if(arrCooperater.Contains(cooperater))
  1506. {
  1507. arrCooperater.Remove(cooperater);
  1508. }
  1509. else
  1510. {
  1511. throw new Exception("要删除的对象不存在");
  1512. }
  1513. }
  1514. /// <summary>
  1515. /// 添加联系人
  1516. /// </summary>
  1517. /// <param name="linkman"></param>
  1518. public void AddLinkman(Linkman linkman)
  1519. {
  1520. if(!arrLinkman.Contains(linkman))
  1521. arrLinkman.Add(linkman);
  1522. }
  1523. /// <summary>
  1524. /// 移出联系人
  1525. /// </summary>
  1526. /// <param name="linkman"></param>
  1527. public void DelLinkman(Linkman linkman)
  1528. {
  1529. if(arrLinkman.Contains(linkman))
  1530. {
  1531. arrLinkman.Remove(linkman); }
  1532. else
  1533. {
  1534. throw new Exception("要删除的对象不存在");
  1535. }
  1536. }
  1537. /// <summary>
  1538. /// 接触ID
  1539. /// </summary>
  1540. public int ID
  1541. {
  1542. get{return id;}
  1543. set{id = value;}
  1544. }
  1545. /// <summary>
  1546. /// 销售人员id
  1547. /// </summary>
  1548. public int StaffID
  1549. {
  1550. get{return staffid;}
  1551. set{staffid = value;}
  1552. }
  1553. /// <summary>
  1554. /// 客户ID
  1555. /// </summary>
  1556. public int ClientID
  1557. {
  1558. get{return clientid;}
  1559. set{clientid = value;}
  1560. }
  1561. /// <summary>
  1562. /// 更新时间
  1563. /// </summary>
  1564. public DateTime UpdateTime
  1565. {
  1566. get{return updatetime;}
  1567. set{updatetime = value;}
  1568. }
  1569. /// <summary>
  1570. /// 接洽次数
  1571. /// </summary>
  1572. public int ContactTimes
  1573. {
  1574. get{return contacttimes;}
  1575. set{contacttimes = value;}
  1576. }
  1577. /// <summary>
  1578. /// 接触目的
  1579. /// </summary>
  1580. public string ContactAim
  1581. {
  1582. get{return contactaim;}
  1583. set{contactaim = value;}
  1584. }
  1585. /// <summary>
  1586. /// 近期标的
  1587. /// </summary>
  1588. public string SellMoney
  1589. {
  1590. get{return sellmoney;}
  1591. set{sellmoney = value;}
  1592. }
  1593. /// <summary>
  1594. /// 成交预估
  1595. /// </summary>
  1596. public string BargainPrognosis
  1597. {
  1598. get{return bargainprognosis;}
  1599. set{bargainprognosis = value;}
  1600. }
  1601. /// <summary>
  1602. /// 接触状态
  1603. /// </summary>
  1604. public string ContactType
  1605. {
  1606. get{return contacttype;}
  1607. set{contacttype = value;}
  1608. }
  1609. /// <summary>
  1610. /// 接触状态
  1611. /// </summary>
  1612. public string ContactStatus
  1613. {
  1614. get{return contactstatus;}
  1615. set{contactstatus = value;}
  1616. }
  1617. /// <summary>
  1618. /// 本次费用
  1619. /// </summary>
  1620. public float ThisFee
  1621. {
  1622. get{return thisfee;}
  1623. set{thisfee = value;}
  1624. }
  1625. /// <summary>
  1626. /// 费用用途
  1627. /// </summary>
  1628. public string FeeUsed
  1629. {
  1630. get{return feeused;}
  1631. set{feeused = value;}
  1632. }
  1633. /// <summary>
  1634. /// 接触内容
  1635. /// </summary>
  1636. public string ContactContent
  1637. {
  1638. get{return contactcontent;}
  1639. set{contactcontent = value;}
  1640. }
  1641. /// <summary>
  1642. /// 下次接触目的
  1643. /// </summary>
  1644. public string NextContactAim
  1645. {
  1646. get{return nextcontactaim;}
  1647. set{nextcontactaim = value;}
  1648. }
  1649. /// <summary>
  1650. /// 接触时间
  1651. /// </summary>
  1652. public DateTime ContactTime
  1653. {
  1654. get{return contacttime;}
  1655. set{contacttime = value;}
  1656. }
  1657. /// <summary>
  1658. /// 下次接触时间
  1659. /// </summary>
  1660. public DateTime NextContactTime
  1661. {
  1662. get{return nextcontacttime;}
  1663. set{nextcontacttime = value;}
  1664. }
  1665. }
  1666. /// <summary>
  1667. /// 接触方式
  1668. /// </summary>
  1669. enum ContactType{telephone,fax,email,mail,sms,callin,interview,meeting};
  1670. /// <summary>
  1671. /// 接触状态
  1672. /// </summary>
  1673. enum ContactStat{trace,boot,commend,requirement,submit,negotiate,actualize,traceservice,last};
  1674. /// <summary>
  1675. /// 费用用途
  1676. /// </summary>
  1677. enum ContactFeeUsed{travel,food,gift,outer};
  1678. #endregion
  1679. #endregion
  1680. }