Inheritance: WeifenLuo.WinFormsUI.Docking.DockContent
示例#1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            for (int i = 0; i < frmMain.Main.DockPanelMain.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockCustomer)
                {
                    dockCustomer dc =
                        (dockCustomer)frmMain.Main.DockPanelMain.Contents[i];
                    if (dc.GUID.ToString() == e.Node.Name)
                    {
                        if (!(dc.GUID == Guid.Empty) && 
                            dc.TabText.Substring(5) != 
                             e.Node.Text)
                        {
                            string str = "客户信息-";
                            dc.TabText = str + e.Node.Text;
                        }

                        dc.Focus();
                        dc.GetData();
                        return;
                    }
                }
            }

            dockCustomer dock = new dockCustomer();
            if (!(e.Node.Name == Guid.Empty.ToString()))
            {
                dock.TabText += "-" + e.Node.Text;
            }
            dock.GUID = new Guid(e.Node.Name);
            dock.Show(frmMain.Main.DockPanelMain);
        }
示例#2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            for (int i = 0; i < frmMain.Main.DockPanelMain.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockCustomer)
                {
                    dockCustomer dc =
                        (dockCustomer)frmMain.Main.DockPanelMain.Contents[i];
                    if (dc.GUID.ToString() == e.Node.Name)
                    {
                        if (!(dc.GUID == Guid.Empty) &&
                            dc.TabText.Substring(5) !=
                            e.Node.Text)
                        {
                            string str = "客户信息-";
                            dc.TabText = str + e.Node.Text;
                        }

                        dc.Focus();
                        dc.GetData();
                        return;
                    }
                }
            }

            dockCustomer dock = new dockCustomer();

            if (!(e.Node.Name == Guid.Empty.ToString()))
            {
                dock.TabText += "-" + e.Node.Text;
            }
            dock.GUID = new Guid(e.Node.Name);
            dock.Show(frmMain.Main.DockPanelMain);
        }
示例#3
0
文件: frmMain.cs 项目: rotorliu/demo
        private void tsbCustomer_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.dockPanel1.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockCustomer)
                {
                    dockCustomer dc =
                        (dockCustomer)this.dockPanel1.Contents[i];
                    if (dc.GUID.ToString() == Guid.Empty.ToString())
                    {
                        dc.Focus();
                        dc.GetData();
                        return;
                    }
                }
            }

            dockCustomer dock = new dockCustomer();

            dock.Show(this.dockPanel1);
        }
示例#4
0
文件: frmMain.cs 项目: rotorliu/demo
        /// <summary>
        /// 初始化
        /// </summary>
        private void Init()
        {
            //加载
            _customerGroup.Show(this.dockPanel1);
            dockCustomer customer = new dockCustomer();

            customer.Show(this.dockPanel1);


            //菜单栏
            tsmiAddCustomerGroup.Click += (sender, e) =>
                                          (new frmCustomerGroup()).ShowDialog(this);
            tsmiAddCustomer.Click += (sender, e) =>
                                     (new frmCustomer()).ShowDialog(this);
            tsmiAddService.Click += (sender, e) =>
                                    (new frmService()).ShowDialog(this);

            //报表菜单
            tsmiReportCustomerInfo.Click += (sender, e) =>
                                            (new frmPrint(GetReport <rptCustomerInfo>("Customer", ""))).ShowDialog(this);
            tsmiReportCustomerPie.Click += (sender, e) =>
                                           (new frmPrint(GetReport <rptCustomerPie>("Customer", ""))).ShowDialog(this);
            tsmiReportServiceInfo.Click += (sender, e) =>
                                           (new frmPrint(GetReport <rptServiceInfo>("Service", ""))).ShowDialog(this);
            tsmiReportServiceMonth.Click += (sender, e) =>
            {
                rptServiceMonth rpt = (rptServiceMonth)GetReport <rptServiceMonth>("Service", "DATEDIFF(MONTH, '" + DateTime.Now + "', 受理时间) = 0");
                //设置月份
                TextObject obj = (TextObject)rpt.Section1.ReportObjects["Text1"];
                obj.Text = DateTime.Now.ToString("yyyy年MM月");
                frmPrint frm = new frmPrint(rpt);
                frm.ShowDialog(this);
            };
            tsmiReportServiceTotal.Click += (sender, e) =>
                                            (new frmPrint(GetReport <rptServiceTotal>("Service", ""))).ShowDialog(this);

            tsmiOption.Click += (sender, e) =>
                                (new frmOption()).ShowDialog(this);


            //状态栏时间
            tmr.Tick += (sender, e) => tsslblTime.Text =
                DateTime.Now.ToString("当前时间:yyyy-MM-dd HH:mm:ss");
            tmr.Start();

            //工具栏、客户组、状态栏隐藏和现实
            tsmiTools.Click += (sender, e) =>
                               toolStrip1.Visible = tsmiTools.Checked;

            tsmiCustomerGroup.Click += (sender, e) =>
                                       _customerGroup.IsHidden = !tsmiCustomerGroup.Checked;

            _customerGroup.VisibleChanged += (sender, e) =>
                                             tsmiCustomerGroup.Checked = !_customerGroup.IsHidden;

            tsmiStatus.Click += (sender, e) =>
                                statusStrip1.Visible = tsmiStatus.Checked;
            //搜索故障解决方案效果
            tstSulotion.Enter += (sender, e) =>
            {
                if (tstSulotion.ForeColor == Color.Gray)
                {
                    tstSulotion.Text      = string.Empty;
                    tstSulotion.ForeColor = Color.Black;
                }
            };
            tstSulotion.Leave += (sender, e) =>
            {
                if (tstSulotion.Text.Trim().Length == 0)
                {
                    tstSulotion.Text      = "在此输入故障现象";
                    tstSulotion.ForeColor = Color.Gray;
                }
            };

            //加载布局
            //string path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"xml\DockPanel.xml ");

            //if (File.Exists(path))
            //{
            //    dockPanel1.LoadFromXml(path, persistString =>
            //    {
            //        if (persistString ==
            //            typeof(dockCustomerGroup).ToString())
            //        {
            //            return _customerGroup;
            //        }
            //        else
            //        {
            //            return null;
            //        }
            //    });
            //}
        }
