Example #1
0
 private void ShowInfo(int bId)
 {
     PaducnSoft.Model.ay_caseclass model = dal.GetModel(bId);
     this.bId.Value    = model.bId.ToString();
     this.bName.Text   = model.bName;
     this.bOrder.Text  = model.bOrder.ToString();
     this.bRemark.Text = model.bRemark;
 }
Example #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.bName.Text.Trim().Length == 0)
            {
                strErr += "名称不能为空!\\n";
            }
            if (this.bOrder.Text.Trim().Length == 0)
            {
                strErr += "排序不能为空!\\n";
            }
            if (!PageValidate.IsNumber(this.bOrder.Text))
            {
                strErr += "排序格式错误!\\n";
            }
            if (strErr != "")
            {
                MessageBox.Alert(this, strErr);
                return;
            }
            PaducnSoft.Model.ay_caseclass model = new PaducnSoft.Model.ay_caseclass();
            model.bId      = (int)StringPlus.ConvertNullToZero(this.bId.Value);
            model.bName    = this.bName.Text;
            model.bOrder   = (int)StringPlus.ConvertNullToZero(this.bOrder.Text);
            model.bRemark  = this.bRemark.Text;
            model.bAddTime = DateTime.Now;
            model.bAddUser = paducncms.Module.UserRights.AdminUserID;
            StringBuilder strWhere = new StringBuilder();

            strWhere.AppendFormat(" and bId<>{0}", this.bId.Value);
            strWhere.AppendFormat(" and bName='{0}'", model.bName);
            if (dal.Exists(strWhere.ToString()))
            {
                MessageBox.Alert(this, "名称已存在,请重新输入!");
                return;
            }
            bool result = dal.Update(model);

            if (result)
            {
                MessageBox.Alert(this, "更新成功!");
            }
            else
            {
                MessageBox.Alert(this, "更新失败!");
            }
        }