예제 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MyTest.Model.Sys_ModuleButtonModel GetModel(string F_Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 F_Id,F_ModuleId,F_ParentId,F_Layers,F_EnCode,F_FullName,F_Icon,F_Location,F_JsEvent,F_UrlAddress,F_Split,F_IsPublic,F_AllowEdit,F_AllowDelete,F_SortCode,F_DeleteMark,F_EnabledMark,F_Description,F_CreatorTime,F_CreatorUserId,F_LastModifyTime,F_LastModifyUserId,F_DeleteTime,F_DeleteUserId from Sys_ModuleButton ");
            strSql.Append(" where F_Id=@F_Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@F_Id", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = F_Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyTest.Model.Sys_ModuleButtonModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Sys_ModuleButton(");
            strSql.Append("F_Id,F_ModuleId,F_ParentId,F_Layers,F_EnCode,F_FullName,F_Icon,F_Location,F_JsEvent,F_UrlAddress,F_Split,F_IsPublic,F_AllowEdit,F_AllowDelete,F_SortCode,F_DeleteMark,F_EnabledMark,F_Description,F_CreatorTime,F_CreatorUserId,F_LastModifyTime,F_LastModifyUserId,F_DeleteTime,F_DeleteUserId)");
            strSql.Append(" values (");
            strSql.Append("@F_Id,@F_ModuleId,@F_ParentId,@F_Layers,@F_EnCode,@F_FullName,@F_Icon,@F_Location,@F_JsEvent,@F_UrlAddress,@F_Split,@F_IsPublic,@F_AllowEdit,@F_AllowDelete,@F_SortCode,@F_DeleteMark,@F_EnabledMark,@F_Description,@F_CreatorTime,@F_CreatorUserId,@F_LastModifyTime,@F_LastModifyUserId,@F_DeleteTime,@F_DeleteUserId)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@F_Id",               SqlDbType.VarChar,    50),
                new SqlParameter("@F_ModuleId",         SqlDbType.VarChar,    50),
                new SqlParameter("@F_ParentId",         SqlDbType.VarChar,    50),
                new SqlParameter("@F_Layers",           SqlDbType.Int,         4),
                new SqlParameter("@F_EnCode",           SqlDbType.VarChar,    50),
                new SqlParameter("@F_FullName",         SqlDbType.VarChar,    50),
                new SqlParameter("@F_Icon",             SqlDbType.VarChar,    50),
                new SqlParameter("@F_Location",         SqlDbType.Int,         4),
                new SqlParameter("@F_JsEvent",          SqlDbType.VarChar,    50),
                new SqlParameter("@F_UrlAddress",       SqlDbType.VarChar,   500),
                new SqlParameter("@F_Split",            SqlDbType.Bit,         1),
                new SqlParameter("@F_IsPublic",         SqlDbType.Bit,         1),
                new SqlParameter("@F_AllowEdit",        SqlDbType.Bit,         1),
                new SqlParameter("@F_AllowDelete",      SqlDbType.Bit,         1),
                new SqlParameter("@F_SortCode",         SqlDbType.Int,         4),
                new SqlParameter("@F_DeleteMark",       SqlDbType.Bit,         1),
                new SqlParameter("@F_EnabledMark",      SqlDbType.Bit,         1),
                new SqlParameter("@F_Description",      SqlDbType.VarChar,   500),
                new SqlParameter("@F_CreatorTime",      SqlDbType.DateTime),
                new SqlParameter("@F_CreatorUserId",    SqlDbType.VarChar,    50),
                new SqlParameter("@F_LastModifyTime",   SqlDbType.DateTime),
                new SqlParameter("@F_LastModifyUserId", SqlDbType.VarChar,    50),
                new SqlParameter("@F_DeleteTime",       SqlDbType.DateTime),
                new SqlParameter("@F_DeleteUserId",     SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.F_Id;
            parameters[1].Value  = model.F_ModuleId;
            parameters[2].Value  = model.F_ParentId;
            parameters[3].Value  = model.F_Layers;
            parameters[4].Value  = model.F_EnCode;
            parameters[5].Value  = model.F_FullName;
            parameters[6].Value  = model.F_Icon;
            parameters[7].Value  = model.F_Location;
            parameters[8].Value  = model.F_JsEvent;
            parameters[9].Value  = model.F_UrlAddress;
            parameters[10].Value = model.F_Split;
            parameters[11].Value = model.F_IsPublic;
            parameters[12].Value = model.F_AllowEdit;
            parameters[13].Value = model.F_AllowDelete;
            parameters[14].Value = model.F_SortCode;
            parameters[15].Value = model.F_DeleteMark;
            parameters[16].Value = model.F_EnabledMark;
            parameters[17].Value = model.F_Description;
            parameters[18].Value = model.F_CreatorTime;
            parameters[19].Value = model.F_CreatorUserId;
            parameters[20].Value = model.F_LastModifyTime;
            parameters[21].Value = model.F_LastModifyUserId;
            parameters[22].Value = model.F_DeleteTime;
            parameters[23].Value = model.F_DeleteUserId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyTest.Model.Sys_ModuleButtonModel DataRowToModel(DataRow row)
 {
     MyTest.Model.Sys_ModuleButtonModel model = new MyTest.Model.Sys_ModuleButtonModel();
     if (row != null)
     {
         if (row["F_Id"] != null)
         {
             model.F_Id = row["F_Id"].ToString();
         }
         if (row["F_ModuleId"] != null)
         {
             model.F_ModuleId = row["F_ModuleId"].ToString();
         }
         if (row["F_ParentId"] != null)
         {
             model.F_ParentId = row["F_ParentId"].ToString();
         }
         if (row["F_Layers"] != null && row["F_Layers"].ToString() != "")
         {
             model.F_Layers = int.Parse(row["F_Layers"].ToString());
         }
         if (row["F_EnCode"] != null)
         {
             model.F_EnCode = row["F_EnCode"].ToString();
         }
         if (row["F_FullName"] != null)
         {
             model.F_FullName = row["F_FullName"].ToString();
         }
         if (row["F_Icon"] != null)
         {
             model.F_Icon = row["F_Icon"].ToString();
         }
         if (row["F_Location"] != null && row["F_Location"].ToString() != "")
         {
             model.F_Location = int.Parse(row["F_Location"].ToString());
         }
         if (row["F_JsEvent"] != null)
         {
             model.F_JsEvent = row["F_JsEvent"].ToString();
         }
         if (row["F_UrlAddress"] != null)
         {
             model.F_UrlAddress = row["F_UrlAddress"].ToString();
         }
         if (row["F_Split"] != null && row["F_Split"].ToString() != "")
         {
             if ((row["F_Split"].ToString() == "1") || (row["F_Split"].ToString().ToLower() == "true"))
             {
                 model.F_Split = true;
             }
             else
             {
                 model.F_Split = false;
             }
         }
         if (row["F_IsPublic"] != null && row["F_IsPublic"].ToString() != "")
         {
             if ((row["F_IsPublic"].ToString() == "1") || (row["F_IsPublic"].ToString().ToLower() == "true"))
             {
                 model.F_IsPublic = true;
             }
             else
             {
                 model.F_IsPublic = false;
             }
         }
         if (row["F_AllowEdit"] != null && row["F_AllowEdit"].ToString() != "")
         {
             if ((row["F_AllowEdit"].ToString() == "1") || (row["F_AllowEdit"].ToString().ToLower() == "true"))
             {
                 model.F_AllowEdit = true;
             }
             else
             {
                 model.F_AllowEdit = false;
             }
         }
         if (row["F_AllowDelete"] != null && row["F_AllowDelete"].ToString() != "")
         {
             if ((row["F_AllowDelete"].ToString() == "1") || (row["F_AllowDelete"].ToString().ToLower() == "true"))
             {
                 model.F_AllowDelete = true;
             }
             else
             {
                 model.F_AllowDelete = false;
             }
         }
         if (row["F_SortCode"] != null && row["F_SortCode"].ToString() != "")
         {
             model.F_SortCode = int.Parse(row["F_SortCode"].ToString());
         }
         if (row["F_DeleteMark"] != null && row["F_DeleteMark"].ToString() != "")
         {
             if ((row["F_DeleteMark"].ToString() == "1") || (row["F_DeleteMark"].ToString().ToLower() == "true"))
             {
                 model.F_DeleteMark = true;
             }
             else
             {
                 model.F_DeleteMark = false;
             }
         }
         if (row["F_EnabledMark"] != null && row["F_EnabledMark"].ToString() != "")
         {
             if ((row["F_EnabledMark"].ToString() == "1") || (row["F_EnabledMark"].ToString().ToLower() == "true"))
             {
                 model.F_EnabledMark = true;
             }
             else
             {
                 model.F_EnabledMark = false;
             }
         }
         if (row["F_Description"] != null)
         {
             model.F_Description = row["F_Description"].ToString();
         }
         if (row["F_CreatorTime"] != null && row["F_CreatorTime"].ToString() != "")
         {
             model.F_CreatorTime = DateTime.Parse(row["F_CreatorTime"].ToString());
         }
         if (row["F_CreatorUserId"] != null)
         {
             model.F_CreatorUserId = row["F_CreatorUserId"].ToString();
         }
         if (row["F_LastModifyTime"] != null && row["F_LastModifyTime"].ToString() != "")
         {
             model.F_LastModifyTime = DateTime.Parse(row["F_LastModifyTime"].ToString());
         }
         if (row["F_LastModifyUserId"] != null)
         {
             model.F_LastModifyUserId = row["F_LastModifyUserId"].ToString();
         }
         if (row["F_DeleteTime"] != null && row["F_DeleteTime"].ToString() != "")
         {
             model.F_DeleteTime = DateTime.Parse(row["F_DeleteTime"].ToString());
         }
         if (row["F_DeleteUserId"] != null)
         {
             model.F_DeleteUserId = row["F_DeleteUserId"].ToString();
         }
     }
     return(model);
 }