public void GetCompanyInfoList()
        {
            ConditionExpression ce = null;
            QueryCondition      qc = new QueryCondition();

            ce             = new ConditionExpression();
            ce.ExpName     = "PreCode";
            ce.ExpValue    = "10";
            ce.ExpOperater = eConditionOperator.Equal;
            ce.ExpLogical  = eLogicalOperator.And;
            qc.ConditionList.Add(ce);

            ce             = new ConditionExpression();
            ce.ExpName     = "Type";
            ce.ExpValue    = "Owner";
            ce.ExpOperater = eConditionOperator.NotEqual;
            ce.ExpLogical  = eLogicalOperator.Or;
            qc.ConditionList.Add(ce);

            SortExpression sort = new SortExpression("PreCode", eSortType.Asc);

            qc.SortList.Add(sort);

            qc.PageInfo.isAllowPage = false;
            Result <List <Base_Company> > result = new Result <List <Base_Company> >();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result            = proxy.GetCompanyList(qc);
                ViewBag.CompanyId = result.Data.ToSelectList("Name", "Id", true);
            }
        }
        public ActionResult SelectCompany(string IsMultiple = "", string name = "", int pageIndex = 1, int pageSize = 8)
        {
            QueryCondition      qc = new QueryCondition();
            ConditionExpression ce = null;

            if (!string.IsNullOrEmpty(name))
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "Name";
                ce.ExpValue    = "%" + name + "%";
                ce.ExpOperater = eConditionOperator.Like;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }

            qc.PageInfo = GetPageInfo(pageIndex, pageSize);

            Result <List <Base_Company> > result = new Result <List <Base_Company> >();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                //result = proxy.GetCompanyList(qc);
                ViewBag.Total     = result.AllRowsCount;
                ViewBag.TotalPage = Math.Ceiling((decimal)result.AllRowsCount / pageSize);
            }
            ViewBag.IsMultiple = IsMultiple;
            ViewBag.pageIndex  = pageIndex;

            return(View(result.Data));
        }
Exemple #3
0
        public ActionResult AddUserFace()
        {
            Result <int>        result = new Result <int>();
            ResultView <string> view   = new ResultView <string>();
            long   userId = Request.Form["userId"].ToLongReq();
            string image  = Request.Form["ImageInfo"];
            Bitmap bmp    = new Bitmap(image);

            MemoryStream ms = new MemoryStream();

            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            byte[] arr = new byte[ms.Length];
            ms.Position = 0;
            ms.Read(arr, 0, (int)ms.Length);
            ms.Close();
            image = Convert.ToBase64String(arr);

            if (string.IsNullOrEmpty(image))
            {
                view.Flag    = false;
                view.Message = "请上传图片!";
                return(Json(view));
            }

            string source = RoleType.Admin.ToString();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddAIUserFaceInfo(userId, image, source);
            }
            return(Json(result.ToResultView()));
        }
