コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(E_Model.Account model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYS_ACCOUNT set ");
            strSql.Append("DEPT=@DEPT,");
            strSql.Append("TRUENAME=@TRUENAME,");
            strSql.Append("IDCARD=@IDCARD,");
            strSql.Append("EMAIL=@EMAIL,");
            strSql.Append("PHONE=@PHONE,");
            strSql.Append("ADRESS=@ADRESS,");
            strSql.Append("DESCRIPTION=@DESCRIPTION ");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "DEPT", DbType.String, model.DEPT);
            db.AddInParameter(dbCommand, "TRUENAME", DbType.String, model.TRUENAME);
            db.AddInParameter(dbCommand, "IDCARD", DbType.String, model.IDCARD);
            db.AddInParameter(dbCommand, "EMAIL", DbType.String, model.EMAIL);
            db.AddInParameter(dbCommand, "PHONE", DbType.String, model.PHONE);
            db.AddInParameter(dbCommand, "ADRESS", DbType.String, model.ADRESS);
            db.AddInParameter(dbCommand, "DESCRIPTION", DbType.String, model.DESCRIPTION);
            db.AddInParameter(dbCommand, "ID", DbType.String, model.ID);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public E_Model.Account ReaderBind(IDataReader dataReader)
        {
            E_Model.Account model = new E_Model.Account();
            object          ojb;

            model.ID          = dataReader["ID"].ToString();
            model.USERCODE    = dataReader["USERCODE"].ToString();
            model.USERNAME    = dataReader["USERNAME"].ToString();
            model.PASSWORDS   = dataReader["PASSWORDS"].ToString();
            model.DEPT        = dataReader["DEPT"].ToString();
            model.TRUENAME    = dataReader["TRUENAME"].ToString();
            model.IDCARD      = dataReader["IDCARD"].ToString();
            model.EMAIL       = dataReader["EMAIL"].ToString();
            model.PHONE       = dataReader["PHONE"].ToString();
            model.ADRESS      = dataReader["ADRESS"].ToString();
            model.DESCRIPTION = dataReader["DESCRIPTION"].ToString();

            ojb = dataReader["STATUS"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.STATUS = (decimal)ojb;
            }
            ojb = dataReader["CREATEDATE"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CREATEDATE = (DateTime)ojb;
            }
            model.CREATEUSER = dataReader["CREATEUSER"].ToString();
            return(model);
        }
