Exemplo n.º 1
0
 private void ShowInfo(string OperatorCode, string DeptID)
 {
     WebDemo.BLL.WebDemo.DeptUser   bll   = new WebDemo.BLL.WebDemo.DeptUser();
     WebDemo.Model.WebDemo.DeptUser model = bll.GetModel(OperatorCode, DeptID);
     this.lblOperatorCode.Text = model.OperatorCode;
     this.lblDeptID.Text       = model.DeptID;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WebDemo.Model.WebDemo.DeptUser model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update DeptUser set ");
#warning 系统发现缺少更新的字段,请手工确认如此更新是否正确!
            strSql.Append("OperatorCode=@OperatorCode,");
            strSql.Append("DeptID=@DeptID");
            strSql.Append(" where OperatorCode=@OperatorCode and DeptID=@DeptID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorCode", SqlDbType.VarChar, 50),
                new SqlParameter("@DeptID",       SqlDbType.VarChar, 60)
            };
            parameters[0].Value = model.OperatorCode;
            parameters[1].Value = model.DeptID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WebDemo.Model.WebDemo.DeptUser model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into DeptUser(");
            strSql.Append("OperatorCode,DeptID)");
            strSql.Append(" values (");
            strSql.Append("@OperatorCode,@DeptID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorCode", SqlDbType.VarChar, 50),
                new SqlParameter("@DeptID",       SqlDbType.VarChar, 60)
            };
            parameters[0].Value = model.OperatorCode;
            parameters[1].Value = model.DeptID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.DeptUser GetModel(string OperatorCode, string DeptID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 OperatorCode,DeptID from DeptUser ");
            strSql.Append(" where OperatorCode=@OperatorCode and DeptID=@DeptID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorCode", SqlDbType.VarChar, 50),
                new SqlParameter("@DeptID",       SqlDbType.VarChar, 60)
            };
            parameters[0].Value = OperatorCode;
            parameters[1].Value = DeptID;

            WebDemo.Model.WebDemo.DeptUser model = new WebDemo.Model.WebDemo.DeptUser();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtOperatorCode.Text.Trim().Length == 0)
            {
                strErr += "OperatorCode不能为空!\\n";
            }
            if (this.txtDeptID.Text.Trim().Length == 0)
            {
                strErr += "DeptID不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string OperatorCode = this.txtOperatorCode.Text;
            string DeptID       = this.txtDeptID.Text;

            WebDemo.Model.WebDemo.DeptUser model = new WebDemo.Model.WebDemo.DeptUser();
            model.OperatorCode = OperatorCode;
            model.DeptID       = DeptID;

            WebDemo.BLL.WebDemo.DeptUser bll = new WebDemo.BLL.WebDemo.DeptUser();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Exemplo n.º 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.DeptUser DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.DeptUser model = new WebDemo.Model.WebDemo.DeptUser();
     if (row != null)
     {
         if (row["OperatorCode"] != null)
         {
             model.OperatorCode = row["OperatorCode"].ToString();
         }
         if (row["DeptID"] != null)
         {
             model.DeptID = row["DeptID"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 7
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string OperatorCode = this.lblOperatorCode.Text;
            string DeptID       = this.lblDeptID.Text;


            WebDemo.Model.WebDemo.DeptUser model = new WebDemo.Model.WebDemo.DeptUser();
            model.OperatorCode = OperatorCode;
            model.DeptID       = DeptID;

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