Exemple #4
0
        public ActionResult SetRoleFun(string id, RoleType belong, string ids)
        {
            //权限检查
            //Helper.IsCheck(HttpContext, AdminModule.AdminUserManager.ToString(), SystemRight.SetRole.ToString(), true);

            //Result<int> result = new Result<int>();
            //List<long> list = ids.SplitString(",").ToLongList();//角色列表
            //using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            //{
            //    result = proxy.SetUserRole(id, list, belong);
            //}
            //return Json(result.ToResultView());
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminUserManager.ToString(), SystemRight.SetRole.ToString(), true);

            Result <int> result   = new Result <int>();
            List <long>  list     = ids.SplitString(",").ToLongList(); //角色列表
            List <long>  userList = id.SplitString(",").ToLongList();  //用户列表

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                for (int i = 0; i < userList.Count; i++)
                {
                    result = proxy.SetUserRole(userList[i], list, belong);
                }
            }
            return(Json(result.ToResultView()));
        }
        public ActionResult ChangePasswod(string oldPWD, string newPWD, string confirmPWD)
        {
            oldPWD = DesTool.DesEncrypt(oldPWD);

            ResultView <int> view = new ResultView <int>();

            if (newPWD != confirmPWD)
            {
                view.Flag    = false;
                view.Message = "请重新确认密码!";
                return(Json(view));
            }
            Result <Base_User> userResult = new Result <Base_User>();
            Result <int>       result     = new Result <int>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                var id = CurrentUser.UserId;
                userResult = proxy.GetUserModel(id);
                if (userResult.Data.PassWord != oldPWD)
                {
                    view.Flag    = false;
                    view.Message = "原密码输入错误!";
                    return(Json(view));
                }
                else
                {
                    result = proxy.UpdateUserPassword(id, DesTool.DesEncrypt(newPWD));
                }
            }
            return(Json(result.ToResultView()));
        }
        /// <summary>
        /// 获取企业详情
        /// </summary>
        /// <param name="id"></param>
        /// <param name="belong"></param>
        /// <returns></returns>
        public ActionResult Detail(long id)
        {
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminOrganization.ToString(), SystemRight.Info.ToString(), true);

            Result <Base_Company> result = new Result <Base_Company>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetCompanyModel(id);
                if (string.IsNullOrEmpty(result.Data.Address))
                {
                    ViewBag.Address = "";
                }
                else
                {
                    var code = result.Data.Address.Split(',')[2];
                    ViewBag.Address = proxy.GetRegionModel(code).Data.Fullname;
                }
                if (string.IsNullOrEmpty(result.Data.PreCode))
                {
                    result.Data.PreCode = "无上级单位";
                }
                if (string.IsNullOrEmpty(result.Data.PreName))
                {
                    result.Data.PreName = "无上级单位";
                }
            }
            return(View(result.Data));
        }
        public ActionResult Edit(Epm_OilStation model)
        {
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminOrganization.ToString(), SystemRight.Modify.ToString(), true);

            Result <int>        result = new Result <int>();
            ResultView <string> view   = new ResultView <string>();

            if (string.IsNullOrEmpty(model.Code1))
            {
                view.Flag    = false;
                view.Message = "单位编码不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.Code))
            {
                view.Flag    = false;
                view.Message = "编号不能为空";
                return(Json(view));
            }

            Result <Epm_OilStation> OilStationResult = new Result <Epm_OilStation>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                OilStationResult                  = proxy.GetOilStation(model.Id);
                OilStationResult.Data.Code        = model.Code;
                OilStationResult.Data.Code1       = model.Code1;
                OilStationResult.Data.Name        = model.Name;
                OilStationResult.Data.Description = model.Description;
                OilStationResult.Data.Address     = model.Address;
                result = proxy.UpdateOilStation(model);
            }
            return(Json(result.ToResultView()));
        }
Exemple #8
0
        public ActionResult Add(Base_Role model)
        {
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminRole.ToString(), SystemRight.Add.ToString(), true);

            ResultView <int>  view       = new ResultView <int>();
            ResultView <bool> checkRight = new ResultView <bool>();

            if (string.IsNullOrEmpty(model.RoleName))
            {
                view.Flag    = false;
                view.Message = "角色名不能为空";
                return(Json(view));
            }

            model.Belong = RoleType.Owner.ToString();

            Result <int> result = new Result <int>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddRole(model);
                view   = result.ToResultView();
            }
            return(Json(view));
        }
        /// <summary>
        /// 添加考勤设置
        /// </summary>
        /// <returns></returns>
        public ActionResult Add()
        {
            DateTime time = DateTime.Now;
            var      h    = time.ToShortTimeString();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                List <DictionaryType> dic = new List <DictionaryType>()
                {
                    DictionaryType.PostType
                };
                var diclist = proxy.GetTypeListByTypes(dic).Data;
                //岗位
                var list = diclist[DictionaryType.PostType].Where(t => t.CreateUserName == "admin").ToList();
                ViewBag.list = list;
            }

            Result <AttendanceView> result = new Result <AttendanceView>();

            using (BusinessClientProxy proxy = new BusinessClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetAttendanceModel();
            }

            return(View(result.Data));
        }
        public ActionResult Add(Base_Settings model)
        {
            ResultView <int> view = new ResultView <int>();

            if (string.IsNullOrEmpty(model.Code))
            {
                view.Flag    = false;
                view.Message = "编码不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.Name))
            {
                view.Flag    = false;
                view.Message = "名称不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.Value))
            {
                view.Flag    = false;
                view.Message = "值不能为空";
                return(Json(view));
            }

            Result <int> result = new Result <int>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddSettings(model);
            }
            return(Json(result.ToResultView()));
        }
Exemple #11
0
        /// <summary>
        /// 修改权限
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(long id)
        {
            //父级权限,名称,类型不可修改
            Result <Base_Right> result = new Result <Base_Right>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetRightModel(id);
            }
            var model = result.Data;

            Helper.IsCheck(HttpContext, model.Belong + "Right", SystemRight.Modify.ToString(), true);

            Dictionary <string, string> isMenuList = new Dictionary <string, string>();

            isMenuList.Add("False", "否");
            isMenuList.Add("True", "是");
            ViewBag.IsMenu = isMenuList.ToList().ToSelectList("Value", "Key", false, model.IsMenu.ToString());

            RoleType rType = model.Belong.ToEnumReq <RoleType>();

            if (rType == RoleType.Admin)
            {
                ViewBag.RightType = Enum <FunctionType> .AsEnumerable().ToDictionary(i => i.ToString(), j => j.GetText()).ToList().ToSelectList("Value", "Key", false, model.RightType);
            }
            else
            {
                ViewBag.RightType = Enum <WebFunctionType> .AsEnumerable().ToDictionary(i => i.ToString(), j => j.GetText()).ToList().ToSelectList("Value", "Key", false, model.RightType);
            }
            //ViewBag.RightType = Enum<FunctionType>.AsEnumerable().ToDictionary(i => i.ToString(), j => j.GetText()).ToList().ToSelectList("Value", "Key", false, model.RightType);
            return(View(model));
        }
