示例#1
0
        public OperationVm(byte orderFrom, int quoteId)
        {
            OrderFrom       = orderFrom;
            CreateDate      = DateTime.Now;
            OperationDate   = DateTime.Now;
            StatusId        = 1;
            IsConsolidation = false;
            IsFixedCost     = true;
            CarrierType     = 1;
            if (quoteId != 0)
            {
                QuoteId = quoteId;
            }
            if (orderFrom == 2)
            {
                NotifierAsConsignee = true;
                OperationCode       = AdminHelper.GeneratePrefixCode(PrefixForEnum.Import, false);
            }
            else
            {
                OperationCode = AdminHelper.GeneratePrefixCode(PrefixForEnum.Export, false);
            }



            OperationContainers = new List <OperationContainerVm>();
        }
        public ActionResult Esignering()
        {
            // vis signeringsoppdrag for innlogget bruker (eller alle for superbruker)
            // MinSide for enhetsledere?
            // knapp for å sende purring (til alle eller en og en)

            var responseAktiv    = AdminHelper.HentAktiveSigneringsoppdragForBruker(GetUsername());
            var responseFullfort = AdminHelper.HentFullforteSigneringsoppdragForBruker(GetUsername());

            if (responseAktiv.Success && responseFullfort.Success)
            {
                ViewBag.AktiveOppdrag    = responseAktiv.Get();
                ViewBag.FullforteOppdrag = responseFullfort.Get();
            }
            else if (!responseAktiv.Success)
            {
                ViewBag.ErrorMsgGlobal = responseAktiv.Message;
            }
            else
            {
                ViewBag.ErrorMsgGlobal = responseFullfort.Message;
            }

            return(View());
        }
示例#3
0
        public ActionResult Add(HouseAddNewDTO house)
        {
            long userId = (long)AdminHelper.GetUserId(HttpContext);
            var  user   = AdminUserService.GetById(userId);

            if (user.CityId == null)
            {
                //TODO如果“总部不能***”的操作很多,也可以定义成一个AuthorizeFilter
                //最好用FilterAttribute的方式标注,这样对其他的不涉及这个问题的地方效率高
                //立即实现
                return(View("ERROR", (object)"总部不能进行房源管理"));
            }
            var houseId = HouseService.AddNew(house);

            if (houseId > 0)
            {
                //生成房源查看的html文件
                CreateStaticPages(houseId);
                return(Json(new AjaxResult()
                {
                    Status = "ok"
                }));
            }

            return(Json(new AjaxResult()
            {
                Status = "error", ErrorMsg = "添加失败"
            }));
        }
        public ActionResult Message(MessageDTO dto)
        {
            var user = AdminHelper.GetUserId(HttpContext);

            if (user == null)
            {
                return(RedirectToAction("Login"));
            }
            dto.UserId = user.Id;
            var h1 = messageService.Add(dto);

            if (h1 > 0)
            {
                //return Json(new AjaxResult { Status = "ok" });
                return(Json(new AjaxResult {
                    Status = "ok"
                }));
            }
            else
            {
                //return Json(new AjaxResult { Status = "error",Data="选择失败" });
                return(Json(new AjaxResult {
                    Status = "error", Data = "留言失败"
                }));
            }
        }
示例#5
0
        public ActionResult CloseCC(int ccId, byte statusId, byte orderFrom = 1)
        {
            #region Check Rights
            bool hasRights = false;
            if (statusId == 4)      //Canceled .. will be from HB screen only
            {
                if (orderFrom == 1) //Check export rights
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportHB, ActionEnum.CancelCCOrder);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportHB, ActionEnum.CancelCCOrder);
                }
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.CustomClearanceOrders, ActionEnum.CloseOrder);
            }

            if (!hasRights)
            {
                return(Json("You are UnAuthorized to do this action"));
            }

            #endregion
            string isClosed = CustomClearanceHelper.CloseCC(ccId, statusId);
            return(Json(isClosed));
        }
