Exemplo n.º 1
0
        /// <summary>
        /// 获取实体对象
        /// </summary>
        /// <param name="PKID">模块控制ID</param>
        /// <returns></returns>
        public ModuleCommandEntity ModuleCommandByPKID(int PKID)
        {
            string sql = string.Format(@"select * from ModuleCommand where PKID=@PKID");

            SqlParameter[] param =
            {
                new SqlParameter("@PKID", PKID)
            };
            try
            {
                DataTable           dt    = SqlHelper.GetDateTable(SqlHelper.connStr, CommandType.Text, sql, param);
                ModuleCommandEntity model = new ModuleCommandEntity();
                if (dt.Rows.Count > 0)
                {
                    model.PKID     = Convert.ToInt32(dt.Rows[0]["PKID"]);
                    model.ModuleID = Convert.ToInt32(dt.Rows[0]["ModuleID"]);
                    model.Code     = dt.Rows[0]["Code"].ToString();
                    model.Name     = dt.Rows[0]["Name"].ToString();
                    model.Remark   = dt.Rows[0]["Remark"].ToString();
                }
                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// /*修改一条记录*/
        /// </summary>
        /// <param name="model">实体对象</param>
        /// <returns></returns>
        public bool MCUpdate(ModuleCommandEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"update ModuleCommand set Code=@Code,Name=@Name, Remark=@Remark where PKID=@PKID");
            SqlParameter[] param =
            {
                new SqlParameter("@Code",   model.Code),
                new SqlParameter("@Name",   model.Name),
                new SqlParameter("@Remark", model.Remark),
                new SqlParameter("@PKID",   model.PKID)
            };
            try
            {
                int result = SqlHelper.ExecuteNonQuery(SqlHelper.connStr, CommandType.Text, strSql.ToString(), param);
                if (result > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 根据模块ID查询模块控制数据列表
 /// </summary>
 /// <param name="moduleID">模块ID</param>
 public List <ModuleCommandEntity> GetModuleContorlByModuleID(int moduleID)
 {
     try
     {
         string         sql   = string.Format(@"select * from ModuleCommand where ModuleID=@ModuleID order by Name");
         SqlParameter[] param =
         {
             new SqlParameter("@ModuleID", moduleID)
         };
         List <ModuleCommandEntity> list = new List <ModuleCommandEntity>();
         DataTable dt = SqlHelper.GetDateTable(SqlHelper.connStr, CommandType.Text, sql, param);
         if (dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 ModuleCommandEntity model = new ModuleCommandEntity();
                 model.PKID   = Convert.ToInt32(dt.Rows[i]["PKID"]);
                 model.Code   = dt.Rows[i]["Code"].ToString();
                 model.Name   = dt.Rows[i]["Name"].ToString();
                 model.Remark = dt.Rows[i]["Remark"].ToString();
                 list.Add(model);
             }
         }
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 新增一条记录
        /// </summary>
        /// <param name="model">实体对象</param>
        /// <returns></returns>
        public int MCAdd(ModuleCommandEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Insert into ModuleCommand(ModuleID,Code,Name,Remark) Values");
            strSql.Append("(@ModuleID,@Code,@Name,@Remark)");
            strSql.Append(";SELECT @@IDENTITY");// 返回插入用户的主键
            SqlParameter[] param =
            {
                new SqlParameter("@ModuleID", model.ModuleID),
                new SqlParameter("@Code",     model.Code),
                new SqlParameter("@Name",     model.Name),
                new SqlParameter("@Remark",   model.Remark)
            };
            try
            {
                return(SqlHelper.ExecuteNonQuery(SqlHelper.connStr, CommandType.Text, strSql.ToString(), param));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// /*修改一条记录*/
 /// </summary>
 /// <param name="model">实体对象</param>
 /// <returns></returns>
 public bool MCUpdate(ModuleCommandEntity model)
 {
     return(new DAL.Module().MCUpdate(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 新增一条记录
 /// </summary>
 /// <param name="model">实体对象</param>
 /// <returns></returns>
 public int MCAdd(ModuleCommandEntity model)
 {
     return(new DAL.Module().MCAdd(model));
 }