DlgSelectBuyer.cs 6.4 KB

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