示例#6
0
        public ActionResult Add()
        {
            long?userId = AdminHelper.GetUserId(HttpContext);
            long?cityId = userSerivce.GetById(userId.Value).CityId;

            if (cityId == null)
            {
                return(View("Error", (object)"总部不能进行房源管理"));
            }
            var regions          = regionService.GetAll(cityId.Value);
            var roomTypes        = idNameService.GetAll("户型");
            var statuses         = idNameService.GetAll("房屋状态");
            var decorateStatuses = idNameService.GetAll("装修状态");
            var attachments      = attService.GetAll();
            var types            = idNameService.GetAll("房屋类别");

            HouseAddViewModel model = new HouseAddViewModel();

            model.regions          = regions;
            model.roomTypes        = roomTypes;
            model.statuses         = statuses;
            model.decorateStatuses = decorateStatuses;
            model.attachments      = attachments;
            model.types            = types;
            return(View(model));
        }
        public ActionResult PaperList()
        {
            var user = AdminHelper.GetUserId(HttpContext);

            if (user == null)
            {
                return(RedirectToAction("Login"));
            }
            if (userService.GetById(user.Id).State != 2)
            {
                return(Content(CommonHelper.JumpAlertState(userService.GetById(user.Id).State.Value)));
            }

            /*
             * PaperListDTO data = new PaperListDTO();
             * data.paperdto = paperService.GetAll(); ;
             * var paperids = paperService.GetAll();
             * List<int> lst = new List<int>();
             * foreach (var item in paperids)
             * {
             *  lst.Add(GetScore(item.Id));
             * }
             * data.Score = lst.ToArray();
             */
            var djg = paperService.GetAll().OrderByDescending(e => e.CreateDateTime).FirstOrDefault();

            //return Redirect("/Home/Paper/"+ djg.Id);
            return(View(djg));
        }
示例#8
0
        public ActionResult AddHouse()
        {
            long?id     = AdminHelper.AdminUserId(HttpContext);
            long?cityId = AdminUserService.GetById(id.Value).CityId;

            if (cityId == null)
            {
                return(View("ERROR", "总部不能进行房源管理"));
            }
            var regions = RegionService.GetCityAll(cityId.Value).ToList();

            regions.Insert(0, new RegionDTO()
            {
                Id = 0, Name = "请选择"
            });
            var roomTypes           = IdNameService.GetAll("户型");
            var statuses            = IdNameService.GetAll("房屋状态");
            var decorateStatuses    = IdNameService.GetAll("装修状态");
            var attachments         = AttachmentService.GetAll();
            var types               = IdNameService.GetAll("房屋类别");
            HouseAddViewModel model = new HouseAddViewModel();

            model.Regions          = regions;
            model.RoomTypes        = roomTypes;
            model.Statuses         = statuses;
            model.DecorateStatuses = decorateStatuses;
            model.Attachments      = attachments;
            model.Types            = types;
            return(View(model));
        }
示例#9
0
        private void PopulateGrid()
        {
            if (ddlSite.SelectedIndex < 1)
            {
                return;
            }

            if (gvDocuments.Visible)
            {
                PopulateDocumentsGrid();
            }
            else if (gvSendTo.Visible)
            {
                PopulateSendToGrid();
            }
            else if (pnlRunNewBatch.Visible)
            {
                List <Batch> batches = AdminHelper.GetBatchesForSite(ddlSite.SelectedItem.Text);
                if (batches != null)
                {
                    lLastBatchRun.Text = "the last batch run date of " + batches[0].endDate.ToString("g");
                }
                else
                {
                    lLastBatchRun.Text = "the default time period of " + ConfigurationManager.AppSettings["DaysToCheckIfNoPreviousBatchRun"] + " days ago since there is no previous batch";
                }

                int numNewBatchDocuments = PopulateNewBatchDocumentsRepeater();
                pnlNoNewBatchDocuments.Visible   = (numNewBatchDocuments == 0);
                pnlNewBatchDocumentsHead.Visible = (numNewBatchDocuments > 0);
                rNewBatchDocuments.Visible       = (numNewBatchDocuments > 0);
                bRunBatch.Visible = (numNewBatchDocuments > 0);
            }
        }
示例#10
0
 public void FormatUserToken(HttpContext context, AppIdentity appinfo)
 {
     if (string.IsNullOrEmpty(appinfo.token))
     {
         appinfo.token = AdminHelper.GetCookie(context.Request);
     }
 }
示例#11
0
        protected void butEdit_onClick123(object sender, EventArgs e)
        {
            AdminHelper adminHelper = new AdminHelper();
            int         id          = int.Parse(((Button)sender).CommandName);

            Response.Redirect("~/admin/Pages/EditCar.aspx?id=" + id.ToString());
        }
