Beispiel #1
0
        private void tsbService_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.dockPanel1.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockService)
                {
                    dockService dc =
                        (dockService)this.dockPanel1.Contents[i];
                    if (dc.GUID.ToString() == Guid.Empty.ToString())
                    {
                        dc.Focus();
                        dc.GetData();
                        return;
                    }
                }
            }

            dockService dock = new dockService();

            dock.Show(this.dockPanel1);
        }
Beispiel #2
0
        private void llblService_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Close();

            for (int i = 0; i < frmMain.Main.DockPanelMain.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockService)
                {
                    dockService dc =
                        (dockService)frmMain.Main.DockPanelMain.Contents[i];
                    if (dc.GUID == _model.GUID)
                    {
                        if (!(dc.GUID == Guid.Empty) &&
                            dc.TabText.Substring(5) !=
                            txtName.Text.Trim())
                        {
                            string str = "客户信息-";
                            dc.TabText = str + txtName.Text.Trim();
                        }

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

            dockService dock = new dockService();

            if (!(_model.GUID == Guid.Empty))
            {
                dock.TabText += "-" + txtName.Text.Trim();
            }
            dock.GUID = _model.GUID;
            dock.Show(frmMain.Main.DockPanelMain);
        }
Beispiel #3
0
        private void llblService_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Close();

            for (int i = 0; i < frmMain.Main.DockPanelMain.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockService)
                {
                    dockService dc =
                        (dockService)frmMain.Main.DockPanelMain.Contents[i];
                    if (dc.GUID == _model.GUID)
                    {
                        if (!(dc.GUID == Guid.Empty) &&
                            dc.TabText.Substring(5) !=
                             txtName.Text.Trim())
                        {
                            string str = "客户信息-";
                            dc.TabText = str + txtName.Text.Trim();
                        }

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

            dockService dock = new dockService();
            if (!(_model.GUID == Guid.Empty))
            {
                dock.TabText += "-" + txtName.Text.Trim();
            }
            dock.GUID = _model.GUID;
            dock.Show(frmMain.Main.DockPanelMain);
        }
Beispiel #4
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.cbxName.Text.Trim()))
            {
                errorProvider1.SetError(cbxName, "客户名称不能为空!");
                return;
            }

            BLL.Service   bll   = new BLL.Service();
            Model.Service model = new Model.Service();
            model.sNO          = txtNO.Text.Substring(txtNO.Text.Length - 4);
            model.customer     = new Guid(cbxName.SelectedValue.ToString());
            model.acceptDate   = dtpAccept.Value;
            model.solutionDate = dtpSolution.Value;
            model.type         = cbxType.Text;
            model.content      = txtFault.Text.Trim() + "ス" +
                                 txtSolution.Text.Trim();
            model.result   = txtResult.Text.Trim();
            model.evaluate = cbxEvaluate.Text;
            model.material = txtMaterial.Text.Trim();

            decimal material = 0;

            if (string.IsNullOrEmpty(txtMaterialMoney.Text.Trim()) || decimal.TryParse(txtMaterialMoney.Text.Trim(),
                                                                                       out material))
            {
                model.materialMoney = material;
            }
            else
            {
                errorProvider1.SetError(txtMaterialMoney,
                                        "请输入正确的金额!");
                return;
            }

            decimal service = 0;

            if (string.IsNullOrEmpty(txtServiceMoney.Text.Trim()) || decimal.TryParse(txtServiceMoney.Text.Trim(),
                                                                                      out service))
            {
                model.serviceMoney = service;
            }
            else
            {
                errorProvider1.SetError(txtServiceMoney,
                                        "请输入正确的金额!");
                return;
            }

            model.payStatus = cbxPayStatus.Text;
            model.traffic   = cbxTraffic.Text;
            model.employee  = cbxEmployee.Text;

            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();
                frmService frm = new frmService(_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 dockService)
                {
                    dockService dock = (dockService)
                                       frmMain.Main.DockPanelMain.Contents[i];
                    dock.GetData();
                }
            }
        }