示例#1
0
        /// <summary>
        /// 获取当前用户所在的BUG组
        /// </summary>
        /// <returns></returns>
        private EnumBugUserGroup CurrentUserRole()
        {
            EnumBugUserGroup result = new EnumBugUserGroup();

            try
            {
                var UserName = SessionConfig.UserName();
                var CurRole  = BugUserGroup().Where(o => o.Dict_Code == UserName).First();
                if (CurRole != null)
                {
                    result = (EnumBugUserGroup)Enum.Parse(typeof(EnumBugUserGroup), CurRole.Dict_UDef1);
                }
            }
            catch (System.Exception ex)
            {
                result = EnumBugUserGroup.GDev;
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// 获取当前用户所在的BUG组
        /// </summary>
        /// <returns></returns>
        private EnumBugUserGroup CurrentUserRole()
        {
            EnumBugUserGroup result = new EnumBugUserGroup();
            try
            {
                var UserName = SessionConfig.UserName();
                var CurRole = BugUserGroup().Where(o => o.Dict_Code == UserName).First();
                if (CurRole != null)
                {
                    result = (EnumBugUserGroup)Enum.Parse(typeof(EnumBugUserGroup), CurRole.Dict_UDef1);
                }
            }
            catch (System.Exception ex)
            {
                result = EnumBugUserGroup.GDev;
            }

            return result;
        }
示例#3
0
        /// <summary>
        /// Bug操作
        /// </summary>
        /// <param name="id"></param>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="search"></param>
        /// <param name="sidx"></param>
        /// <param name="sord"></param>
        /// <returns></returns>
        public ActionResult GetList(string id, int page, int rows, string search, string sidx, string sord)
        {
            //获取当前用户BUG组别
            var UserName          = SessionConfig.UserName();
            var RoleSql           = "";
            EnumBugUserGroup Role = CurrentUserRole();

            switch (Role)
            {
            case EnumBugUserGroup.GDev:
                RoleSql = " AND (Sys_UserName='******' or Sys_Owner='" + UserName + "' )  ";
                break;

            case EnumBugUserGroup.GTest:
                RoleSql = " AND (Sys_UserName='******' or Sys_Owner='" + UserName + "') ";
                break;

            case EnumBugUserGroup.GAdmin:
                break;

            default:
                break;
            }

            List <Sys_Bug> list       = new List <Sys_Bug>();
            string         filters    = Request["filters"];
            string         filtersSql = string.Empty;

            if (!string.IsNullOrEmpty(filters))
            {
                filtersSql = " AND  " + filters.BuildSearch("Sys_BugModule");
            }
            if (!string.IsNullOrEmpty(id))
            {
                filtersSql += "and Sys_Project='" + id + "'";
            }
            if (!string.IsNullOrEmpty(RoleSql))
            {
                filtersSql += RoleSql;
            }

            if (!string.IsNullOrEmpty(filtersSql))
            {
                list = bugInstance.GetListByCode(filtersSql);
            }
            else
            {
                list = bugInstance.GetAll();
            }

            //字典
            if (list.Count() > 0)
            {
                foreach (var item in list)
                {
                    var dictModel = dictInstance.GetModel(" AND Dict_Code='" + item.Sys_Status + "'");
                    if (dictModel != null)
                    {
                        item.Sys_Status = dictModel.Dict_Name;
                    }
                }
            }

            var model  = list.AsQueryable <Sys_Bug>();
            var result = JsonConvert.SerializeObject(model.ToJqGridData(page, rows, null, search, null), new JsonDateConverter("yyyy-MM-dd HH:mm"));

            return(JavaScript(result));
        }