Esempio n. 1
0
        public frmService(Model.Service model)
        {
            InitializeComponent();
            BLL.Service   bllService   = new BLL.Service();
            Model.Service modelService = bllService.GetModel(model.GUID);

            _model = modelService;
            _guid  = _model.customer;
        }
Esempio n. 2
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            Model.Service model = new Model.Service();
            model.GUID = new Guid(this.dataGridView1[0,
                this.dataGridView1.CurrentRow.Index].Value.ToString());
            frmService frm = new frmService(model);
            frm.ShowDialog(frmMain.Main);
        }
Esempio n. 3
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            Model.Service model = new Model.Service();
            model.GUID = new Guid(this.dataGridView1[0,
                                                     this.dataGridView1.CurrentRow.Index].Value.ToString());
            frmService frm = new frmService(model);

            frm.ShowDialog(frmMain.Main);
        }
Esempio n. 4
0
        /// <summary>
        /// 修改信息初始化
        /// </summary>
        private void GetUpdate()
        {
            this.Text = "编辑服务记录";
            BLL.Service   bll   = new BLL.Service();
            Model.Service model = bll.GetModel(_model.GUID);

            //赋值
            BLL.Argument bllArgument = new BLL.Argument();
            DataTable    dt          = bllArgument.GetList("type = '服务编号'").Tables[0];

            string str = dt.Rows[0][1].ToString();

            txtNO.Text      = str + model.sNO;
            dtpAccept.Value = model.acceptDate ?? DateTime.Now;

            if (_guid != Guid.Empty)
            {
                GetCustomerGroupAndSelected(_guid);
            }
            cbxType.Text = model.type;

            //服务内容
            if (!string.IsNullOrEmpty(model.content) &&
                model.content.Contains('ス'))
            {
                string[] content = model.content.Split('ス');

                if (content.Length == 2)
                {
                    txtFault.Text    = content[0];
                    txtSolution.Text = content[1];
                }
            }

            txtResult.Text        = model.result;
            cbxEvaluate.Text      = model.evaluate;
            txtMaterial.Text      = model.material;
            txtMaterialMoney.Text =
                string.Format("{0:F2}", model.materialMoney);
            txtServiceMoney.Text =
                string.Format("{0:F2}", model.serviceMoney);
            txtSum.Text =
                string.Format("{0:F2}",
                              model.materialMoney + model.serviceMoney);
            cbxPayStatus.Text = model.payStatus;
            dtpSolution.Value = model.solutionDate ?? DateTime.Now;
            cbxTraffic.Text   = model.traffic;
            cbxEmployee.Text  = model.employee;
        }
Esempio n. 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.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();
                }
            }
        }
Esempio n. 6
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();
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <CustomerService.Model.Service> DataTableToList(DataTable dt)
        {
            List <CustomerService.Model.Service> modelList = new List <CustomerService.Model.Service>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                CustomerService.Model.Service model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CustomerService.Model.Service();
                    if (dt.Rows[n]["GUID"] != null && dt.Rows[n]["GUID"].ToString() != "")
                    {
                        model.GUID = new Guid(dt.Rows[n]["GUID"].ToString());
                    }
                    if (dt.Rows[n]["sNO"] != null && dt.Rows[n]["sNO"].ToString() != "")
                    {
                        model.sNO = dt.Rows[n]["sNO"].ToString();
                    }
                    if (dt.Rows[n]["customer"] != null && dt.Rows[n]["customer"].ToString() != "")
                    {
                        model.customer = new Guid(dt.Rows[n]["customer"].ToString());
                    }
                    if (dt.Rows[n]["acceptDate"] != null && dt.Rows[n]["acceptDate"].ToString() != "")
                    {
                        model.acceptDate = DateTime.Parse(dt.Rows[n]["acceptDate"].ToString());
                    }
                    if (dt.Rows[n]["solutionDate"] != null && dt.Rows[n]["solutionDate"].ToString() != "")
                    {
                        model.solutionDate = DateTime.Parse(dt.Rows[n]["solutionDate"].ToString());
                    }
                    if (dt.Rows[n]["type"] != null && dt.Rows[n]["type"].ToString() != "")
                    {
                        model.type = dt.Rows[n]["type"].ToString();
                    }
                    if (dt.Rows[n]["content"] != null && dt.Rows[n]["content"].ToString() != "")
                    {
                        model.content = dt.Rows[n]["content"].ToString();
                    }
                    if (dt.Rows[n]["result"] != null && dt.Rows[n]["result"].ToString() != "")
                    {
                        model.result = dt.Rows[n]["result"].ToString();
                    }
                    if (dt.Rows[n]["evaluate"] != null && dt.Rows[n]["evaluate"].ToString() != "")
                    {
                        model.evaluate = dt.Rows[n]["evaluate"].ToString();
                    }
                    if (dt.Rows[n]["material"] != null && dt.Rows[n]["material"].ToString() != "")
                    {
                        model.material = dt.Rows[n]["material"].ToString();
                    }
                    if (dt.Rows[n]["materialMoney"] != null && dt.Rows[n]["materialMoney"].ToString() != "")
                    {
                        model.materialMoney = decimal.Parse(dt.Rows[n]["materialMoney"].ToString());
                    }
                    if (dt.Rows[n]["serviceMoney"] != null && dt.Rows[n]["serviceMoney"].ToString() != "")
                    {
                        model.serviceMoney = decimal.Parse(dt.Rows[n]["serviceMoney"].ToString());
                    }
                    if (dt.Rows[n]["payStatus"] != null && dt.Rows[n]["payStatus"].ToString() != "")
                    {
                        model.payStatus = dt.Rows[n]["payStatus"].ToString();
                    }
                    if (dt.Rows[n]["traffic"] != null && dt.Rows[n]["traffic"].ToString() != "")
                    {
                        model.traffic = dt.Rows[n]["traffic"].ToString();
                    }
                    if (dt.Rows[n]["employee"] != null && dt.Rows[n]["employee"].ToString() != "")
                    {
                        model.employee = dt.Rows[n]["employee"].ToString();
                    }
                    if (dt.Rows[n]["createDate"] != null && dt.Rows[n]["createDate"].ToString() != "")
                    {
                        model.createDate = DateTime.Parse(dt.Rows[n]["createDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CustomerService.Model.Service model)
 {
     return(dal.Update(model));
 }
Esempio n. 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(CustomerService.Model.Service model)
 {
     return(dal.Add(model));
 }