Exemple #12
0
        public ActionResult Activated(string id)
        {
            ResultView <string> view = new ResultView <string>();

            if (string.IsNullOrWhiteSpace(id))
            {
                view.Flag    = false;
                view.Message = "请选择要激活的设备!";
                return(Json(view));
            }
            long idValue = 0;

            if (!long.TryParse(id, out idValue))
            {
                view.Flag    = false;
                view.Message = "激活设备操作失败!";
                return(Json(view));
            }

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                var result = proxy.ActivatedVideo(idValue);
                return(View(result.ToResultView()));
            }
        }
Exemple #13
0
        // GET: Dep/Edit/5
        public ActionResult Edit(long id)
        {
            Result <Base_Dep> result = new Result <Base_Dep>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.GeDepModel(id);
            }
            var isConfirm = result.Data.IsConfirm ? EnumState.Confirmed.ToString() : EnumState.NoConfim.ToString();
            var isEnable  = result.Data.IsEnable ? EnumState.Enable.ToString() : EnumState.Disable.ToString();

            ViewBag.IsEnable  = HelperExt.GetEnableList(false, isEnable);
            ViewBag.IsConfirm = HelperExt.GetConfirmList(false, isConfirm);
            var companyId = result.Data.CompanyId;
            Result <List <Base_Dep> > resultDep = new Result <List <Base_Dep> >();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                resultDep = proxy.GeDepListByCompanyId(companyId);
                var depList = resultDep.Data;
                if (result.Data.PreId == "0")
                {
                    ViewBag.PreId = depList.ToSelectList("Name", "Id", true);
                }
                else
                {
                    ViewBag.PreId = depList.ToSelectList("Name", "Id", false, result.Data.PreId);
                }
            }
            return(View(result.Data));
        }
