Ejemplo n.º 1
0
        private void ddlInv_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string    strsql = "select cnvcInvCode,cnvcInvName,cnvcProduceUnitCode from tbInventory where cnvcInvCode='" + this.ddlInv.SelectedValue + "'";
            DataTable dt     = Helper.Query(strsql);

            Entity.Inventory inv = new AMSApp.zhenghua.Entity.Inventory(dt);
            strsql = "select * from tbcomputationunit where cnvccomunitcode='" + inv.cnvcProduceUnitCode + "'";
            dt     = Helper.Query(strsql);
            if (dt.Rows.Count > 0)
            {
                Entity.ComputationUnit cu = new AMSApp.zhenghua.Entity.ComputationUnit(dt);
                this.txtProduceUnitCode.Text = cu.cnvcComUnitName;
            }
        }
        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>");
        }