示例#12
0
        public ActionResult AddEditBalance(OpenBalanceVm openBalanceVm)
        {
            #region Check Rights
            bool hasRights;

            string accountId = "";
            string tbName, pkName; int libId;

            libId  = openBalanceVm.LibItemId;
            tbName = openBalanceVm.TbName;
            pkName = openBalanceVm.PkName;
            //Get AccountId
            accountId = AccountingChartHelper.GetAccountIdByPkAndTbName(libId, tbName, pkName);
            if (string.IsNullOrEmpty(accountId))
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.OpenBalance, ActionEnum.Add);
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.OpenBalance, ActionEnum.Edit);
            }

            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home", new { area = "" }));
            }

            #endregion

            string isSaved = AccountingHelper.AddEditOpenBalance(openBalanceVm);

            return(Json(new { IsSaved = isSaved }));
        }
示例#13
0
        public ActionResult Edit(long id)
        {
            long?userId = AdminHelper.GetUserId(HttpContext);       //获得登录用户Id
            long?cityId = userService.GetById(userId.Value).CityId; //得到该用户所在的城市

            if (cityId == null)
            {
                return(View("Error", (object)"总部不能进行房源管理"));
            }
            var house = houseService.GetById(id);
            HouseEditViewModel model = new HouseEditViewModel();

            model.House = house;
            var regions        = regionService.GetAll(cityId.Value);
            var roomTypes      = idNameService.GetAll("户型");
            var statuses       = idNameService.GetAll("房屋状态");
            var decorateStatus = idNameService.GetAll("装修状态");
            var attachments    = attService.GetAll();
            var types          = idNameService.GetAll("房屋类别");

            model.Regions          = regions;
            model.RoomTypes        = roomTypes;
            model.Statuses         = statuses;
            model.DecorateStatuses = decorateStatus;
            model.Attachments      = attachments;
            model.Types            = types;
            return(View(model));
        }
        public ActionResult ChangePassword(ChangePassword model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var admin = AdminHelper.GetAdmin(User.Identity.Name);

            if (admin == null)
            {
                return(RedirectToAction("Logoff"));
            }

            string passportSalted = Security.SHA512(model.LastPassword, admin.Salt);

            if (admin.Password != passportSalted)
            {
                ModelState.AddModelError("", "The old password is incorrect!");
                return(View(model));
            }
            AdminHelper.SetPassword(admin, model.Password);
            AdminHelper.UpdateAdmin(admin);
            return(RedirectToAction("Index", "Admin"));
        }
示例#15
0
        private void btnCharge_Click(object sender, RoutedEventArgs e)
        {
            int point = Common.ConvertHelper.ConvertToInt(txtPoint.Text);

            if (point % 10 != 0 || point <= 0)
            {
                MessageBox.Show("充值点券数必须为10的倍数。");
            }
            else
            {
                var time = Convert.ToDateTime(dpChargeDate.Text);
                time = time.Date.AddHours(3);
                var response = new AdminHelper().Charge(point, time);
                if (response == (int)MessageCode.Success)
                {
                    MessageBox.Show("充值成功!");

                    ApiTestCore.MainWindow.RefreshManagerInfo();
                }
                else
                {
                    MessageBox.Show(EmulatorHelper.BuildErrorinfo("充值", response));
                }
            }
        }
示例#16
0
    protected void submit_Click(object sender, EventArgs e)
    {
        string number = userNum.Text.Trim();
        Regex  reNUm  = new Regex(@"[0-9a-zA-Z]{1,11}");
        string name   = userName.Text.Trim();
        string pwd    = userPwd.Text.Trim();
        string rptPwd = userPwdRpt.Text.Trim();
        Regex  rePwd  = new Regex(@"^[a-zA-Z]\w{6,18}$");

        if (string.IsNullOrEmpty(pwd) || string.IsNullOrEmpty(number) || string.IsNullOrEmpty(name))
        {
            Response.Write(JSHelper.ShowAlert("信息不能为空!"));
            return;
        }
        else
        {
            if (!reNUm.IsMatch(number) || !rePwd.IsMatch(pwd) || !pwd.Equals(rptPwd))
            {
                //Response.Write(JSHelper.ShowAlert("请输入合法学工号或密码"));
                return;
            }
        }
        if (!AdminHelper.Add(number, name, pwd, dpl.SelectedValue))
        {
            Response.Write(JSHelper.ShowAlert("不能重复注册!"));
        }
        else
        {
            Response.Write(JSHelper.ShowAlert("添加成功!\\n学工号: " + number + "\\n密码: " + pwd + ""));
            Response.Write("<script>location.href='adminList.aspx';</script>");
        }
    }
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    // regist as a admin
                    AdminHelper.addUserToRole(user.Id, "Admin");

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);



                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