Exemple #14
0
        /// <summary>
        /// session检查
        /// </summary>
        /// <param name="filterContext"></param>
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            try
            {
                var userId = Request.QueryString.Get("UserId");
                userId = "897711908373794816";
                using (AdminClientProxy proxy = new AdminClientProxy(ProxyExNoLogin(Request)))
                {
                    var user = proxy.GetUserModel(userId.ToLongReq()).Data;

                    UserView mv = new UserView();
                    mv.UserId    = user.Id;
                    mv.UserCode  = user.UserCode;
                    mv.UserName  = user.UserAcct;
                    mv.RealName  = user.UserName;
                    mv.Phone     = user.Phone;
                    mv.Email     = user.Email;
                    mv.CompanyId = user.CompanyId;
                    mv.RoleType  = RoleType.Admin;
                    Session[ConstStr_Session.CurrentUserEntity] = mv;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult Add()
        {
            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                //根据字典类型集合获取字典数据
                List <DictionaryType> typeList = new List <DictionaryType>()
                {
                    DictionaryType.AdType
                };
                var types = proxy.GetTypeListByTypes(typeList).Data;

                //返回新闻分类列表
                ViewBag.SelAdTypeName = types[DictionaryType.AdType].ToSelectList("Name", "Id", true);
            }

            //广告位下拉框数据
            Result <List <Epm_AdTarget> > list = new Result <List <Epm_AdTarget> >();

            using (BusinessClientProxy proxy = new BusinessClientProxy(ProxyEx(Request)))
            {
                list = proxy.GetAdTargetList();
            }
            ViewBag.AdTargetList = list.Data;

            return(View());
        }
Exemple #16
0
        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Detail(long id)
        {
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminUserManager.ToString(), SystemRight.Info.ToString(), true);
            Result <Base_User> result = new Result <Base_User>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetUserModel(id);

                ViewBag.CompanyName = "本省销售公司";
                if (result.Data.CompanyId != 10)
                {
                    var company = proxy.GetCompanyModel(result.Data.CompanyId).Data;
                    if (company != null && company.Type == RoleType.Supplier.ToString())
                    {
                        ViewBag.CompanyName = company.Name;
                    }
                }

                if (string.IsNullOrEmpty(result.Data.Address))
                {
                    ViewBag.Address = "";
                }
                else
                {
                    var code = result.Data.Address.Split(',')[2];
                    ViewBag.Address = proxy.GetRegionModel(code).Data.Fullname;
                }
            }
            return(View(result.Data));
        }
        /// <summary>
        /// 获取权限树
        /// </summary>
        /// <param name="belong"></param>
        /// <param name="pId"></param>
        /// <returns></returns>
        public RightNode GetRightTree(RoleType roleType, long pId, long userId)
        {
            Result <List <Base_Right> > result = new Result <List <Base_Right> >();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.LoadRightList(roleType, userId);
            }
            RightNode rootTree = new RightNode();

            var list = result.Data.Where(i => i.IsMenu).ToList();

            list.Insert(0, Helper.AdminSite);

            var first = list.FirstOrDefault(i => i.Id == pId);

            rootTree.checkboxValue = first.Id.ToString();
            rootTree.@checked      = false;
            rootTree.data          = new { code = first.Code, id = first.SId, url = string.IsNullOrEmpty(first.URL) ? "javascript:void(0);" : first.URL, icon = string.IsNullOrEmpty(first.Icon) ? "" : first.Icon, target = string.IsNullOrEmpty(first.Target) ? "" : first.Target, display = string.IsNullOrEmpty(first.DisplayName) ? first.Name : first.DisplayName };
            rootTree.name          = first.Name;
            rootTree.spread        = true;

            var tree = createTree(first.Id, list);

            rootTree.children = tree;
            return(rootTree);;
        }
Exemple #18
0
        /// <summary>
        /// 修改广告投放
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit(long id)
        {
            //广告位下拉框数据
            Result <List <Epm_AdTarget> > list   = new Result <List <Epm_AdTarget> >();
            Result <Epm_AdPutRecord>      adList = new Result <Epm_AdPutRecord>();

            using (BusinessClientProxy proxy = new BusinessClientProxy(ProxyEx(Request)))
            {
                list   = proxy.GetAdTargetList();
                adList = proxy.GetAdPutRecordById(id);
            }
            //广告位类型下拉框数据
            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                //根据字典类型集合获取字典数据
                List <DictionaryType> typeList = new List <DictionaryType>()
                {
                    DictionaryType.AdType
                };
                var types = proxy.GetTypeListByTypes(typeList).Data;
                //返回新闻分类列表
                ViewBag.SelAdTypeName = types[DictionaryType.AdType].ToSelectList("Name", "No", true, adList.Data.AdTypeNo);
            }

            ViewBag.AdTargetList = list.Data;

            return(View(adList.Data));
        }
Exemple #19
0
        /// <summary>
        /// 获取企业详情
        /// </summary>
        /// <param name="id"></param>
        /// <param name="belong"></param>
        /// <returns></returns>
        public ActionResult Detail(long id, string belong)
        {
            Result <Base_Company> result = new Result <Base_Company>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetCompanyModel(id);
                if (string.IsNullOrEmpty(result.Data.Address))
                {
                    ViewBag.Address = "";
                }
                else
                {
                    var code = result.Data.Address.Split(',')[2];
                    ViewBag.Address = proxy.GetRegionModel(code).Data.Fullname;
                }
                if (string.IsNullOrEmpty(result.Data.PreCode))
                {
                    result.Data.PreCode = "无上级单位";
                }
                if (string.IsNullOrEmpty(result.Data.PreName))
                {
                    result.Data.PreName = "无上级单位";
                }
            }
            return(View(result.Data));
        }
