private void Button1_Click(object sender, System.EventArgs e) { //删除计量单位组 if (this.DataGrid1.SelectedIndex < 0) { this.Popup("请选择计量单位组"); return; } string strgroupcode = this.DataGrid1.SelectedItem.Cells[0].Text; string strgroupname = this.DataGrid1.SelectedItem.Cells[1].Text; string strsql = "select * from tbcomputationunit where cnvcgroupcode='" + strgroupcode + "'"; DataTable dtcomputationunit = Helper.Query(strsql); if (dtcomputationunit.Rows.Count > 0) { this.Popup("计量单位组已被使用无法删除!"); return; } Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "删除计量单位组"; ol.cnvcOperID = this.oper.strLoginID; ol.cnvcDeptID = this.oper.strDeptID; Entity.ComputationGroup cg = new Entity.ComputationGroup(); cg.cnvcGroupCode = strgroupcode; cg.cnvcGroupName = strgroupname; Business.ComputationUnit bcu = new AMSApp.zhenghua.Business.ComputationUnit(); int ret = bcu.DeleteComputationGroup(ol, cg); LoadGroup(); if (ret > 0) { this.Popup("删除计量单位组成功!"); LoadGroup(); } else { this.Popup("删除计量单位组失败!"); } }
private void Button2_Click(object sender, System.EventArgs e) { //删除计量单位 if (this.DataGrid2.SelectedIndex >= 0) { Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "删除计量单位"; ol.cnvcOperID = this.oper.strLoginID; ol.cnvcDeptID = this.oper.strDeptID; Entity.ComputationUnit cu = new AMSApp.zhenghua.Entity.ComputationUnit(); cu.cnvcComunitCode = this.DataGrid2.SelectedItem.Cells[0].Text; //string strsql = "select * from tbcomputationunit where cnvccomunitcode='"+cu.cnvcComunitCode+"' and cnbmainunit=1"; DataTable dt = Application["tbInventory"] as DataTable; DataView dv = new DataView(dt); dv.RowFilter = "cnvcproduceunitcode='" + cu.cnvcComunitCode + "' or cnvcstcomunitcode='" + cu.cnvcComunitCode + "'"; if (dv.Count > 0) { this.Popup("不能删除已经使用中的计量单位"); return; } Business.ComputationUnit bcu = new AMSApp.zhenghua.Business.ComputationUnit(); int ret = bcu.DeleteComputationUnit(ol, cu); DataGrid1_SelectedIndexChanged(null, null); if (ret > 0) { this.Popup("删除计量单位成功!"); LoadGroup(); } else { this.Popup("删除计量单位失败!"); } } else { this.Popup("请选择计量单位"); } }
private void Button1_Click(object sender, System.EventArgs e) { //添加计量单位组 if (this.JudgeIsNull(this.TextBox2.Text)) { this.Popup("计量单位组编码获取失败,请关闭页面重新获取"); return; } if (this.JudgeIsNull(this.TextBox1.Text)) { this.Popup("请输入计量单位组名称"); return; } if (this.JudgeIsNull(this.TextBox3.Text)) { this.Popup("计量单位编码获取失败,请关闭页面重新获取"); return; } if (this.JudgeIsNull(this.TextBox4.Text)) { this.Popup("请输入计量单位名称"); return; } if (this.JudgeIsNull(this.TextBox6.Text)) { this.Popup("请输入换算率"); return; } if (!this.JudgeIsNum(this.TextBox6.Text)) { this.Popup("换算率必须是数字"); return; } if (this.lblTitle.Text == "添加计量单位") { Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "添加计量单位"; ol.cnvcOperID = this.oper.strLoginID; ol.cnvcDeptID = this.oper.strDeptID; Entity.ComputationUnit cu = new AMSApp.zhenghua.Entity.ComputationUnit(); cu.cnbMainUnit = this.CheckBox1.Checked; cu.cniChangRate = float.Parse(this.TextBox6.Text); cu.cnvcComunitCode = this.TextBox3.Text; cu.cnvcComUnitName = this.TextBox4.Text; cu.cnvcGroupCode = this.TextBox2.Text; Business.ComputationUnit bcu = new AMSApp.zhenghua.Business.ComputationUnit(); int ret = bcu.AddComputationUnit(ol, cu); if (ret > 0) { this.Popup("添加计量单位成功!"); } else { this.Popup("添加计量单位失败!"); } //this.Response.Write("<script type=\"text/javascript\">window.returnValue=true;window.close()</script>"); } else if (this.lblTitle.Text == "修改计量单位") { Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "修改计量单位"; ol.cnvcOperID = this.oper.strLoginID; ol.cnvcDeptID = this.oper.strDeptID; Entity.ComputationUnit cu = new AMSApp.zhenghua.Entity.ComputationUnit(); cu.cnbMainUnit = this.CheckBox1.Checked; cu.cniChangRate = float.Parse(this.TextBox6.Text); cu.cnvcComunitCode = this.TextBox3.Text; cu.cnvcComUnitName = this.TextBox4.Text; cu.cnvcGroupCode = this.TextBox2.Text; Business.ComputationUnit bcu = new AMSApp.zhenghua.Business.ComputationUnit(); int ret = bcu.UpdateComputationUnit(ol, cu); if (ret > 0) { this.Popup("修改计量单位成功!"); } else { this.Popup("修改计量单位失败!"); } } this.Response.Write("<script type=\"text/javascript\">window.returnValue=true;window.close()</script>"); }