示例#18
0
        public ActionResult List(long typeId, int pageIndex = 1)
        {
            //因为AuthorizFilter做了是否登录的检查,因此这里不会取不到id
            long userId = (long)AdminHelper.GetUserId(HttpContext);
            //cityId可能为空,为空是总部
            long?cityId = userSerivce.GetById(userId).CityId;

            if (cityId == null)
            {
                //如果“总部不能***”的操作很多,也可以定义成一个AuthorizeFilter
                //最好用FilterAttribute的方式标注,这样对其他的不涉及这个问题的地方效率高
                //立即实现
                return(View("Error", (object)"总部不能进行房源管理"));
            }
            //分页
            var houses = houseService.GetPagedData(cityId.Value, typeId, 10, (pageIndex - 1) * 10);
            //获得总的条数
            long totalCount = houseService.GetTotalCount(cityId.Value, typeId);

            //当前页
            ViewBag.pageIndex = pageIndex;
            //总的条数
            ViewBag.totalCount = totalCount;
            //房源类型的id
            ViewBag.typeId = typeId;
            return(View(houses));
        }
 public AdminViewModel(Admin admin)
 {
     Id    = admin.Id;
     Login = admin.Login;
     Email = admin.Email;
     Roles = AdminHelper.RoleCutter(admin.Roles);
 }
        public ActionResult AddEditCity(EasyFreight.Models.City cityDb)
        {
            #region Check Rights
            bool hasRights;
            if (cityDb.CityId == 0) //Check export rights
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.CitiesLibrary, ActionEnum.Add);
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.CitiesLibrary, ActionEnum.Edit);
            }

            if (!hasRights)
            {
                return(Json("false. You are UnAuthorized to do this action"));
            }

            #endregion
            string isSaved = LibraryCommonHelper.AddEditCities(cityDb);
            if (isSaved != "true")
            {
                return(Json(isSaved));
            }
            var citiesList = LibraryCommonHelper.GetCitiesListByCountryId(0);
            return(PartialView("~/Areas/MasterData/Views/CountryLibrary/_CityTable.cshtml", citiesList));
        }
        public ActionResult WorkPostUpdate(int id)
        {
            var user = AdminHelper.GetUserId(HttpContext);
            int h1   = studentWorkPostService.UpdataState(user.Id, id);

            var data = workPostService.GetById(id);

            if (data.CountNum <= 0)
            {
                return(Content("<script>alert('选择失败,岗位已满。');window.location.href='/Home/WorkPost'</script>"));
            }
            if (h1 > 0)
            {
                userService.UpdateState(user.Id, 5);
                userService.UpdateWorkPost(user.Id, id);
                int h2 = workPostService.UpdateNum(id);
                if (h2 > 0)
                {
                    //return Json(new AjaxResult { Status = "ok" });
                    return(Content("<script>alert('选择成功。');window.location.href='/Home/UserDataMore'</script>"));
                }
                else
                {
                    return(Content("<script>alert('选择失败。');window.location.href='/Home/WorkPost'</script>"));
                }
            }
            else
            {
                //return Json(new AjaxResult { Status = "error",Data="选择失败" });
                return(Content("<script>alert('选择失败。');window.location.href='/Home/WorkPost'</script>"));
            }
        }