示例#5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();

            if (string.IsNullOrEmpty(this.txtNO.Text.Trim()))
            {
                errorProvider1.SetError(txtNO, "客户编号不能为空!");
                return;
            }

            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                errorProvider1.SetError(txtName, "客户名称不能为空!");
                return;
            }

            if (!this.cbxCustomerGroup.ValidateText())
            {
                errorProvider1.SetError(cbxCustomerGroup,
                                        "必须选择所属客户组!");
                return;
            }

            BLL.Customer   bll   = new BLL.Customer();
            Model.Customer model = new Model.Customer();
            model.cNO        = txtNO.Text.Substring(txtNO.Text.Length - 4);
            model.cName      = txtName.Text.Trim();
            model.parentGUID = new Guid(this.cbxCustomerGroup.SelectedNode.Name);
            if (cbxIsGov.Text != "政府")
            {
                model.isGov = false;
            }
            else
            {
                model.isGov = true;
            }
            model.trade    = txtTrade.Text.Trim();
            model.cMan     = txtMan.Text.Trim();
            model.Tel      = txtTel.Text.Trim();
            model.fax      = txtFax.Text.Trim();
            model.email    = txtEmail.Text.Trim();
            model.province = cbxProvince.Text;
            model.city     = cbxCity.Text;
            model.district = cbxDistrict.Text;
            model.QQ       = txtQQ.Text.Trim();
            model.mode     = txtMode.Text.Trim();
            model.scope    = txtScope.Text.Trim();
            model.product  = txtProduct.Text.Trim();
            model.addresss = txtAddress.Text.Trim();
            model.cStage   = cbxStage.Text;
            model.cType    = cbxType.Text;
            model.cLevel   = cbxLevel.Text;
            model.cStatus  = cbxStatus.Text;
            model.link1    = txtLink1.Text.Trim();
            model.tel1     = txtTel1.Text.Trim();
            model.link2    = txtLink2.Text.Trim();
            model.tel2     = txtTel2.Text.Trim();

            bool flg = false;

            try
            {
                if (this.Text == "新增客户信息")
                {
                    flg = bll.Add(model);
                }
                else
                {
                    model.GUID = _model.GUID;
                    flg        = bll.Update(model);
                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                MessageBox.Show("系统出错,请重试!");
                return;
            }

            if (flg)
            {
                MessageBox.Show("操作成功!");
            }
            else
            {
                MessageBox.Show("操作失败!");
            }

            if (((Control)sender).Name == "btnSave")
            {
                this.Close();
                this.Dispose();
                frmCustomer frm = new frmCustomer(_guid);
                frm.ShowDialog(frmMain.Main);
            }
            else
            {
                this.Close();
            }

            //刷新激活的窗体
            for (int i = 0; i < frmMain.Main.DockPanelMain.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i]
                    is dockCustomer)
                {
                    dockCustomer dock = (dockCustomer)
                                        frmMain.Main.DockPanelMain.Contents[i];
                    dock.GetData();
                }
            }
        }