Exemple #20
0
        public ActionResult Edit(Base_Company model, string belong)
        {
            model.Type = belong;
            Result <int>        result = new Result <int>();
            ResultView <string> view   = new ResultView <string>();

            if (string.IsNullOrEmpty(model.Name))
            {
                view.Flag    = false;
                view.Message = "名称不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.Code))
            {
                view.Flag    = false;
                view.Message = "编号不能为空";
                return(Json(view));
            }

            string            fileDataJson = Request.Form["fileDataJson"];                                     //获取上传文件json字符串
            List <Base_Files> fileList     = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符串序列化为列表

            Result <Base_Company> companyResult = new Result <Base_Company>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                companyResult = proxy.GetCompanyModel(model.Id);
                model.PreName = companyResult.Data.PreName;
                model.PreCode = companyResult.Data.PreCode;
                model.PId     = companyResult.Data.PId;
                result        = proxy.UpdateCompany(model, fileList);
            }
            return(Json(result.ToResultView()));
        }
Exemple #21
0
        public ActionResult Add(Base_Company model, string belong)
        {
            model.Type = belong;

            string            fileDataJson = Request.Form["fileDataJson"];                                     //获取上传文件json字符串
            List <Base_Files> fileList     = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符串序列化为列表

            Result <int>          result        = new Result <int>();
            Result <Base_Company> companyResult = new Result <Base_Company>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                //获取上级单位信息
                if (model.PId == 0)
                {
                    model.PreName = null;
                    model.PreCode = null;
                }
                else
                {
                    companyResult = proxy.GetCompanyModel(model.PId);
                    model.PreName = companyResult.Data.Name; //上级单位名称
                    model.PreCode = companyResult.Data.Code; //上级单位编号
                }

                result = proxy.AddCompany(model, fileList);
            }
            return(Json(result.ToResultView()));
        }
        public ActionResult Add(Base_TypeDictionary model)
        {
            ResultView <int> view = new ResultView <int>();

            //表单验证
            if (string.IsNullOrEmpty(model.Name))
            {
                view.Flag    = false;
                view.Message = "名称不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.No))
            {
                view.Flag    = false;
                view.Message = "编号不能为空";
                return(Json(view));
            }
            Result <int> result = new Result <int>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddType(model);
            }
            return(Json(result.ToResultView()));
        }
        /// <summary>
        /// 审核日志
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="tableId"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ActionResult AutigLog(string tableName = "", string tableId = "", string startTime = "", string endTime = "", int pageIndex = 1, int pageSize = 10)
        {
            ViewBag.moduleName = tableName;
            ViewBag.actionDesc = tableId;

            ViewBag.startTime = startTime;
            ViewBag.endTime   = endTime;

            ViewBag.pageIndex = pageIndex;
            ConditionExpression ce = null;
            QueryCondition      qc = new QueryCondition();

            if (!string.IsNullOrEmpty(tableName))
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "tableName";
                ce.ExpValue    = "%" + tableName + "%";
                ce.ExpOperater = eConditionOperator.Like;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            if (!string.IsNullOrEmpty(tableId))
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "tableId";
                ce.ExpValue    = tableId;
                ce.ExpOperater = eConditionOperator.Like;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            if (!string.IsNullOrEmpty(startTime))
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "CreateTime";
                ce.ExpValue    = startTime.ToDateTimeReq();
                ce.ExpOperater = eConditionOperator.GreaterThanOrEqual;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            if (!string.IsNullOrEmpty(endTime))
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "CreateTime";
                ce.ExpValue    = endTime.ToDateTimeReq();
                ce.ExpOperater = eConditionOperator.LessThanOrEqual;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            qc.PageInfo = GetPageInfo(pageIndex, pageSize);
            Result <List <Base_StatusLog> > result = new Result <List <Base_StatusLog> >();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetStatusLogList(qc);

                ViewBag.TotalPage = Math.Ceiling((decimal)result.AllRowsCount / pageSize);
            }
            return(View(result.Data));
        }
