Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Admin DataRowToModel(DataRow row)
        {
            Admin model = new Admin();

            if (row != null)
            {
                if (row["ID"] != null && row["ID"].ToString() != "")
                {
                    model.ID = int.Parse(row["ID"].ToString());
                }
                if (row["UserName"] != null)
                {
                    model.UserName = row["UserName"].ToString();
                }
                if (row["PassWord"] != null)
                {
                    model.PassWord = row["PassWord"].ToString();
                }
                if (row["ReallyName"] != null)
                {
                    model.ReallyName = row["ReallyName"].ToString();
                }
                if (row["Birthday"] != null)
                {
                    model.Birthday = row["Birthday"].ToString();
                }
                if (row["Address"] != null)
                {
                    model.Address = row["Address"].ToString();
                }
                if (row["PostCode"] != null)
                {
                    model.PostCode = row["PostCode"].ToString();
                }
                if (row["Email"] != null)
                {
                    model.Email = row["Email"].ToString();
                }
                if (row["HomePhone"] != null)
                {
                    model.HomePhone = row["HomePhone"].ToString();
                }
                if (row["MobilePhone"] != null)
                {
                    model.MobilePhone = row["MobilePhone"].ToString();
                }
                if (row["QQ"] != null)
                {
                    model.QQ = row["QQ"].ToString();
                }
                if (row["ICQ"] != null)
                {
                    model.ICQ = row["ICQ"].ToString();
                }
                if (row["RegTime"] != null && row["RegTime"].ToString() != "")
                {
                    model.RegTime = DateTime.Parse(row["RegTime"].ToString());
                }
                if (row["Sex"] != null)
                {
                    model.Sex = row["Sex"].ToString();
                }
                if (row["IP"] != null)
                {
                    model.IP = row["IP"].ToString();
                }
                if (row["BlogID"] != null && row["BlogID"].ToString() != "")
                {
                    model.BlogID = int.Parse(row["BlogID"].ToString());
                }
                if (row["SuperAdmin"] != null)
                {
                    model.SuperAdmin = row["SuperAdmin"].ToString();
                }
            }
            return(model);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Admin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Admin set ");
            strSql.Append("UserName=@UserName,");
            strSql.Append("PassWord=@PassWord,");
            strSql.Append("ReallyName=@ReallyName,");
            strSql.Append("Birthday=@Birthday,");
            strSql.Append("Address=@Address,");
            strSql.Append("PostCode=@PostCode,");
            strSql.Append("Email=@Email,");
            strSql.Append("HomePhone=@HomePhone,");
            strSql.Append("MobilePhone=@MobilePhone,");
            strSql.Append("QQ=@QQ,");
            strSql.Append("ICQ=@ICQ,");
            strSql.Append("RegTime=@RegTime,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("IP=@IP,");
            strSql.Append("BlogID=@BlogID,");
            strSql.Append("SuperAdmin=@SuperAdmin");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserName",    SqlDbType.NVarChar,   50),
                new SqlParameter("@PassWord",    SqlDbType.NVarChar,   50),
                new SqlParameter("@ReallyName",  SqlDbType.NVarChar,   50),
                new SqlParameter("@Birthday",    SqlDbType.NVarChar,   50),
                new SqlParameter("@Address",     SqlDbType.NVarChar,  100),
                new SqlParameter("@PostCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@Email",       SqlDbType.NVarChar,   50),
                new SqlParameter("@HomePhone",   SqlDbType.NVarChar,   50),
                new SqlParameter("@MobilePhone", SqlDbType.NVarChar,   50),
                new SqlParameter("@QQ",          SqlDbType.NVarChar,   50),
                new SqlParameter("@ICQ",         SqlDbType.NVarChar,   50),
                new SqlParameter("@RegTime",     SqlDbType.DateTime),
                new SqlParameter("@Sex",         SqlDbType.NVarChar,    4),
                new SqlParameter("@IP",          SqlDbType.NVarChar,   20),
                new SqlParameter("@BlogID",      SqlDbType.Int,         4),
                new SqlParameter("@SuperAdmin",  SqlDbType.NVarChar,    4),
                new SqlParameter("@ID",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.UserName;
            parameters[1].Value  = model.PassWord;
            parameters[2].Value  = model.ReallyName;
            parameters[3].Value  = model.Birthday;
            parameters[4].Value  = model.Address;
            parameters[5].Value  = model.PostCode;
            parameters[6].Value  = model.Email;
            parameters[7].Value  = model.HomePhone;
            parameters[8].Value  = model.MobilePhone;
            parameters[9].Value  = model.QQ;
            parameters[10].Value = model.ICQ;
            parameters[11].Value = model.RegTime;
            parameters[12].Value = model.Sex;
            parameters[13].Value = model.IP;
            parameters[14].Value = model.BlogID;
            parameters[15].Value = model.SuperAdmin;
            parameters[16].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 partial void DeleteAdmin(Admin instance);
Exemplo n.º 4
0
 partial void UpdateAdmin(Admin instance);
Exemplo n.º 5
0
 partial void InsertAdmin(Admin instance);
Exemplo n.º 6
0
 bool IBankAdminDAL.isAdminLoginCorrect(Admin admin)
 {
     throw new NotImplementedException();
 }