示例#22
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            base.OnActionExecuting(context);

            if (!context.ModelState.IsValid)
            {
                string msg = "";
                var    methodIgnoreAttribute = (context.ActionDescriptor as ControllerActionDescriptor).MethodInfo.GetCustomAttributes(false).OfType <ModelStateIgnoreAttribute>().FirstOrDefault();
                foreach (var item in context.ModelState.Where(x => x.Value.ValidationState == Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid))
                {
                    if (methodIgnoreAttribute != null && methodIgnoreAttribute.Names.Contains(item.Key))
                    {
                        context.ModelState.Remove(item.Key);
                        continue;
                    }
                    msg += "\n" + item.Key;
                    foreach (var err in item.Value.Errors)
                    {
                        msg += "\n" + err.ErrorMessage;
                        if (err.Exception != null)
                        {
                            msg += "exception: " + err.Exception.Message;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(msg))
                {
                    context.Result = new BadRequestObjectResult(ServiceResult <string> .Instance.ErrorResult(ServiceResultCode.InvalidModel, "Invalid Model" + msg));
                    return;
                }
            }


            MainTokenData = AdminHelper.GetDataFromToken(GetTokenFromHeader());
        }
示例#23
0
    private void SetUpDisplayInformation()
    {
        AdminHelper admin             = AdminHelper.LoadByUserName(Page.User.Identity.Name);
        bool        canViewProduct    = admin.CanViewPage(_productPage);
        bool        canViewCategory   = admin.CanViewPage(_categoryPage);
        bool        canViewDepartment = admin.CanViewPage(_departmentPage);

        if (!canViewProduct)
        {
            uxProductLiteral.Visible           = false;
            uxAllProductLink.Visible           = false;
            uxOutOfStockLiteral.Visible        = false;
            uxAllProductOnLowStockLink.Visible = false;
            uxProductInactiveLiteral.Visible   = false;
            uxAllProductInactiveLink.Visible   = false;
        }
        if (!canViewCategory)
        {
            uxCategoryLiteral.Visible = false;
            uxAllCategoryLink.Visible = false;
        }
        if (!canViewDepartment)
        {
            uxDepartmentLiteral.Visible = false;
            uxAllDepartmentLink.Visible = false;
        }
        if (!canViewProduct && !canViewCategory && !canViewDepartment)
        {
            uxNoPermissionLabel.Text = "You do not have permission to view this section";
        }
    }
示例#24
0
        // GET: House
        public ActionResult List(long typeId = 14, int pageIndex = 1)
        {
            long?userId = AdminHelper.GetUserId(HttpContext);

            if (userId == null)
            {
                return(Redirect("~/Main/Login"));
            }

            long?cityId = userService.GetById(userId.Value).CityId;

            if (cityId == null)
            {
                return(View("Error", (object)"总部不能进行房源管理"));
            }

            HouseSearchOptions options = new HouseSearchOptions();

            options.CityId       = cityId.Value;
            options.TypeId       = 14;
            options.PageSize     = 10;
            options.CurrentIndex = pageIndex;
            var result = houseService.Search(options);

            ViewBag.PageIndex  = pageIndex;
            ViewBag.TotalCount = (int)result.totalCount;
            ViewBag.typeId     = typeId;
            //var house=houseService.s

            return(View(result.result));
        }
示例#25
0
        /// <summary>
        /// operation employee add custom clearance order from process operation order
        /// </summary>
        /// <param name="id">Operation Id</param>
        /// <returns>add custom clearance order patial view</returns>
        public ActionResult CustomClearanceOrder(int id, int houseBillId, byte orderFrom)
        {
            #region Check Rights
            bool hasRights;
            if (orderFrom == 1) //Check export rights
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportHB, ActionEnum.AddEditCCOrder);
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportHB, ActionEnum.AddEditCCOrder);
            }

            if (!hasRights)
            {
                return(PartialView("~/Views/Shared/_UnAuthorized.cshtml"));
            }

            #endregion

            ViewBag.customClearObj = CustomClearanceHelper.GetCustomClearance(id, houseBillId);
            EasyFreight.Models.HouseBillView operationView = HouseBillHelper.GetHBView(houseBillId);
            ViewBag.ContainerSummary = OperationHelper.GetContainersSummary(id);
            return(PartialView("~/Views/CustomClearance/_CustomClearance.cshtml", operationView));
        }
示例#26
0
        public ActionResult Add(HouseAddModel model)
        {
            long? userId = AdminHelper.GetUserId(HttpContext);
            long? cityId = userService.GetById(userId.Value).CityId;
            if (cityId == null)
            {
                return View("Error", (object)"总部不能进行房源管理");
            }

            HouseAddNewDTO dto = new HouseAddNewDTO();
            dto.Address = model.address;
            dto.Area = model.area;
            dto.AttachmentIds = model.attachmentIds;
            dto.CheckInDateTime = model.checkInDateTime;
            dto.CommunityId = model.CommunityId;
            dto.DecorateStatusId = model.DecorateStatusId;
            dto.Description = model.description;
            dto.Direction = model.direction;
            dto.FloorIndex = model.floorIndex;
            dto.LookableDateTime = model.lookableDateTime;
            dto.MonthRent = model.monthRent;
            dto.OwnerName = model.ownerName;
            dto.OwnerPhoneNum = model.ownerPhoneNum;
            dto.RoomTypeId = model.RoomTypeId;
            dto.StatusId = model.StatusId;
            dto.TotalFloorCount = model.totalFloor;
            dto.TypeId = model.TypeId;

            houseService.AddNew(dto);
            return Json(new AjaxResult { Status="ok"});
        }
