Esempio n. 1
0
 /// <summary>
 /// 插入模块
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public static int SystemModual_Insert(SystemModual obj)
 {
     using (SystemDAL access = new SystemDAL())
     {
         return(access.SystemModual_Insert(obj));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 更新系统模块
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public static int SystemModual_UpdateBym_gid(SystemModual obj)
 {
     using (SystemDAL access = new SystemDAL())
     {
         return(access.SystemModual_UpdateBym_gid(obj));
     }
 }
Esempio n. 3
0
        public int SystemModual_Insert(SystemModual obj)
        {
            DbCommand dbCmd = db.GetStoredProcCommand("Proc_SystemModual_Insert");

            db.AddOutParameter(dbCmd, "@m_id", DbType.Int32, 4);
            db.AddInParameter(dbCmd, "@m_gid", DbType.String, obj.m_gid);
            db.AddInParameter(dbCmd, "@m_g_gid", DbType.String, obj.m_g_gid);
            db.AddInParameter(dbCmd, "@m_name", DbType.String, obj.m_name);
            db.AddInParameter(dbCmd, "@m_path", DbType.String, obj.m_path);
            db.AddInParameter(dbCmd, "@m_parent", DbType.Int32, obj.m_parent);
            db.AddInParameter(dbCmd, "@m_parent_gid", DbType.String, obj.m_parent_gid);
            db.AddInParameter(dbCmd, "@m_Controller", DbType.String, obj.m_Controller);
            db.AddInParameter(dbCmd, "@m_Action", DbType.String, obj.m_Action);
            db.AddInParameter(dbCmd, "@m_createTime", DbType.String, obj.m_createTime);
            db.AddInParameter(dbCmd, "@m_createUser", DbType.String, obj.m_createUser);
            try
            {
                int returnValue = db.ExecuteNonQuery(dbCmd);
                int m_id        = (int)dbCmd.Parameters["@m_id"].Value;
                return(m_id);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 查询 用户对应 模块组下的模块信息
        /// </summary>
        /// <param name="u_gid"></param>
        /// <param name="m_g_gid"></param>
        /// <returns></returns>
        public List <SystemModual> SystemModual_SelectByu_gid(string u_gid, string m_g_gid)
        {
            DbCommand dbCmd = db.GetStoredProcCommand("Proc_SystemModual_SelectByu_gid");

            db.AddInParameter(dbCmd, "@u_gid", DbType.String, u_gid);
            db.AddInParameter(dbCmd, "@m_g_gid", DbType.String, m_g_gid);
            List <SystemModual> list = new List <SystemModual>();

            try
            {
                using (IDataReader reader = db.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        //属性赋值
                        SystemModual obj = Obj2Model <SystemModual>(reader);
                        list.Add(obj);
                    }
                }
                return(list);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Esempio n. 5
0
        public List <SystemModual> SystemModual_SelectPage(string cloumns, int pageIndex, int pageSize, string orderBy, string where, out int rowCount)
        {
            DbCommand dbCmd = db.GetStoredProcCommand("Proc_SystemModual_SelectPage");

            db.AddOutParameter(dbCmd, "@rowCount", DbType.Int32, 4);
            db.AddInParameter(dbCmd, "@cloumns", DbType.String, cloumns);
            db.AddInParameter(dbCmd, "@pageIndex", DbType.Int32, pageIndex);
            db.AddInParameter(dbCmd, "@pageSize", DbType.Int32, pageSize);
            db.AddInParameter(dbCmd, "@orderBy", DbType.String, orderBy);
            db.AddInParameter(dbCmd, "@where", DbType.String, where);
            List <SystemModual> list = new List <SystemModual>();

            try
            {
                using (IDataReader reader = db.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        //属性赋值
                        SystemModual obj = Obj2Model <SystemModual>(reader);
                        list.Add(obj);
                    }
                    reader.NextResult();
                }
                rowCount = (int)dbCmd.Parameters["@rowCount"].Value;
                return(list);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Esempio n. 6
0
        public ActionResult ModuleEditView()
        {
            string       m_gid  = Request["m_gid"] ?? string.Empty;
            string       window = Request["window"] ?? string.Empty;
            SystemModual info   = null;

            if (string.IsNullOrEmpty(m_gid))
            {
                info = new SystemModual();
            }
            else
            {
                info = SystemSeviceClass.SystemModual_SelectBym_gid(m_gid);
            }
            SystemGroupSearchInfo groupSearch = new SystemGroupSearchInfo();
            int rowCount;
            List <SystemGroup> gList = SystemSeviceClass.SystemGroup_SelectPage(groupSearch, 1, 100, out rowCount);

            ViewData["window"] = window;
            ViewData["gList"]  = gList;
            ViewData["info"]   = info;
            return(View());
        }
Esempio n. 7
0
        public SystemModual SystemModual_SelectBym_gid(string m_gid)
        {
            DbCommand dbCmd = db.GetStoredProcCommand("Proc_SystemModual_SelectBym_gid");

            db.AddInParameter(dbCmd, "@m_gid", DbType.String, m_gid);
            SystemModual obj = null;

            try
            {
                using (IDataReader reader = db.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        obj = Obj2Model <SystemModual>(reader);
                    }
                }
                return(obj);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Esempio n. 8
0
        public ActionResult ModuleEdit()
        {
            string m_gid        = Request["m_gid"] ?? string.Empty;
            string m_name       = Request["m_name"] ?? string.Empty;
            string g_gid        = Request["moduleGroup"] ?? string.Empty;
            string moduleGrade  = Request["moduleGrade"] ?? string.Empty;
            string m_controller = Request["m_controller"] ?? string.Empty;
            string m_action     = Request["m_action"] ?? string.Empty;
            string modulePart   = Request["modulePart"] ?? string.Empty;
            string m_path       = Request["m_path"] ?? string.Empty;


            SystemModual info = null;

            if (string.IsNullOrEmpty(m_gid))
            {
                info = new SystemModual();
                //新增
                string guid = Guid.NewGuid().ToString().Substring(0, 8);
                info.m_gid        = guid;
                info.m_g_gid      = g_gid;
                info.m_createTime = DateTime.Now;
                info.m_createUser = SiteHelp.CurrentUserName;
            }
            else
            {
                info = SystemSeviceClass.SystemModual_SelectBym_gid(m_gid);
            }

            if (moduleGrade == "0")//一级元素
            {
                info.m_parent     = 0;
                info.m_parent_gid = string.Empty;
            }
            else if (moduleGrade == "1" && !string.IsNullOrEmpty(modulePart))//二级元素
            {
                info.m_parent     = modulePart.Split(new[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[0].ToInt32();
                info.m_parent_gid = modulePart.Split(new[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[1];
            }
            info.m_path       = m_path;
            info.m_name       = m_name;
            info.m_Controller = m_controller;
            info.m_Action     = m_action;

            if (string.IsNullOrEmpty(m_gid))
            {
                int result = SystemSeviceClass.SystemModual_Insert(info);
                if (result > 0)
                {
                    return(Json(new { success = true, errors = new { text = "新增成功" } }));
                }
                else
                {
                    return(Json(new { success = false, errors = new { text = "新增失败" } }));
                }
            }
            else
            {
                int result = SystemSeviceClass.SystemModual_UpdateBym_gid(info);
                if (result > 0)
                {
                    return(Json(new { success = true, errors = new { text = "修改成功" } }));
                }
                else
                {
                    return(Json(new { success = false, errors = new { text = "修改失败" } }));
                }
            }
        }