Esempio n. 1
0
        protected void BtnAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            if (assetclassify.Value.Trim().Length == 0)
            {
                baseOperation.ShowErrorMessage(this.Page, "资产分类不能为空!");
            }

            bool IsIn     = this.NameIsIn(dropAdmindept.SelectedValue.Trim(), assetclassify.Value.Trim());
            bool codeIsIn = this.CodeIsIn(maxcode.Value.Trim());

            if (fixedbarcode.Value.Trim().Length == 0)
            {
                baseOperation.ShowErrorMessage(this.Page, "固定条码不能为空!");
            }
            else if (fixedbarcode.Value.Trim().Length < 3)
            {
                baseOperation.ShowErrorMessage(this.Page, "固定条码长度不能小于3位!");
            }
            else if (IsIn == true)
            {
                baseOperation.ShowErrorMessage(this.Page, "已经存在该管理部门和资产分类的条码设置!");
            }
            else if (codeIsIn == true)
            {
                baseOperation.ShowErrorMessage(this.Page, "已经存在该固定条码的设置!");
            }
            else
            {
                BARCODESETTINGModel model = new BARCODESETTINGModel();
                model.BARCODEID     = baseOperation.GetTableMaxColumnValue("BARCODESETTING", "BARCODEID");
                model.DEPTCODE      = dropAdmindept.SelectedValue;
                model.ASSETCLASSIFY = assetclassify.Value.Trim();
                model.FIXEDBARCODE  = fixedbarcode.Value.Trim();
                model.MAXCODE       = 0;
                model.COMMENTS      = comments.Value.Trim();
                model.PlantID       = ddPlant.SelectedValue;
                model.EmployeeID    = txtEmployee.Text;
                dal.Add(model);

                string url;
                url = "Success.aspx?backUrl=AddBarcodeByEmployeeID.aspx&erorMessage=条形码设置成功!";
                Log.WriteLog("", Session["username"] + ":条形码设置");
                Response.Redirect(url);
            }
        }