Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(NCPEP.Model.T_AdminUser model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_AdminUser(");
            strSql.Append("AdminLogName,AdminLogPass,AdminName,AdminTel,OrgCode,AdminTypeId,JobId,AdminState,AdminLogNum,IsCheck,Editor,CreateDate,EndDate)");
            strSql.Append(" values (");
            strSql.Append("@AdminLogName,@AdminLogPass,@AdminName,@AdminTel,@OrgCode,@AdminTypeId,@JobId,@AdminState,@AdminLogNum,@IsCheck,@Editor,@CreateDate,@EndDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AdminLogName", SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminLogPass", SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminName",    SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminTel",     SqlDbType.NVarChar,  50),
                new SqlParameter("@OrgCode",      SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminTypeId",  SqlDbType.Int,        4),
                new SqlParameter("@JobId",        SqlDbType.Int,        4),
                new SqlParameter("@AdminState",   SqlDbType.Int,        4),
                new SqlParameter("@AdminLogNum",  SqlDbType.Int,        4),
                new SqlParameter("@IsCheck",      SqlDbType.Int,        4),
                new SqlParameter("@Editor",       SqlDbType.NVarChar,  50),
                new SqlParameter("@CreateDate",   SqlDbType.DateTime),
                new SqlParameter("@EndDate",      SqlDbType.DateTime)
            };
            parameters[0].Value  = model.AdminLogName;
            parameters[1].Value  = model.AdminLogPass;
            parameters[2].Value  = model.AdminName;
            parameters[3].Value  = model.AdminTel;
            parameters[4].Value  = model.OrgCode;
            parameters[5].Value  = model.AdminTypeId;
            parameters[6].Value  = model.JobId;
            parameters[7].Value  = model.AdminState;
            parameters[8].Value  = model.AdminLogNum;
            parameters[9].Value  = model.IsCheck;
            parameters[10].Value = model.Editor;
            parameters[11].Value = model.CreateDate;
            parameters[12].Value = model.EndDate;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (this.lbadminlogname.Text == adminUser.AdminLogName && this.txtoldpass.Text == adminUser.AdminLogPass)
     {
         NCPEP.Model.T_AdminUser model = new NCPEP.Model.T_AdminUser();
         NCPEP.Bll.T_AdminUser   bll   = new NCPEP.Bll.T_AdminUser();
         model = bll.GetModel(adminUser.Id);
         model.AdminLogPass = this.TextBox1.Text.Trim();
         bll.Update(model);
         ClientScript.RegisterClientScriptBlock(this.GetType(), "reload", " <script>msgShow(\"提示\", \"修改成功\", \"info\");</script>");
     }
     else
     {
         ClientScript.RegisterClientScriptBlock(this.GetType(), "reload", " <script>msgShow(\"提示\", \"原密码输入错误\", \"info\");</script>");
     }
 }
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NCPEP.Model.T_AdminUser GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,AdminLogName,AdminLogPass,AdminName,AdminTel,OrgCode,AdminTypeId,JobId,AdminState,AdminLogNum,IsCheck,Editor,CreateDate,EndDate from T_AdminUser ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(NCPEP.Model.T_AdminUser model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_AdminUser set ");
            strSql.Append("AdminLogName=@AdminLogName,");
            strSql.Append("AdminLogPass=@AdminLogPass,");
            strSql.Append("AdminName=@AdminName,");
            strSql.Append("AdminTel=@AdminTel,");
            strSql.Append("OrgCode=@OrgCode,");
            strSql.Append("AdminTypeId=@AdminTypeId,");
            strSql.Append("JobId=@JobId,");
            strSql.Append("AdminState=@AdminState,");
            strSql.Append("AdminLogNum=@AdminLogNum,");
            strSql.Append("IsCheck=@IsCheck,");
            strSql.Append("Editor=@Editor,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("EndDate=@EndDate");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AdminLogName", SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminLogPass", SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminName",    SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminTel",     SqlDbType.NVarChar,  50),
                new SqlParameter("@OrgCode",      SqlDbType.NVarChar,  50),
                new SqlParameter("@AdminTypeId",  SqlDbType.Int,        4),
                new SqlParameter("@JobId",        SqlDbType.Int,        4),
                new SqlParameter("@AdminState",   SqlDbType.Int,        4),
                new SqlParameter("@AdminLogNum",  SqlDbType.Int,        4),
                new SqlParameter("@IsCheck",      SqlDbType.Int,        4),
                new SqlParameter("@Editor",       SqlDbType.NVarChar,  50),
                new SqlParameter("@CreateDate",   SqlDbType.DateTime),
                new SqlParameter("@EndDate",      SqlDbType.DateTime),
                new SqlParameter("@Id",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.AdminLogName;
            parameters[1].Value  = model.AdminLogPass;
            parameters[2].Value  = model.AdminName;
            parameters[3].Value  = model.AdminTel;
            parameters[4].Value  = model.OrgCode;
            parameters[5].Value  = model.AdminTypeId;
            parameters[6].Value  = model.JobId;
            parameters[7].Value  = model.AdminState;
            parameters[8].Value  = model.AdminLogNum;
            parameters[9].Value  = model.IsCheck;
            parameters[10].Value = model.Editor;
            parameters[11].Value = model.CreateDate;
            parameters[12].Value = model.EndDate;
            parameters[13].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public NCPEP.Model.T_AdminUser DataRowToModel(DataRow row)
 {
     NCPEP.Model.T_AdminUser model = new NCPEP.Model.T_AdminUser();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["AdminLogName"] != null)
         {
             model.AdminLogName = row["AdminLogName"].ToString();
         }
         if (row["AdminLogPass"] != null)
         {
             model.AdminLogPass = row["AdminLogPass"].ToString();
         }
         if (row["AdminName"] != null)
         {
             model.AdminName = row["AdminName"].ToString();
         }
         if (row["AdminTel"] != null)
         {
             model.AdminTel = row["AdminTel"].ToString();
         }
         if (row["OrgCode"] != null)
         {
             model.OrgCode = row["OrgCode"].ToString();
         }
         if (row["AdminTypeId"] != null && row["AdminTypeId"].ToString() != "")
         {
             model.AdminTypeId = int.Parse(row["AdminTypeId"].ToString());
         }
         if (row["JobId"] != null && row["JobId"].ToString() != "")
         {
             model.JobId = int.Parse(row["JobId"].ToString());
         }
         if (row["AdminState"] != null && row["AdminState"].ToString() != "")
         {
             model.AdminState = int.Parse(row["AdminState"].ToString());
         }
         if (row["AdminLogNum"] != null && row["AdminLogNum"].ToString() != "")
         {
             model.AdminLogNum = int.Parse(row["AdminLogNum"].ToString());
         }
         if (row["IsCheck"] != null && row["IsCheck"].ToString() != "")
         {
             model.IsCheck = int.Parse(row["IsCheck"].ToString());
         }
         if (row["Editor"] != null)
         {
             model.Editor = row["Editor"].ToString();
         }
         if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
         {
             model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
         }
         if (row["EndDate"] != null && row["EndDate"].ToString() != "")
         {
             model.EndDate = DateTime.Parse(row["EndDate"].ToString());
         }
     }
     return(model);
 }
Example #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(NCPEP.Model.T_AdminUser model)
 {
     return(dal.Update(model));
 }
Example #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(NCPEP.Model.T_AdminUser model)
 {
     return(dal.Add(model));
 }