Exemple #24
0
        public ActionResult Edit(Base_User model)
        {
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminUserManager.ToString(), SystemRight.Modify.ToString(), true);

            ResultView <int> view = new ResultView <int>();

            if (string.IsNullOrEmpty(model.UserCode))
            {
                view.Flag    = false;
                view.Message = "用户编码不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.UserAcct))
            {
                view.Flag    = false;
                view.Message = "登录账号不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.UserName))
            {
                view.Flag    = false;
                view.Message = "用户名称不能为空";
                return(Json(view));
            }

            string            fileDataJson = Request.Form["fileDataJsonFile"];                                 //获取上传文件json字符串
            List <Base_Files> fileList     = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符串序列化为列表

            Result <int> result = new Result <int>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                var oldData = proxy.GetUserModel(model.Id).Data;
                oldData.UserName          = model.UserName;
                oldData.UserAcct          = model.UserAcct;
                oldData.Sex               = model.Sex;
                oldData.UserCode          = model.UserCode;
                oldData.Email             = model.Email;
                oldData.Phone             = model.Phone;
                oldData.QQ                = model.QQ;
                oldData.Post              = model.Post;                                          //岗位
                oldData.PostValue         = model.PostValue;                                     //岗位值
                oldData.ProfessionalValue = model.ProfessionalValue;                             //职称
                oldData.Education         = model.Education;                                     //学历
                oldData.CompanyId         = model.CompanyId;                                     //单位
                oldData.Email             = model.Email;                                         //邮箱
                oldData.BirthDate         = model.BirthDate;                                     //生日
                oldData.University        = model.University;
                oldData.Major             = model.Major;                                         //专业名称
                oldData.Address           = model.Address;                                       //地址
                oldData.ProfessionalQualificationValue = oldData.ProfessionalQualificationValue; //资质
                oldData.OccupationalStartTime          = model.OccupationalStartTime;            //职业日期
                oldData.OccupationalContent            = model.OccupationalContent;              //职业简述
                result = proxy.UpdateUser(oldData, fileList);
            }
            return(Json(result.ToResultView()));
        }
Exemple #25
0
        public ActionResult Index(string RoleName = "", string IsEnable = "0", string IsConfirm = "0", int pageIndex = 1, int pageSize = 10)
        {
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminRole.ToString(), SystemRight.Browse.ToString(), true);

            ViewBag.RoleName  = RoleName;
            ViewBag.pageIndex = pageIndex;
            ViewBag.IsConfirm = HelperExt.GetConfirmList(true, IsConfirm);
            ViewBag.IsEnable  = HelperExt.GetEnableList(true, IsEnable);
            ConditionExpression ce = null;
            QueryCondition      qc = new QueryCondition();

            ce = new ConditionExpression();

            if (!string.IsNullOrEmpty(RoleName))
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "RoleName";
                ce.ExpValue    = "%" + RoleName + "%";
                ce.ExpOperater = eConditionOperator.Like;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            if (IsEnable != "0")
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "IsEnable";
                ce.ExpValue    = IsEnable == EnumState.Enable.ToString();
                ce.ExpOperater = eConditionOperator.Equal;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            if (IsConfirm != "0")
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "IsConfirm";
                ce.ExpValue    = IsConfirm == EnumState.Confirmed.ToString();
                ce.ExpOperater = eConditionOperator.Equal;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            qc.PageInfo = GetPageInfo(pageIndex, pageSize);
            Result <List <Base_Role> > result = new Result <List <Base_Role> >();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.GetRoleList(qc);

                foreach (var item in result.Data)
                {
                    item.Remark   = item.Remark.CutByByteLength(200, "...");
                    item.RoleName = item.RoleName.CutByByteLength(15, "...");
                }

                ViewBag.Total = result.AllRowsCount;
            }
            return(View(result.Data));
        }
