OnSingleFirstFormMain.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Dynamic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.DoorCityProcess
  11. {
  12. public partial class OnSingleFirstFormMain : LYFZ.Software.UI.DoorCityProcess.OnSingleFirstFormMain
  13. {
  14. public OnSingleFirstFormMain()
  15. {
  16. this.Load += OnSingleFirstFormMain_Load;
  17. this.btnWedding.Click += btnWedding_Click;
  18. this.btnChild.Click += btnChild_Click;
  19. this.btnPortrait.Click += btnPortrait_Click;
  20. this.btnService.Click += btnService_Click;
  21. this.btnWeddingCelebration.Click += btnWeddingCelebration_Click;
  22. this.FormClosed += OnSingleFirstFormMain_FormClosed;
  23. #region
  24. ////方法1,有子级需要转KeyValuePair<string, object>然后再转换为Dictionary<string, object>
  25. //LYFZ.BLL.BLL_ErpCustomersTrackRecord bll = new BLL.BLL_ErpCustomersTrackRecord();
  26. //LYFZ.Command.Result<dynamic> ResultList = (LYFZ.Command.Result<dynamic>)bll.GetCallCenterGouTongType();
  27. //string StrII = "";
  28. //foreach (dynamic item in ResultList.Data)
  29. //{
  30. // System.Collections.Generic.KeyValuePair<string, object> dyc = item;
  31. // dynamic dys = (dynamic)dyc.Value;
  32. // StrII += dys.GouTongType + ":";
  33. // dynamic dyss = (dynamic)dys.GouTongList;
  34. // Dictionary<string, object> dyc2 = dyss;
  35. // foreach (dynamic items in dyc2.Values)
  36. // {
  37. // StrII += items.ItemCode + "-" + items.ItemText + ",";
  38. // }
  39. // StrII += "\r\n";
  40. //}
  41. //MessageBox.Show(StrII);
  42. ////方法2,无子级直接获取动态库值
  43. //LYFZ.BLL.BLL_ErpCustomersTrackRecord bll = new BLL.BLL_ErpCustomersTrackRecord();
  44. //LYFZ.Command.Result<dynamic> ResultList = (LYFZ.Command.Result<dynamic>)bll.GetCallCenterGouTongMethod();
  45. //string StrII = "";
  46. //foreach (dynamic item in ResultList.Data)
  47. //{
  48. // StrII += item.GouTongMethod + ",";
  49. //}
  50. //MessageBox.Show(StrII);
  51. ////方法3,综合以上两种,判断是否有子级
  52. //LYFZ.BLL.BLL_ErpCustomersTrackRecord bll = new BLL.BLL_ErpCustomersTrackRecord();
  53. //LYFZ.Command.Result<dynamic> ResultList = (LYFZ.Command.Result<dynamic>)bll.GetCallCenterGouTongType();
  54. //string StrII = "";
  55. //foreach (dynamic item in ResultList.Data)
  56. //{
  57. // string strD = item.GetType().Name;
  58. // if (strD.IndexOf("KeyValuePair") != -1)
  59. // {
  60. // System.Collections.Generic.KeyValuePair<string, object> dyc = item;
  61. // dynamic dys = (dynamic)dyc.Value;
  62. // StrII += dys.GouTongType + ":";
  63. // dynamic dyss = (dynamic)dys.GouTongList;
  64. // //string strD = item.GetType().Name;//获取动态库item的类型是需要转换成为KeyValuePair还是转换为Dictionary
  65. // //if (strD.IndexOf("KeyValuePair") != -1)
  66. // //{
  67. // // System.Collections.Generic.KeyValuePair<string, object> dycs = dyss;
  68. // //}
  69. // //else
  70. // //{ Dictionary<string, object> dycss = dyss; }
  71. // Dictionary<string, object> dyc2 = dyss;
  72. // foreach (dynamic items in dyc2.Values)
  73. // {
  74. // StrII += items.ItemCode + "-" + items.ItemText + ",";
  75. // }
  76. // StrII += "\r\n";
  77. // }
  78. // else
  79. // {
  80. // StrII += item.GouTongMethod + ",";
  81. // }
  82. //}
  83. //MessageBox.Show(StrII);
  84. #endregion
  85. }
  86. /// <summary>
  87. /// 是否为外部调用
  88. /// </summary>
  89. public bool IsExternalCalls = false;
  90. string _StrNumber = "";
  91. /// <summary>
  92. /// 订单号
  93. /// </summary>
  94. public string StrNumber {
  95. set { _StrNumber = value; }
  96. get { return _StrNumber; }
  97. }
  98. /// <summary>
  99. /// 是否保存
  100. /// </summary>
  101. public bool IsSaveed = false;
  102. /// <summary>
  103. /// 是否要跳转界面
  104. /// </summary>
  105. bool IsGoForm = false;
  106. /// <summary>
  107. /// 是否显示写真版
  108. /// </summary>
  109. private bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
  110. LYFZ.EnumPublic.OrderType OrdType;
  111. /// <summary>
  112. /// 窗体加载
  113. /// </summary>
  114. /// <param name="sender"></param>
  115. /// <param name="e"></param>
  116. void OnSingleFirstFormMain_Load(object sender, EventArgs e)
  117. {
  118. this.btnWedding.Visible = false;
  119. this.btnChild.Visible = false;
  120. this.btnPortrait.Visible = false;
  121. this.btnService.Visible = false;
  122. this.btnWeddingCelebration.Visible = false;
  123. int HodeCount = 0;
  124. switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
  125. {
  126. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版:
  127. this.btnWedding.Visible = true;
  128. this.btnChild.Visible = true;
  129. if (IsPortrait)
  130. { this.btnPortrait.Visible = true; }
  131. this.btnService.Visible = true;
  132. this.btnWeddingCelebration.Visible = true;
  133. break;
  134. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
  135. this.btnWedding.Visible = true;
  136. this.btnWeddingCelebration.Visible = true;
  137. if (IsPortrait)
  138. { this.btnPortrait.Visible = true; }
  139. this.btnService.Visible = true;
  140. HodeCount++;
  141. break;
  142. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
  143. this.btnChild.Visible = true;
  144. if (IsPortrait)
  145. { this.btnPortrait.Visible = true; }
  146. this.btnService.Visible = true;
  147. HodeCount++;
  148. break;
  149. }
  150. if (!IsPortrait)
  151. { HodeCount++; }
  152. if (HodeCount > 0)
  153. { this.Width -= (this.btnWeddingCelebration.Width * HodeCount); }
  154. }
  155. /// <summary>
  156. /// 子窗体关闭后刷新父窗体
  157. /// </summary>
  158. public void RefreshParentForm()
  159. {
  160. this.IsGoForm = false;
  161. this.Close();
  162. }
  163. /// <summary>
  164. /// 婚纱
  165. /// </summary>
  166. /// <param name="sender"></param>
  167. /// <param name="e"></param>
  168. void btnWedding_Click(object sender, EventArgs e)
  169. {
  170. this.Hide();
  171. this.OrdType = EnumPublic.OrderType.婚纱订单;
  172. this.IsGoForm = true;
  173. this.Close();
  174. }
  175. /// <summary>
  176. /// 儿童
  177. /// </summary>
  178. /// <param name="sender"></param>
  179. /// <param name="e"></param>
  180. void btnChild_Click(object sender, EventArgs e)
  181. {
  182. this.Hide();
  183. this.OrdType = EnumPublic.OrderType.儿童订单;
  184. this.IsGoForm = true;
  185. this.Close();
  186. }
  187. /// <summary>
  188. /// 写真
  189. /// </summary>
  190. /// <param name="sender"></param>
  191. /// <param name="e"></param>
  192. void btnPortrait_Click(object sender, EventArgs e)
  193. {
  194. this.Hide();
  195. this.OrdType = EnumPublic.OrderType.写真订单;
  196. this.IsGoForm = true;
  197. this.Close();
  198. }
  199. /// <summary>
  200. /// 服务
  201. /// </summary>
  202. /// <param name="sender"></param>
  203. /// <param name="e"></param>
  204. void btnService_Click(object sender, EventArgs e)
  205. {
  206. this.Hide();
  207. this.OrdType = EnumPublic.OrderType.服务订单;
  208. this.IsGoForm = true;
  209. this.Close();
  210. }
  211. /// <summary>
  212. /// 婚庆
  213. /// </summary>
  214. /// <param name="sender"></param>
  215. /// <param name="e"></param>
  216. void btnWeddingCelebration_Click(object sender, EventArgs e)
  217. {
  218. this.Hide();
  219. this.OrdType = EnumPublic.OrderType.婚庆订单;
  220. this.IsGoForm = true;
  221. this.Close();
  222. }
  223. /// <summary>
  224. /// 窗体关闭后发生事件
  225. /// </summary>
  226. /// <param name="sender"></param>
  227. /// <param name="e"></param>
  228. void OnSingleFirstFormMain_FormClosed(object sender, FormClosedEventArgs e)
  229. {
  230. if (IsGoForm)
  231. {
  232. //#if DEBUG
  233. OpenNewOrder(OrdType);
  234. //#else
  235. // OpenOnSingleFormMain01(OrdType);
  236. //#endif
  237. }
  238. }
  239. /// <summary>
  240. /// 新版开单界面
  241. /// </summary>
  242. /// <param name="orderType"></param>
  243. void OpenNewOrder(EnumPublic.OrderType orderType)
  244. {
  245. frmNewOrder newOrder = new frmNewOrder();
  246. //测试打开订单
  247. //if (orderType == EnumPublic.OrderType.儿童订单)
  248. //{
  249. // newOrder.OrderNumber = "RT17111400003";
  250. //}
  251. //else if (orderType == EnumPublic.OrderType.婚纱订单)
  252. //{
  253. // newOrder.OrderNumber = "HS17051700005";
  254. //}
  255. newOrder.IsShowUcNavigationTool = false;
  256. newOrder.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  257. newOrder.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  258. newOrder.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  259. newOrder.OrderType = orderType;
  260. if (this.IsExternalCalls)
  261. {
  262. if (newOrder.ShowDialog() == DialogResult.OK)
  263. {
  264. this.IsSaveed = true;
  265. this.StrNumber = newOrder.OrderNumber;
  266. }
  267. }
  268. else
  269. {
  270. newOrder.Show();
  271. }
  272. }
  273. /// <summary>
  274. /// 旧版开单界面
  275. /// </summary>
  276. /// <param name="orderType"></param>
  277. void OpenOnSingleFormMain01(EnumPublic.OrderType orderType)
  278. {
  279. LYFZ.Software.MainBusiness.DoorCityProcess.OnSingleFormMain01 frm = new OnSingleFormMain01();
  280. frm.EnumLoadFormType = OnSingleFormMain01.LoadFormType.开单选择;
  281. frm.OrdType = OrdType;
  282. frm.IsShowUcNavigationTool = false;
  283. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  284. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  285. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  286. if (this.IsExternalCalls)
  287. {
  288. frm.ShowDialog();
  289. if (frm.IsSaveed)
  290. {
  291. IsSaveed = frm.IsSaveed;
  292. this.StrNumber = frm.StrNumber;
  293. }
  294. }
  295. else
  296. { frm.Show(); }
  297. }
  298. }
  299. }