DlgCustChoose.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Collections;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Infragistics.Win;
  13. namespace Core.StlMes.Client.Sale.SaleFundMgt.FundUI.UIDlgBox
  14. {
  15. public partial class DlgCustChoose : UIFrm.FrmFundBase
  16. {
  17. private string saleOrg = "";
  18. private string custUser = "";
  19. private CoreFS.CA06.OpeBase _ob = null;
  20. private FundBLL.InterfaceMgt.SlmBaseCustomer slmBaseCustomer = null;
  21. public string SaleOrg
  22. {
  23. get
  24. {
  25. return this.saleOrg;
  26. }
  27. set
  28. {
  29. this.saleOrg = value;
  30. }
  31. }
  32. public string CustUse
  33. {
  34. get
  35. {
  36. return this.custUser;
  37. }
  38. set
  39. {
  40. this.custUser = value;
  41. }
  42. }
  43. private string GetCustomerNoSql()
  44. {
  45. return "";
  46. }
  47. DataSet dsMain = new DataSet();
  48. public string customerNo = "";
  49. public string customerName = "";
  50. public Infragistics.Win.UltraWinGrid.UltraGridRow ugrReturn = null;
  51. public DlgCustChoose(CoreFS.CA06.OpeBase ob)
  52. {
  53. this._ob = ob;
  54. InitializeComponent();
  55. }
  56. private void DlgCustChoose_Load(object sender, EventArgs e)
  57. {
  58. slmBaseCustomer = new Core.StlMes.Client.Sale.SaleFundMgt.FundBLL.InterfaceMgt.SlmBaseCustomer(_ob);
  59. dsMain = base.GetDataSetByColumnName(GetGridDataStruct(), null, GetColumnCaption());
  60. this.ultraGrid1.DataSource = dsMain;
  61. base.SetGridStyle(ref this.ultraGrid1);
  62. base.ResetGridFilterStyle(ref this.ultraGrid1);
  63. HIddenColumn();
  64. Query();
  65. }
  66. private void HIddenColumn()
  67. {
  68. foreach (string s in ReturnHiddenCol())
  69. {
  70. try
  71. {
  72. this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].Hidden = true;
  73. }
  74. catch
  75. {
  76. }
  77. }
  78. }
  79. private string[] ReturnHiddenCol()
  80. {
  81. return new string[] { "CUSTOMER_NO", "USER_GRP",
  82. "ORG", "VALIDFLAG", "CUSTM_USE", "BIGAREA",
  83. "BIGAREANAME",
  84. "REGION_NO",
  85. "REGION_NM", "SALE_ORG",
  86. "CUSTM_USE"};
  87. }
  88. private void Query()
  89. {
  90. DataSet ds = null;
  91. // slmBaseCustomer.GetBaseCustomberInfoBySaleOrgAndCustUse(this.SaleOrg, this.CustUse);
  92. ds = slmBaseCustomer.GetJsBaseCustomberInfo();
  93. if (this.textBox1.Text.Length > 0)
  94. {
  95. ds = Core.StlMes.Client.Sale.Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds,
  96. "CUSTOMER_NM", this.textBox1.Text.Trim());
  97. }
  98. Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsMain, ds);
  99. }
  100. private void Choose()
  101. {
  102. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  103. if (this.ultraGrid1.Rows.Count == 0)
  104. return;
  105. ugr = this.ultraGrid1.ActiveRow;
  106. if (ugr == null)
  107. {
  108. this.DialogResult = DialogResult.Cancel;
  109. return;
  110. }
  111. this.customerNo = ugr.Cells["CUSTOMER_NO"].Value.ToString();
  112. this.customerName = ugr.Cells["CUSTOMER_NM"].Value.ToString();
  113. this.ugrReturn = ugr;
  114. this.DialogResult = DialogResult.OK;
  115. }
  116. private string[] GetGridDataStruct()
  117. {
  118. return new String[]
  119. {
  120. "CUSTOMER_NO",
  121. "CUSTOMER_NM",
  122. "ABRVITION",
  123. "BIGAREA",
  124. "BIGAREANAME",
  125. "REGION_NO",
  126. "REGION_NM",
  127. "USER_GRP",
  128. "ORG",
  129. "PY",
  130. "VALIDFLAG",
  131. "CREATE_TIME",
  132. "CREATE_NAME",
  133. "SALE_ORG",
  134. "CUSTM_USE"
  135. };
  136. }
  137. protected Hashtable GetGridColumnLength()
  138. {
  139. Hashtable hs = new Hashtable();
  140. hs.Add("CUSTOMER_NM", 150);
  141. hs.Add("ABRVITION", 100);
  142. hs.Add("BIGAREA", 100);
  143. hs.Add("CREATE_TIME", 100);
  144. hs.Add("SALE_ORG", 100);
  145. return hs;
  146. }
  147. private Hashtable GetColumnCaption()
  148. {
  149. Hashtable hs = new Hashtable();
  150. foreach (string[] s in GetColumnAndCaptionStr())
  151. {
  152. try
  153. {
  154. if (hs.ContainsKey(s[0]))
  155. {
  156. hs.Remove(s[0]);
  157. }
  158. hs.Add(s[0], s[1]);
  159. }
  160. catch
  161. { }
  162. }
  163. return hs;
  164. }
  165. private List<string[]> GetColumnAndCaptionStr()
  166. {
  167. List<string[]> list = new List<string[]>();
  168. list.Add(new string[] { "CUSTOMER_NO", "客户编号" });
  169. list.Add(new string[] { "CUSTOMER_NM", "客户名称" });
  170. list.Add(new string[] { "BIGAREA", "行政片区" });
  171. list.Add(new string[] { "BIGAREANAME", "行政片区" });
  172. list.Add(new string[] { "REGION_NO", "省市/区域" });
  173. list.Add(new string[] { "REGION_NM", "省市/区域" });
  174. list.Add(new string[] { "USER_GRP", "用户组" });
  175. list.Add(new string[] { "ORG", "机构代码" });
  176. list.Add(new string[] { "PY", "拼音助记" });
  177. list.Add(new string[] { "CREATE_TIME", "创建时间" });
  178. list.Add(new string[] { "SALE_ORG", "销售组织" });
  179. list.Add(new string[] { "CUSTM_USE", "用途" });
  180. list.Add(new string[] { "ABRVITION", "简称" });
  181. return list;
  182. }
  183. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  184. {
  185. if (e.Tool.Key == "Query")
  186. {
  187. this.Query();
  188. }
  189. if (e.Tool.Key == "Exit")
  190. this.Close();
  191. if (e.Tool.Key == "Choose")
  192. this.Choose();
  193. }
  194. }
  195. }