Ejemplo n.º 1
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            ERP.Model.Materials model = new ERP.Model.Materials();

            model.MID       = Convert.ToInt32(((TextBox)GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text);
            model.MCode     = Convert.ToInt32(((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text);
            model.MName     = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text.ToString();
            model.MModel    = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text.ToString();
            model.MMaterial = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text.ToString();
            model.MStandard = ((TextBox)GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text.ToString();
            model.MUnit     = ((TextBox)GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text.ToString();
            model.MNumber   = Convert.ToInt32(((TextBox)GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text);
            model.WName     = ((TextBox)GridView1.Rows[e.RowIndex].Cells[8].Controls[0]).Text.ToString();

            try
            {
                bool TrueOrFalse = bll.Update(model);
                if (TrueOrFalse)
                {
                    Response.Write("<script language=javascript>alert('保存成功!')</script>");
                }
                else
                {
                    Response.Write("<script language=javascript>alert('保存失败!')</script>");
                }
                GridView1.EditIndex = -1;
                LoadList();
            }
            catch (Exception erro)
            {
                Response.Write("错误信息:" + erro.Message);
            }
        }
Ejemplo n.º 2
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            //点提交后,物料信息数量减少,记录表增加一条记录
            strWhere = "MName = '" + DropDownListMName.Text.ToString() + "'";

            try
            {
                //给Records的model赋值
                DataRow dw = bllMaterials.GetList(strWhere).Tables[0].Rows[0];
                modelRecords.RMCode    = Convert.ToInt32(dw[1]);
                modelRecords.RMName    = dw[2].ToString();
                modelRecords.RQuantity = Convert.ToInt32(TextBoxNumberIn.Text);
                modelRecords.RType     = 2;//1指入库,2指出库
                modelRecords.RHander   = HttpContext.Current.User.Identity.Name.ToString();
                modelRecords.RTime     = Convert.ToDateTime(DateTime.Now.Date.ToString("yyyy-MM-dd"));

                //给Materials的model赋值
                modelMaterials.MID       = Convert.ToInt32(dw[0]);
                modelMaterials.MCode     = Convert.ToInt32(dw[1]);
                modelMaterials.MName     = dw[2].ToString();
                modelMaterials.MModel    = dw[3].ToString();
                modelMaterials.MMaterial = dw[4].ToString();
                modelMaterials.MStandard = dw[5].ToString();
                modelMaterials.MUnit     = dw[6].ToString();
                modelMaterials.MNumber   = Convert.ToInt32(dw[7]) - Convert.ToInt32(TextBoxNumberIn.Text);
                modelMaterials.WName     = dw[8].ToString();

                bool boolRecords   = bllRecords.Add(modelRecords);
                bool boolMaterials = bllMaterials.Update(modelMaterials);

                if (boolRecords && boolMaterials)
                {
                    Response.Write("<script language='javascript'>alert('出库信息添加成功!');</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>alert('出库信息添加失败!');</script>");
                }
                LoadList();
                TextBoxNumberIn.Text = "";
            }
            catch (Exception erro)
            {
                Response.Write("错误信息:" + erro.Message);
            }
        }
Ejemplo n.º 3
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtMCode.Text))
            {
                strErr += "MCode格式错误!\\n";
            }
            if (this.txtMModel.Text.Trim().Length == 0)
            {
                strErr += "MModel不能为空!\\n";
            }
            if (this.txtMMaterial.Text.Trim().Length == 0)
            {
                strErr += "MMaterial不能为空!\\n";
            }
            if (this.txtMStandard.Text.Trim().Length == 0)
            {
                strErr += "MStandard不能为空!\\n";
            }
            if (this.txtMUnit.Text.Trim().Length == 0)
            {
                strErr += "MUnit不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtMNumber.Text))
            {
                strErr += "MNumber格式错误!\\n";
            }
            if (this.txtWName.Text.Trim().Length == 0)
            {
                strErr += "WName不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    MID       = int.Parse(this.lblMID.Text);
            int    MCode     = int.Parse(this.txtMCode.Text);
            string MName     = this.lblMName.Text;
            string MModel    = this.txtMModel.Text;
            string MMaterial = this.txtMMaterial.Text;
            string MStandard = this.txtMStandard.Text;
            string MUnit     = this.txtMUnit.Text;
            int    MNumber   = int.Parse(this.txtMNumber.Text);
            string WName     = this.txtWName.Text;


            ERP.Model.Materials model = new ERP.Model.Materials();
            model.MID       = MID;
            model.MCode     = MCode;
            model.MName     = MName;
            model.MModel    = MModel;
            model.MMaterial = MMaterial;
            model.MStandard = MStandard;
            model.MUnit     = MUnit;
            model.MNumber   = MNumber;
            model.WName     = WName;

            ERP.BLL.Materials bll = new ERP.BLL.Materials();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }