using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Dynamic; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.DoorCityProcess { public partial class OnSingleFirstFormMain : LYFZ.Software.UI.DoorCityProcess.OnSingleFirstFormMain { public OnSingleFirstFormMain() { this.Load += OnSingleFirstFormMain_Load; this.btnWedding.Click += btnWedding_Click; this.btnChild.Click += btnChild_Click; this.btnPortrait.Click += btnPortrait_Click; this.btnService.Click += btnService_Click; this.btnWeddingCelebration.Click += btnWeddingCelebration_Click; this.FormClosed += OnSingleFirstFormMain_FormClosed; #region ////方法1,有子级需要转KeyValuePair然后再转换为Dictionary //LYFZ.BLL.BLL_ErpCustomersTrackRecord bll = new BLL.BLL_ErpCustomersTrackRecord(); //LYFZ.Command.Result ResultList = (LYFZ.Command.Result)bll.GetCallCenterGouTongType(); //string StrII = ""; //foreach (dynamic item in ResultList.Data) //{ // System.Collections.Generic.KeyValuePair dyc = item; // dynamic dys = (dynamic)dyc.Value; // StrII += dys.GouTongType + ":"; // dynamic dyss = (dynamic)dys.GouTongList; // Dictionary dyc2 = dyss; // foreach (dynamic items in dyc2.Values) // { // StrII += items.ItemCode + "-" + items.ItemText + ","; // } // StrII += "\r\n"; //} //MessageBox.Show(StrII); ////方法2,无子级直接获取动态库值 //LYFZ.BLL.BLL_ErpCustomersTrackRecord bll = new BLL.BLL_ErpCustomersTrackRecord(); //LYFZ.Command.Result ResultList = (LYFZ.Command.Result)bll.GetCallCenterGouTongMethod(); //string StrII = ""; //foreach (dynamic item in ResultList.Data) //{ // StrII += item.GouTongMethod + ","; //} //MessageBox.Show(StrII); ////方法3,综合以上两种,判断是否有子级 //LYFZ.BLL.BLL_ErpCustomersTrackRecord bll = new BLL.BLL_ErpCustomersTrackRecord(); //LYFZ.Command.Result ResultList = (LYFZ.Command.Result)bll.GetCallCenterGouTongType(); //string StrII = ""; //foreach (dynamic item in ResultList.Data) //{ // string strD = item.GetType().Name; // if (strD.IndexOf("KeyValuePair") != -1) // { // System.Collections.Generic.KeyValuePair dyc = item; // dynamic dys = (dynamic)dyc.Value; // StrII += dys.GouTongType + ":"; // dynamic dyss = (dynamic)dys.GouTongList; // //string strD = item.GetType().Name;//获取动态库item的类型是需要转换成为KeyValuePair还是转换为Dictionary // //if (strD.IndexOf("KeyValuePair") != -1) // //{ // // System.Collections.Generic.KeyValuePair dycs = dyss; // //} // //else // //{ Dictionary dycss = dyss; } // Dictionary dyc2 = dyss; // foreach (dynamic items in dyc2.Values) // { // StrII += items.ItemCode + "-" + items.ItemText + ","; // } // StrII += "\r\n"; // } // else // { // StrII += item.GouTongMethod + ","; // } //} //MessageBox.Show(StrII); #endregion } /// /// 是否为外部调用 /// public bool IsExternalCalls = false; string _StrNumber = ""; /// /// 订单号 /// public string StrNumber { set { _StrNumber = value; } get { return _StrNumber; } } /// /// 是否保存 /// public bool IsSaveed = false; /// /// 是否要跳转界面 /// bool IsGoForm = false; /// /// 是否显示写真版 /// private bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition; LYFZ.EnumPublic.OrderType OrdType; /// /// 窗体加载 /// /// /// void OnSingleFirstFormMain_Load(object sender, EventArgs e) { this.btnWedding.Visible = false; this.btnChild.Visible = false; this.btnPortrait.Visible = false; this.btnService.Visible = false; this.btnWeddingCelebration.Visible = false; int HodeCount = 0; switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType()) { case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版: this.btnWedding.Visible = true; this.btnChild.Visible = true; if (IsPortrait) { this.btnPortrait.Visible = true; } this.btnService.Visible = true; this.btnWeddingCelebration.Visible = true; break; case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版: this.btnWedding.Visible = true; this.btnWeddingCelebration.Visible = true; if (IsPortrait) { this.btnPortrait.Visible = true; } this.btnService.Visible = true; HodeCount++; break; case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版: this.btnChild.Visible = true; if (IsPortrait) { this.btnPortrait.Visible = true; } this.btnService.Visible = true; HodeCount++; break; } if (!IsPortrait) { HodeCount++; } if (HodeCount > 0) { this.Width -= (this.btnWeddingCelebration.Width * HodeCount); } } /// /// 子窗体关闭后刷新父窗体 /// public void RefreshParentForm() { this.IsGoForm = false; this.Close(); } /// /// 婚纱 /// /// /// void btnWedding_Click(object sender, EventArgs e) { this.Hide(); this.OrdType = EnumPublic.OrderType.婚纱订单; this.IsGoForm = true; this.Close(); } /// /// 儿童 /// /// /// void btnChild_Click(object sender, EventArgs e) { this.Hide(); this.OrdType = EnumPublic.OrderType.儿童订单; this.IsGoForm = true; this.Close(); } /// /// 写真 /// /// /// void btnPortrait_Click(object sender, EventArgs e) { this.Hide(); this.OrdType = EnumPublic.OrderType.写真订单; this.IsGoForm = true; this.Close(); } /// /// 服务 /// /// /// void btnService_Click(object sender, EventArgs e) { this.Hide(); this.OrdType = EnumPublic.OrderType.服务订单; this.IsGoForm = true; this.Close(); } /// /// 婚庆 /// /// /// void btnWeddingCelebration_Click(object sender, EventArgs e) { this.Hide(); this.OrdType = EnumPublic.OrderType.婚庆订单; this.IsGoForm = true; this.Close(); } /// /// 窗体关闭后发生事件 /// /// /// void OnSingleFirstFormMain_FormClosed(object sender, FormClosedEventArgs e) { if (IsGoForm) { //#if DEBUG OpenNewOrder(OrdType); //#else // OpenOnSingleFormMain01(OrdType); //#endif } } /// /// 新版开单界面 /// /// void OpenNewOrder(EnumPublic.OrderType orderType) { frmNewOrder newOrder = new frmNewOrder(); //测试打开订单 //if (orderType == EnumPublic.OrderType.儿童订单) //{ // newOrder.OrderNumber = "RT17111400003"; //} //else if (orderType == EnumPublic.OrderType.婚纱订单) //{ // newOrder.OrderNumber = "HS17051700005"; //} newOrder.IsShowUcNavigationTool = false; newOrder.StartPosition = System.Windows.Forms.FormStartPosition.Manual; newOrder.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y); newOrder.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height); newOrder.OrderType = orderType; if (this.IsExternalCalls) { if (newOrder.ShowDialog() == DialogResult.OK) { this.IsSaveed = true; this.StrNumber = newOrder.OrderNumber; } } else { newOrder.Show(); } } /// /// 旧版开单界面 /// /// void OpenOnSingleFormMain01(EnumPublic.OrderType orderType) { LYFZ.Software.MainBusiness.DoorCityProcess.OnSingleFormMain01 frm = new OnSingleFormMain01(); frm.EnumLoadFormType = OnSingleFormMain01.LoadFormType.开单选择; frm.OrdType = OrdType; frm.IsShowUcNavigationTool = false; frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual; frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y); frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height); if (this.IsExternalCalls) { frm.ShowDialog(); if (frm.IsSaveed) { IsSaveed = frm.IsSaveed; this.StrNumber = frm.StrNumber; } } else { frm.Show(); } } } }