Exemple #26
0
        public ActionResult GetRightTree(string belong, long pId = 0, bool last = true, string chk = "")
        {
            //权限检查
            Helper.IsCheck(HttpContext, belong + "Right", SystemRight.Browse.ToString(), true);

            Result <List <Base_Right> > result = new Result <List <Base_Right> >();
            RoleType roleType = belong.ToEnumReq <RoleType>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.LoadRightList(roleType);
            }
            Base_Right right = null;
            var        list  = result.Data;
            var        be    = belong.ToEnumReq <RoleType>();

            switch (be)
            {
            case RoleType.Admin:
                list.Insert(0, Helper.AdminSite);
                break;

            //case RoleType.Tenderer:
            //    break;
            //case RoleType.BiddingAgent:
            //    list.Insert(0, Helper.BiddingAgentSite);
            //    break;
            //case RoleType.Bidder:
            //    break;
            //case RoleType.Exp:
            //    break;
            default:
                right        = Helper.WebSite;
                right.Belong = roleType.ToString();
                list.Insert(0, right);
                break;
            }


            var       first    = list.FirstOrDefault(i => i.Id == pId);
            RightNode rootTree = new RightNode();

            rootTree.checkboxValue = first.Id.ToString();
            rootTree.@checked      = chk == first.Id.ToString();
            rootTree.data          = new { code = first.Code, id = first.Id.ToString() };
            rootTree.name          = first.Name;
            rootTree.spread        = true;

            var tree = createTree(first.Id, list);

            if (!last)
            {
                tree = createTreeNoLast(first.Id, list, chk);
            }
            rootTree.children = tree;
            return(Json(rootTree, JsonRequestBehavior.AllowGet));;
        }
        public ActionResult GetRightTree(string belong, long roleId)
        {
            if (belong != "Admin")
            {
                belong = "Owner";
            }
            Result <List <Base_Right> > result = new Result <List <Base_Right> >();
            RoleType roleType = belong.ToEnumReq <RoleType>();

            Result <List <Base_RoleRight> > roleRight = new Result <List <Base_RoleRight> >();
            List <long> roleRightIds = new List <long>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.LoadRightList(roleType);
                //获取角色的所有权限
                roleRight = proxy.GetRightByRoleIds(new List <long>()
                {
                    roleId
                });
                if (roleRight.Data != null && roleRight.Data.Any())
                {
                    roleRightIds = roleRight.Data.Select(i => i.RightId).ToList();
                }
            }
            Base_Right right = null;
            var        list  = result.Data;

            switch (roleType)
            {
            case RoleType.Admin:    //管理员
                list.Insert(0, Helper.AdminSite);
                break;

            default:    //业务应用站点,包括(业主,监理,施工,咨询,设计)
                right        = Helper.WebSite;
                right.Belong = roleType.ToString();
                list.Insert(0, right);
                break;
            }


            var       first    = list.FirstOrDefault(i => i.Id == 0);
            RightNode rootTree = new RightNode();

            rootTree.checkboxValue = first.Id.ToString();
            rootTree.@checked      = roleRightIds.Count() > 0;
            rootTree.data          = new { code = first.Code, id = first.Id.ToString() };
            rootTree.name          = first.Name;
            rootTree.spread        = true;

            var tree = createTree(first.Id, list, roleRightIds);

            rootTree.children = tree;
            return(Json(rootTree, JsonRequestBehavior.AllowGet));;
        }
Exemple #28
0
        /// <summary>
        /// 权限检查
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="module">模块</param>
        /// <param name="right">权限</param>
        /// <returns></returns>
        public static ResultView <bool> IsCheckAjax(HttpContextBase httpContext, string module, string right)
        {
            bool isOK = true;

            if (httpContext == null)
            {
                isOK = false;
                throw new ArgumentNullException("HttpContext");
            }

            if (string.IsNullOrEmpty(module))
            {
                isOK = false;;
            }
            if (string.IsNullOrEmpty(right))
            {
                isOK = false;;
            }
            //用户session为空,不通过
            var userInfo = httpContext.Session[ConstStr_Session.CurrentUserEntity] as UserView;

            if (userInfo == null)
            {
                isOK = false;;
                return(NoUserJson);
            }
            else
            {
                //根据模块和action获取权限
                long rightId = 0;
                Result <List <Base_Right> > result = new Result <List <Base_Right> >();
                using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(httpContext, userInfo)))
                {
                    result = proxy.LoadRightList(userInfo.RoleType, userInfo.UserId);
                    var model = result.Data.FirstOrDefault(i => i.ParentCode == module && i.Code == right);
                    if (model == null)
                    {
                        isOK = false;
                    }
                    else
                    {
                        rightId = model.Id;
                    }
                }
                //没有权限,不通过
                if (!userInfo.RightIds.Contains(rightId))
                {
                    isOK = false;;
                }
            }
            if (!isOK)
            {
                return(UnAuthorizedJson);
            }
            return(AuthorizedJson);
        }
        public ActionResult Edit(Base_Config model)
        {
            Result <int> result = new Result <int>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.UpdateConfig(model);
            }
            return(Json(result.ToResultView()));
        }
        public ActionResult Edit()
        {
            Result <Base_Config> result = new Result <Base_Config>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                result = proxy.LoadConfig();
            }
            return(View(result.ToResultView(true).Data));
        }