private void btnSave_Click(object sender, EventArgs e) { int intRelId; string strCode = null; if (cbxRelManner.SelectedValue == null) { MessageBox.Show("联系方式不许为空!", "软件提示"); cbxRelManner.Focus(); return; } if (String.IsNullOrEmpty(txtLinkman.Text.Trim())) { MessageBox.Show("联系人不许为空!", "软件提示"); txtLinkman.Focus(); return; } if (String.IsNullOrEmpty(rtbRelContent.Text.Trim())) { MessageBox.Show("联系内容不许为空!", "软件提示"); rtbRelContent.Focus(); return; } if (this.Tag.ToString() == "Add") { //添加参数 ParametersAddValue(); strCode = "INSERT INTO CURelRecord(CustomerCode,RelDate,RelManner,Linkman,TelephoneCode,NextDate,RelContent,FeeInfo) "; strCode += "VALUES(@CustomerCode,@RelDate,@RelManner,@Linkman,@TelephoneCode,@NextDate,@RelContent,@FeeInfo)"; if (db.ExecDataBySql(strCode) > 0) { MessageBox.Show("保存成功!", "软件提示"); } else { MessageBox.Show("保存失败!", "软件提示"); } } if (this.Tag.ToString() == "Edit") { intRelId = Convert.ToInt32(formCustomerCourse.dgvRel["RelId", formCustomerCourse.dgvRel.CurrentRow.Index].Value); //添加参数 ParametersAddValue(); strCode = "UPDATE CURelRecord SET CustomerCode=@CustomerCode,RelDate=@RelDate,RelManner = @RelManner,Linkman = @Linkman,TelephoneCode = @TelephoneCode,NextDate = @NextDate,RelContent = @RelContent,FeeInfo = @FeeInfo "; strCode += "WHERE RelId = " + intRelId; if (db.ExecDataBySql(strCode) > 0) { MessageBox.Show("保存成功!", "软件提示"); } else { MessageBox.Show("保存失败!", "软件提示"); } } formCustomerCourse.BindDataGridView(formCustomerCourse.tvCustomer.SelectedNode.Tag.ToString(), "CURelRecord", formCustomerCourse.dgvRel); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { int intAfterId; string strCode = null; if (cbxEmployeeCode.SelectedValue == null) { MessageBox.Show("服务人员不许为空!", "软件提示"); cbxEmployeeCode.Focus(); return; } if (String.IsNullOrEmpty(txtSerDays.Text.Trim())) { MessageBox.Show("服务天数不许为空!", "软件提示"); txtSerDays.Focus(); return; } else { if (Convert.ToInt32(txtSerDays.Text.Trim()) == 0) { MessageBox.Show("服务天数不许为零!", "软件提示"); txtSerDays.Focus(); return; } } if (String.IsNullOrEmpty(rtbSerContent.Text.Trim())) { MessageBox.Show("服务内容不许为空!", "软件提示"); rtbSerContent.Focus(); return; } if (String.IsNullOrEmpty(rtbResolvent.Text.Trim())) { MessageBox.Show("解决方案不许为空!", "软件提示"); rtbResolvent.Focus(); return; } if (this.Tag.ToString() == "Add") { //添加参数 ParametersAddValue(); strCode = "INSERT INTO CUAfterService(CustomerCode,SerDate,EmployeeCode,Linkman,TelephoneCode,SerDays,SerContent,Resolvent) "; strCode += "VALUES(@CustomerCode,@SerDate,@EmployeeCode,@Linkman,@TelephoneCode,@SerDays,@SerContent,@Resolvent)"; if (db.ExecDataBySql(strCode) > 0) { MessageBox.Show("保存成功!", "软件提示"); } else { MessageBox.Show("保存失败!", "软件提示"); } } if (this.Tag.ToString() == "Edit") { //取出主键 intAfterId = Convert.ToInt32(formCustomerCourse.dgvAfter["AfterId", formCustomerCourse.dgvAfter.CurrentRow.Index].Value); //添加参数 ParametersAddValue(); strCode = "UPDATE CUAfterService SET CustomerCode=@CustomerCode,SerDate=@SerDate,EmployeeCode = @EmployeeCode,Linkman = @Linkman,TelephoneCode = @TelephoneCode,SerDays = @SerDays,SerContent = @SerContent,Resolvent = @Resolvent "; strCode += "WHERE AfterId = " + intAfterId; if (db.ExecDataBySql(strCode) > 0) { MessageBox.Show("保存成功!", "软件提示"); } else { MessageBox.Show("保存失败!", "软件提示"); } } //重新绑定数据 formCustomerCourse.BindDataGridView(formCustomerCourse.tvCustomer.SelectedNode.Tag.ToString(), "CUAfterService", formCustomerCourse.dgvAfter); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { int intSellId; string strCode = null; if (String.IsNullOrEmpty(txtTheme.Text.Trim())) { MessageBox.Show("标题不许为空!", "软件提示"); txtTheme.Focus(); return; } if (cbxChanceCode.SelectedValue == null) { MessageBox.Show("机会等级不许为空!", "软件提示"); cbxChanceCode.Focus(); return; } if (cbxInvenCode.SelectedIndex == -1) { MessageBox.Show("预售产品不许为空!", "软件提示"); cbxInvenCode.Focus(); return; } if (this.Tag.ToString() == "Add") { //添加参数 ParametersAddValue(); strCode = "INSERT INTO CUSellChance(CustomerCode,Theme,RegDate,ChanceCode,ForeDate,InvenCode,UnitPrice,Quantity,CUMoney,Remark) "; strCode += "VALUES(@CustomerCode,@Theme,@RegDate,@ChanceCode,@ForeDate,@InvenCode,@UnitPrice,@Quantity,@CUMoney,@Remark)"; if (db.ExecDataBySql(strCode) > 0) { MessageBox.Show("保存成功!", "软件提示"); } else { MessageBox.Show("保存失败!", "软件提示"); } } if (this.Tag.ToString() == "Edit") { intSellId = Convert.ToInt32(formCustomerCourse.dgvSell["SellId", formCustomerCourse.dgvSell.CurrentRow.Index].Value); //添加参数 ParametersAddValue(); strCode = "UPDATE CUSellChance SET CustomerCode=@CustomerCode,Theme=@Theme,RegDate = @RegDate,ChanceCode = @ChanceCode,ForeDate = @ForeDate,InvenCode = @InvenCode,UnitPrice = @UnitPrice,Quantity = @Quantity,CUMoney = @CUMoney,Remark= @Remark "; strCode += " WHERE SellId = " + intSellId; if (db.ExecDataBySql(strCode) > 0) { MessageBox.Show("保存成功!", "软件提示"); } else { MessageBox.Show("保存失败!", "软件提示"); } } formCustomerCourse.BindDataGridView(formCustomerCourse.tvCustomer.SelectedNode.Tag.ToString(), "CUSellChance", formCustomerCourse.dgvSell); this.Close(); }