示例#27
0
        public ActionResult Edit(long id)
        {
            long?cityId = AdminHelper.GetCityId(this.HttpContext);

            if (cityId == null)
            {
                return(View("~/Views/Shared/Error.cshtml", (object)"总部人员无法管理房源!"));
            }
            var house   = HouseService.GetById(id);
            var regions = RegionService.GetAll(cityId.Value);
            //var communitities = CommunitityService.
            var roomTypes      = IdNameService.GetByTypeName("户型");
            var status         = IdNameService.GetByTypeName("房屋状态");
            var decorateStatus = IdNameService.GetByTypeName("装修状态");
            var types          = IdNameService.GetByTypeName("房屋类别");
            HouseEditViewModel houseEditView = new HouseEditViewModel();

            houseEditView.House          = house;
            houseEditView.Status         = status;
            houseEditView.DecorateStatus = decorateStatus;
            houseEditView.Regions        = regions;
            houseEditView.RoomTypes      = roomTypes;
            houseEditView.Types          = types;
            return(View(houseEditView));
        }
示例#28
0
        public ActionResult Add(int id = 0)
        {
            #region Check Rights
            bool hasRights;
            if (id == 0) //Check export rights
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ContractorRate, ActionEnum.Add);
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ContractorRate, ActionEnum.Edit);
            }

            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home", new { area = "" }));
            }

            #endregion

            ContractorRateVm carrRateVm = ContractorRateHelper.GetContractorRateInfo(id);
            ViewBag.ContractorList   = ListCommonHelper.GetContractorList();
            ViewBag.ContainerList    = ListCommonHelper.GetContainerList();
            ViewData["AreaList"]     = ListCommonHelper.GetAreaGrouped();
            ViewData["CityList"]     = ListCommonHelper.GetCityGrouped();
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            return(View(carrRateVm));
        }
示例#29
0
        public ActionResult Edit(long Id)
        {
            long userId = (long)AdminHelper.GetUserId(HttpContext);
            var  user   = AdminUserService.GetById(userId);

            if (user.CityId == null)
            {
                //TODO如果“总部不能***”的操作很多,也可以定义成一个AuthorizeFilter
                //最好用FilterAttribute的方式标注,这样对其他的不涉及这个问题的地方效率高
                //立即实现
                return(View("ERROR", (object)"总部不能进行房源管理"));
            }
            var regions             = RegionService.GetAll((long)user.CityId);
            var roomTypes           = IdNameService.GetAll("户型");
            var status              = IdNameService.GetAll("房屋状态");
            var decorateStatus      = IdNameService.GetAll("装修状态");
            var types               = IdNameService.GetAll("出租类别");
            var attachments         = AttachmentService.GetAll();
            var house               = HouseService.GetById(Id);
            HouseEditGetModel model = new HouseEditGetModel();

            model.Attachments    = attachments;
            model.DecorateStatus = decorateStatus;
            model.Regions        = regions;
            model.RoomTypes      = roomTypes;
            model.Status         = status;
            model.Types          = types;
            model.House          = house;
            return(View(model));
        }
示例#30
0
    private void SetupDisplayBox()
    {
        AdminHelper admin = AdminHelper.LoadByUserName(Page.User.Identity.Name);

        if (!admin.CanViewPage(_orderPage))
        {
            Div1.Visible = false;
            Div3.Visible = false;
        }

        if (!admin.CanViewPage(_customerPage))
        {
            Div2.Visible = false;
        }

        if (!admin.CanViewPage(_productPage))
        {
            Div4.Visible = false;
        }
        if (!admin.CanViewPage(_categoryPage))
        {
            Div4.Visible = false;
        }
        if (!admin.CanViewPage(_departmentPage))
        {
            Div4.Visible = false;
        }
    }