示例#1
0
        public bool Update(Model_SysCode model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update SysCode set ");
            builder.Append("SysCode=@SysCode,");
            builder.Append("SysName=@SysName,");
            builder.Append("SysOrder=@SysOrder,");
            builder.Append("SysURL=@SysURL,");
            builder.Append("SysIcon=@SysIcon,");
            builder.Append("Sys_CreateUser=@Sys_CreateUser,");
            builder.Append("Sys_CreateTime=@Sys_CreateTime,");
            builder.Append("Sys_UpdateUser=@Sys_UpdateUser,");
            builder.Append("Sys_UpdateTime=@Sys_UpdateTime");
            builder.Append(" where ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SysCode", SqlDbType.NChar, 5), new SqlParameter("@SysName", SqlDbType.VarChar, 100), new SqlParameter("@SysOrder", SqlDbType.Int, 4), new SqlParameter("@SysURL", SqlDbType.VarChar, 500), new SqlParameter("@SysIcon", SqlDbType.VarChar, 100), new SqlParameter("@Sys_CreateUser", SqlDbType.NChar, 0x24), new SqlParameter("@Sys_CreateTime", SqlDbType.DateTime), new SqlParameter("@Sys_UpdateUser", SqlDbType.NChar, 0x24), new SqlParameter("@Sys_UpdateTime", SqlDbType.DateTime) };
            cmdParms[0].Value = model.SysCode;
            cmdParms[1].Value = model.SysName;
            cmdParms[2].Value = model.SysOrder;
            cmdParms[3].Value = model.SysURL;
            cmdParms[4].Value = model.SysIcon;
            cmdParms[5].Value = model.Sys_CreateUser;
            cmdParms[6].Value = model.Sys_CreateTime;
            cmdParms[7].Value = model.Sys_UpdateUser;
            cmdParms[8].Value = model.Sys_UpdateTime;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
示例#2
0
        public Model_SysCode DataRowToModel(DataRow row)
        {
            Model_SysCode code = new Model_SysCode();

            if (row != null)
            {
                if (row["SysCode"] != null)
                {
                    code.SysCode = row["SysCode"].ToString();
                }
                if (row["SysName"] != null)
                {
                    code.SysName = row["SysName"].ToString();
                }
                if ((row["SysOrder"] != null) && (row["SysOrder"].ToString() != ""))
                {
                    code.SysOrder = new int?(int.Parse(row["SysOrder"].ToString()));
                }
                if (row["SysURL"] != null)
                {
                    code.SysURL = row["SysURL"].ToString();
                }
                if (row["SysIcon"] != null)
                {
                    code.SysIcon = row["SysIcon"].ToString();
                }
                if (row["Sys_CreateUser"] != null)
                {
                    code.Sys_CreateUser = row["Sys_CreateUser"].ToString();
                }
                if ((row["Sys_CreateTime"] != null) && (row["Sys_CreateTime"].ToString() != ""))
                {
                    code.Sys_CreateTime = new DateTime?(DateTime.Parse(row["Sys_CreateTime"].ToString()));
                }
                if (row["Sys_UpdateUser"] != null)
                {
                    code.Sys_UpdateUser = row["Sys_UpdateUser"].ToString();
                }
                if ((row["Sys_UpdateTime"] != null) && (row["Sys_UpdateTime"].ToString() != ""))
                {
                    code.Sys_UpdateTime = new DateTime?(DateTime.Parse(row["Sys_UpdateTime"].ToString()));
                }
            }
            return(code);
        }
示例#3
0
        public List <Model_SysCode> DataTableToList(DataTable dt)
        {
            List <Model_SysCode> list = new List <Model_SysCode>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_SysCode item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
示例#4
0
 public bool Add(Model_SysCode model)
 {
     return(this.dal.Add(model));
 }
示例#5
0
 public bool Update(Model_SysCode model)
 {
     return(this.dal.Update(model));
 }