コード例 #3
0
        public bool ResetPwd(E_Model.Account model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYS_ACCOUNT set ");
            strSql.Append("PASSWORDS=@PASSWORDS");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "PASSWORDS", DbType.String, model.PASSWORDS);
            db.AddInParameter(dbCommand, "ID", DbType.String, model.ID);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(E_Model.Account model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SYS_ACCOUNT(");
            strSql.Append("ID,USERCODE,USERNAME,PASSWORDS,DEPT,TRUENAME,IDCARD,EMAIL,PHONE,ADRESS,DESCRIPTION,STATUS,CREATEDATE,CREATEUSER)");

            strSql.Append(" values (");
            strSql.Append("@ID,@USERCODE,@USERNAME,@PASSWORDS,@DEPT,@TRUENAME,@IDCARD,@EMAIL,@PHONE,@ADRESS,@DESCRIPTION,@STATUS,@CREATEDATE,@CREATEUSER)");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.String, model.ID);
            db.AddInParameter(dbCommand, "USERCODE", DbType.String, model.USERCODE);
            db.AddInParameter(dbCommand, "USERNAME", DbType.String, model.USERNAME);
            db.AddInParameter(dbCommand, "PASSWORDS", DbType.String, model.PASSWORDS);
            db.AddInParameter(dbCommand, "DEPT", DbType.String, model.DEPT);
            db.AddInParameter(dbCommand, "TRUENAME", DbType.String, model.TRUENAME);
            db.AddInParameter(dbCommand, "IDCARD", DbType.String, model.IDCARD);
            db.AddInParameter(dbCommand, "EMAIL", DbType.String, model.EMAIL);
            db.AddInParameter(dbCommand, "PHONE", DbType.String, model.PHONE);
            db.AddInParameter(dbCommand, "ADRESS", DbType.String, model.ADRESS);
            db.AddInParameter(dbCommand, "DESCRIPTION", DbType.String, model.DESCRIPTION);
            db.AddInParameter(dbCommand, "STATUS", DbType.Decimal, model.STATUS);
            db.AddInParameter(dbCommand, "CREATEDATE", DbType.DateTime, model.CREATEDATE);
            db.AddInParameter(dbCommand, "CREATEUSER", DbType.String, model.CREATEUSER);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public E_Model.Account GetModel(string ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,USERCODE,USERNAME,PASSWORDS,DEPT,TRUENAME,IDCARD,EMAIL,PHONE,ADRESS,DESCRIPTION,STATUS,CREATEDATE,CREATEUSER from SYS_ACCOUNT ");
            strSql.Append(" where ID= '" + ID + "' ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            DataSet   DS        = db.ExecuteDataSet(CommandType.Text, strSql.ToString());

            E_Model.Account model = new E_Model.Account();
            if (DS.Tables[0].Rows.Count == 1)
            {
                model.ID          = DS.Tables[0].Rows[0]["ID"].ToString();
                model.USERCODE    = DS.Tables[0].Rows[0]["USERCODE"].ToString();
                model.USERNAME    = DS.Tables[0].Rows[0]["USERNAME"].ToString();
                model.PASSWORDS   = DS.Tables[0].Rows[0]["PASSWORDS"].ToString();
                model.DEPT        = DS.Tables[0].Rows[0]["DEPT"].ToString();
                model.TRUENAME    = DS.Tables[0].Rows[0]["TRUENAME"].ToString();
                model.IDCARD      = DS.Tables[0].Rows[0]["IDCARD"].ToString();
                model.EMAIL       = DS.Tables[0].Rows[0]["EMAIL"].ToString();
                model.PHONE       = DS.Tables[0].Rows[0]["PHONE"].ToString();
                model.ADRESS      = DS.Tables[0].Rows[0]["ADRESS"].ToString();
                model.DESCRIPTION = DS.Tables[0].Rows[0]["DESCRIPTION"].ToString();

                if (model.STATUS != null)
                {
                    model.STATUS = decimal.Parse(DS.Tables[0].Rows[0]["STATUS"].ToString());
                }
                if (model.CREATEDATE != null)
                {
                    model.CREATEDATE = DateTime.Parse(DS.Tables[0].Rows[0]["CREATEDATE"].ToString());
                }
                model.CREATEUSER = DS.Tables[0].Rows[0]["CREATEUSER"].ToString();
            }
            return(model);
        }
コード例 #6
0
 public bool ResetPwd(E_Model.Account model)
 {
     return(dal.ResetPwd(model));
 }
コード例 #7
0
 public bool UpdateUserInfo(E_Model.Account model)
 {
     return(dal.UpdateUserInfo(model));
 }
コード例 #8
0
 public bool UpdatePwd(E_Model.Account model)
 {
     return(dal.UpdatePwd(model));
 }
コード例 #9
0
 public bool Add(E_Model.Account model)
 {
     return(dal.Add(model));
 }
コード例 #10
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public E_Model.Account DataRowToModel(DataRow row)
 {
     E_Model.Account model = new E_Model.Account();
     if (row != null)
     {
         if (row["ID"] != null)
         {
             model.ID = row["ID"].ToString();
         }
         if (row["USERCODE"] != null)
         {
             model.USERCODE = row["USERCODE"].ToString();
         }
         if (row["USERNAME"] != null)
         {
             model.USERNAME = row["USERNAME"].ToString();
         }
         if (row["PASSWORDS"] != null)
         {
             model.PASSWORDS = row["PASSWORDS"].ToString();
         }
         if (row["DEPT"] != null)
         {
             model.DEPT = row["DEPT"].ToString();
         }
         if (row["TRUENAME"] != null)
         {
             model.TRUENAME = row["TRUENAME"].ToString();
         }
         if (row["IDCARD"] != null)
         {
             model.IDCARD = row["IDCARD"].ToString();
         }
         if (row["EMAIL"] != null)
         {
             model.EMAIL = row["EMAIL"].ToString();
         }
         if (row["PHONE"] != null)
         {
             model.PHONE = row["PHONE"].ToString();
         }
         if (row["ADRESS"] != null)
         {
             model.ADRESS = row["ADRESS"].ToString();
         }
         //model.DESCRIPTION=row["DESCRIPTION"].ToString();
         if (row["STATUS"] != null && row["STATUS"].ToString() != "")
         {
             model.STATUS = decimal.Parse(row["STATUS"].ToString());
         }
         if (row["CREATEDATE"] != null && row["CREATEDATE"].ToString() != "")
         {
             model.CREATEDATE = DateTime.Parse(row["CREATEDATE"].ToString());
         }
         if (row["CREATEUSER"] != null)
         {
             model.CREATEUSER = row["CREATEUSER"].ToString();
         }
     }
     return(model);
 }