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); }
private void llblAddService_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { frmService frm = new frmService(_model.GUID); frm.ShowDialog(frmMain.Main); }
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(); } } }
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(); } } }