/// <summary>
        /// Get the details of the DashboardIndicators View in the Model DashboardIndicators such as DashboardIndicatorsList, list of countries etc.
        /// </summary>
        /// <returns>
        /// returns the actionresult in the form of current object of the Model DashboardIndicators to be passed to View DashboardIndicators
        /// </returns>
        public ActionResult IndexV1()
        {
            //Initialize the DashboardIndicators BAL object
            using (var bal = new DashboardIndicatorsBal())
            {
                var corporateId = Helpers.GetSysAdminCorporateID();
                //Get the Entity list
                var list = bal.GetDashboardIndicatorsListByCorporate(corporateId, Helpers.GetDefaultFacilityId());
                var orderByExpression = HtmlExtensions.GetOrderByExpression <DashboardIndicatorsCustomModel>("Dashboard");
                var data = HtmlExtensions.OrderByDir(list, "ASC", orderByExpression);

                //Intialize the View Model i.e. DashboardIndicatorsView which is binded to Main View Index.cshtml under DashboardIndicators
                var viewModel = new DashboardIndicatorsView
                {
                    DashboardIndicatorsList    = data,
                    CurrentDashboardIndicators = new DashboardIndicators
                    {
                        IndicatorNumber = bal.GetIndicatorNextNumber(corporateId),
                        OwnerShip       = bal.GetNameByUserId(Helpers.GetLoggedInUserId())
                    }
                };

                //Pass the View Model in ActionResult to View DashboardIndicators
                return(View(viewModel));
            }
        }
예제 #2
0
        public async Task <ActionResult> ResetPassword(ResetPasswordViewModel model, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (HtmlExtensions.DetectedBotWithHoneyPot(form))
            {
                HlidacStatu.Util.Consts.Logger.Error("ResetPassword: Detected form bot " + Request.UserHostAddress + " | " + form["email"]);
                return(View("Bot"));
            }

            var user = await UserManager.FindByNameAsync(model.Email);

            if (user == null)
            {
                // Don't reveal that the user does not exist
                return(RedirectToAction("ResetPasswordConfirmation", "Account"));
            }
            var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);

            if (result.Succeeded)
            {
                return(RedirectToAction("ResetPasswordConfirmation", "Account"));
            }
            AddErrors(result);
            return(View());
        }
예제 #3
0
        public ActionResult DevelopMessageBoard()
        {
            ViewBag.Title = HtmlExtensions.Lang("_Layout_menu_DevMessageBoard");

            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();
            int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name);

            string    return_data = "";
            t_setting setting     = null;
            InterfaceSettingService setting_service = new SettingService();

            try
            {
                setting = setting_service.SearchByManagerID(mana_id).FirstOrDefault();
                if (setting != null)
                {
                    return_data = setting.deve_message_board;
                }
            }
            catch
            {
            }
#if login_debug
            return_data = "Debug 内容测试";
#endif
            ViewBag.DATA = JsonConvert.SerializeObject(return_data);
            return(View());
        }
예제 #4
0
        public void When_GetClassCalledForValidState_ReturnCorrectClass()
        {
            var model  = new Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary();
            var result = HtmlExtensions.GetClass("test", model);

            Assert.IsEmpty(result);
        }
예제 #5
0
        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (JsonRequestBehavior == JsonRequestBehavior.DenyGet && String.Equals(context.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
            {
                throw new InvalidOperationException("GET is not allowed");
            }

            HttpResponseBase response = context.HttpContext.Response;

            if (!String.IsNullOrEmpty(ContentType))
            {
                response.ContentType = ContentType;
            }
            else
            {
                response.ContentType = "application/json";
            }
            if (ContentEncoding != null)
            {
                response.ContentEncoding = ContentEncoding;
            }
            if (Data != null)
            {
                response.Write(HtmlExtensions.ToJSON(this.Data));
            }
        }
예제 #6
0
        /// <summary>
        /// Saves a file
        /// </summary>
        /// <param name="file">File to be saved</param>
        /// <param name="folder">A folder inside wwwroot</param>
        /// <param name="fileName">Optional: New filename (without extension). The new filename will be in Kebab Case.</param>
        /// <returns>saved: true/false and relative path+filename with extension or errormessage</returns>
        internal async Task <Tuple <bool, string> > SaveFile(IFormFile file, string folder, string fileName = null)
        {
            string msg     = "An error occured while saving the file.";
            bool   success = false;

            if (file.Length > 5000000)             // 5 MB limit
            {
                msg = "The picture size cannot exceed 5MB.";
            }
            else
            {
                string fileNameKebabCase = HtmlExtensions.URLFriendly(fileName ?? file.FileName);
                string filePath          = Path.Combine(_env.WebRootPath, folder);
                string filePathAndName   = Path.Combine(filePath, fileNameKebabCase);
                if (!filePathAndName.EndsWith(Path.GetExtension(file.FileName)))
                {
                    filePathAndName += Path.GetExtension(file.FileName);
                }

                if (File.Exists(filePathAndName))
                {
                    filePathAndName.Insert(filePathAndName.Length, DateTime.Now.ToString("yyyyMMddHHmmss"));
                }

                Directory.CreateDirectory(filePath);                 // Create directory unless it already exists.
                using (var stream = new FileStream(filePathAndName, FileMode.Create))
                {
                    await file.CopyToAsync(stream);
                }
                msg     = Path.Combine(folder, Path.GetFileName(filePathAndName));
                success = true;
            }
            return(new Tuple <bool, string>(success, msg));
        }
예제 #7
0
        public ActionResult DeleteSummary(int id = 0)
        {
            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();
            int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name);

            var json_result = new JsonResult();

            InterfaceSummaryService summary_service = new SummaryService();

            try
            {
                t_summary delete = summary_service.GetByID(id);
                if (delete != null && delete.mana_id == mana_id)
                {
                    summary_service.Delete(delete);
                    json_result.Data = new { Result = true, Message = "" };
                }
                else
                {
                    json_result.Data = new { Result = false, Message = HtmlExtensions.Lang("_Error_Comm_Para") };
                }
            }
            catch
            {
                json_result.Data = new { Result = false, Message = HtmlExtensions.Lang("_Error_Comm_Para") };
            }
            return(json_result);
        }
예제 #8
0
        //[ValidateAntiForgeryToken]
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl, FormCollection form)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (HtmlExtensions.DetectedBotWithHoneyPot(form))
            {
                HlidacStatu.Util.Consts.Logger.Error("Login: Detected form bot " + Request.UserHostAddress + " | " + form["email"]);
                return(View("Bot"));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : true);

            switch (result)
            {
            case SignInStatus.Success:
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
예제 #9
0
        public ActionResult SummaryType()
        {
            ViewBag.Title = HtmlExtensions.Lang("Financing_SummaryType_Title");

            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();
            int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name);

            List <t_summary>        summary_list    = new List <t_summary>();
            InterfaceSummaryService summary_service = new SummaryService();

            try
            {
                summary_list = summary_service.SearchByManagerID(mana_id).ToList();
            }
            catch
            {
            }
#if login_debug
            t_summary add1 = new t_summary();
            add1.mana_id   = 1;
            add1.summ_desc = "123";
            add1.summ_id   = 1;
            summary_list.Add(add1);
#endif
            ViewBag.DATA = JsonConvert.SerializeObject(summary_list);
            return(View());
        }
        public ControlClassOverrideGroup(string defaultControlGroupClass = null, string defaultControlsClass = null,
                                         string defaultHelpInlineClass   = null, string defaultLabelClass    = null)
        {
            if (defaultControlGroupClass != null)
            {
                _defaultControlGroupClassOriginalValue     = HtmlExtensions.GetDefaultControlGroupClass();
                HtmlExtensions.GetDefaultControlGroupClass = () => defaultControlGroupClass;
            }

            if (defaultControlsClass != null)
            {
                _defaultControlsClassOriginalValue     = HtmlExtensions.GetDefaultControlsClass();
                HtmlExtensions.GetDefaultControlsClass = () => defaultControlsClass;
            }

            if (defaultControlsClass != null)
            {
                _defaultHelpInlineClassOriginalValue     = HtmlExtensions.GetDefaultHelpInlineClass();
                HtmlExtensions.GetDefaultHelpInlineClass = () => defaultHelpInlineClass;
            }

            if (defaultLabelClass != null)
            {
                _defaultLabelClassOriginalValue     = HtmlExtensions.GetDefaultLabelClass();
                HtmlExtensions.GetDefaultLabelClass = () => defaultLabelClass;
            }
        }
예제 #11
0
        private string CheckRecordAdjust(int mana_id, AdjustRecordModel model)
        {
            string result = "";

            InterfaceSummaryService summary_service = new SummaryService();
            List <t_summary>        summary_list    = new List <t_summary>();

            try
            {
                summary_list = summary_service.SearchByManagerID(mana_id).ToList();
            }
            catch
            {
            }

            foreach (int id in model.summ_id)
            {
                t_summary summary = summary_list.Where(M => M.summ_id == id).FirstOrDefault();
                if (summary == null)
                {
                    result = HtmlExtensions.Lang("_Error_Comm_Para");
                }
            }
            return(result);
        }
예제 #12
0
        public ActionResult DealRecord(int id = 0)
        {
            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();
            int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name);

            var json_result = new JsonResult();

            InterfaceSummaryRecordService summary_record_service = new SummaryRecordService();

            t_summary_record deal = null;

            try
            {
                deal = summary_record_service.GetByID(id);
                if (deal != null && deal.mana_id == mana_id)
                {
                    deal.is_deal = true;
                    summary_record_service.Update(deal);
                    json_result.Data = new { Result = true, Message = "" };
                }
                else
                {
                    json_result.Data = new { Result = false, Message = HtmlExtensions.Lang("_Error_Comm_Para") };
                }
            }
            catch
            {
                json_result.Data = new { Result = false, Message = HtmlExtensions.Lang("_Error_Comm_Para") };
            }
            return(json_result);
        }
예제 #13
0
        public ActionResult RecordDetail()
        {
            ViewBag.Title = HtmlExtensions.Lang("Financing_RecordDetail_Title");

            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();
            int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name);

            InterfaceRecordTypeService    record_type_service    = new RecordTypeService();
            InterfaceSummaryService       summary_service        = new SummaryService();
            InterfaceSummaryRecordService summary_record_service = new SummaryRecordService();

            List <t_record_type>    record_type_list    = new List <t_record_type>();
            List <t_summary>        summary_list        = new List <t_summary>();
            List <t_summary_record> summary_record_list = new List <t_summary_record>();

            try
            {
                record_type_list    = record_type_service.Table().ToList();
                summary_list        = summary_service.SearchByManagerID(mana_id).ToList();
                summary_record_list = summary_record_service.SearchByManagerID(mana_id).ToList();
            }
            catch
            {
            }
            ViewBag.RECORD_TYPE    = JsonConvert.SerializeObject(record_type_list);
            ViewBag.SUMMARY        = JsonConvert.SerializeObject(summary_list);
            ViewBag.SUMMARY_RECORD = CreateRecordDetailCount(summary_list, summary_record_list);
            return(View());
        }
예제 #14
0
            public void ThenReturnsFalseIfNoUserLoggedIn()
            {
                FakeHttpContextBase.User = null;
                var result = HtmlExtensions.CanShowReservationsLink(null);

                Assert.IsFalse(result);
            }
예제 #15
0
        /// <summary>
        /// 根据用户id获取购物车商品
        /// </summary>
        /// <param name="userid">用户id</param>
        /// <param name="languageId">语言id</param>
        /// <returns>购物车商品模型</returns>
        public ResultModel GetShoppingCartByUserId(string userid, int languageId)
        {
            StringBuilder sb     = new StringBuilder();
            ResultModel   result = new ResultModel {
                IsValid = false
            };
            string sql = @"Select p.FareTemplateID,p.Volume,sp.PurchasePrice,sc.ShoppingCartId As 'CartsId',m.IsProvideInvoices,sp.Stock AS 'StockQuantity',p.PostagePrice,p.SupplierId,
                            p.ProductID AS 'GoodsId',p.FreeShipping,p.Weight,p.RebateDays,p.RebateRatio,sc.Quantity As 'Count',pp.PicUrl As 'Pic',pl.ProductName AS 'GoodsName',
                            Case When (pr.StarDate<=GETDATE() and pr.EndDate>=GETDATE() and pr.SalesRuleId=2 and pr.Discount>0) Then sp.HKPrice*pr.Discount Else sp.HKPrice End As 'GoodsUnits',
                            sp.MarketPrice,p.MerchantID AS 'ComId',m.ShopName AS 'ComName',p.Status,p.MerchantID,(SELECT  reverse(stuff(reverse((
                                                              SELECT DISTINCT BBB.AttributeName+',' FROM dbo.SKU_AttributeValues AAA  JOIN dbo.SKU_Attributes BBB ON AAA.AttributeId=BBB.AttributeId
                                                              WHERE CHARINDEX(convert(varchar,AAA.ValueId)+'_',sp.SKUStr)>0
                                                                    OR CHARINDEX('_'+convert(varchar,AAA.ValueId),sp.SKUStr)>0
                                                                    OR sp.SKUStr=convert(varchar,AAA.ValueId) FOR XML PATH(''))),1,1,''))) As 'AttributeName',
                            sp.SkuName As 'ValueStr',sp.SKU_ProducId As 'SkuNumber',sc.IsCheck As 'IsChecked',sc.CartDate
                            From ShoppingCart sc  LEFT JOIN Product p on sc.ProductID = p.ProductId  
                            LEFT JOIN ProductPic pp on p.ProductID = pp.ProductId  LEFT JOIN Product_Lang pl ON p.ProductID = pl.ProductId 
                            LEFT JOIN YH_MerchantInfo m ON p.MerchantID=m.MerchantID LEFT JOIN SKU_Product sp on sc.SKU_ProducId = sp.SKU_ProducId 
                            LEFT JOIN ProductRule pr ON sc.ProductID = pr.ProductId Where pp.Flag = 1 And pl.LanguageID ={0} And sc.UserID ={1};";

            sb.AppendFormat(sql, languageId, userid);
            var            data    = _database.RunSqlQuery(x => x.ToResultSets(sb.ToString()));
            List <dynamic> sources = data[0];

            result.Data = sources.ToEntity <GoodsInfoModel>();
            foreach (var prodcut in result.Data)
            {
                //prodcut.Pic = GetConfig.FullPath() + prodcut.Pic;
                prodcut.Pic = HtmlExtensions.GetImagesUrl(prodcut.Pic, 72, 72);
                prodcut.AddToShoppingCartTime = DateTimeExtensions.DateTimeToString(prodcut.CartDate);
            }
            result.IsValid = true;
            return(result);
        }
예제 #16
0
        public void GetEnumValueSelectList_ShouldUseDisplayAttributeForTextWhenPresent()
        {
            // Act
            var result = HtmlExtensions.GetEnumValueSelectList <TestEnum>(null);

            // Assert
            Assert.Equal(result.Single(a => a.Value == TestEnum.HasDiplayAttribute.ToString()).Text, HasDisplayAttributeText);
        }
예제 #17
0
        public void GetEnumValueSelectList_ShouldDefaultToEnumToStringForText()
        {
            // Act
            var result = HtmlExtensions.GetEnumValueSelectList <TestEnum>(null);

            // Assert
            Assert.Equal(result.Single(a => a.Value == TestEnum.NoDisplayAttribute.ToString()).Text, TestEnum.NoDisplayAttribute.ToString());
        }
        /// <summary>
        /// Add New or Update the DashboardIndicators based on if we pass the DashboardIndicators ID in the DashboardIndicatorsViewModel object.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// returns the newly added or updated ID of DashboardIndicators row
        /// </returns>
        public ActionResult SaveDashboardIndicatorsV1(DashboardIndicators model)
        {
            var userId      = Helpers.GetLoggedInUserId();
            var currentDate = Helpers.GetInvariantCultureDateTime();
            var list        = new List <DashboardIndicatorsCustomModel>();

            //Check if Model is not null
            if (model != null)
            {
                model.CorporateId = Helpers.GetSysAdminCorporateID();
                using (var bal = new DashboardIndicatorsBal())
                {
                    if (model.IndicatorID == 0)
                    {
                        model.CreatedBy   = userId;
                        model.CreatedDate = currentDate;
                    }
                    using (var dashboardIndicatorDataBal = new DashboardIndicatorDataBal())
                    {
                        switch (model.IsActive)
                        {
                        case 0:
                            dashboardIndicatorDataBal.BulkInactiveDashboardIndicatorData(model.IndicatorNumber,
                                                                                         Helpers.GetSysAdminCorporateID());
                            break;

                        default:
                            dashboardIndicatorDataBal.BulkActiveDashboardIndicatorData(model.IndicatorNumber,
                                                                                       Helpers.GetSysAdminCorporateID());
                            break;
                        }
                    }
                    using (var oDashboardIndicatorDataBal = new DashboardIndicatorDataBal())
                    {
                        oDashboardIndicatorDataBal.GenerateIndicatorEffects(model);
                    }
                    list = bal.SaveDashboardIndicatorsV1(model);

                    //Add by shashank to check the Special case for the Indicator i.e. is the Target/Budget is static for indicator
                    //.... Should only Call for Dashboard type = Budget (Externalvalue1='1')
                    if (!string.IsNullOrEmpty(model.IndicatorNumber) && model.ExternalValue4.ToLower() == "true")
                    {
                        using (var ibal = new DashboardIndicatorDataBal())
                            ibal.SetStaticBudgetTargetIndciators(model);
                    }
                    using (var oDashboardIndicatorDataBal = new DashboardIndicatorDataBal())
                    {
                        oDashboardIndicatorDataBal.GenerateIndicatorEffects(model);
                        oDashboardIndicatorDataBal.UpdateCalculateIndicatorUpdate(model);
                    }
                    //Call the AddDashboardIndicators Method to Add / Update current DashboardIndicators
                    var orderByExpression = HtmlExtensions.GetOrderByExpression <DashboardIndicatorsCustomModel>("Dashboard");
                    list = HtmlExtensions.OrderByDir <DashboardIndicatorsCustomModel>(list, "ASC", orderByExpression);
                }
            }
            //Pass the ActionResult with List of DashboardIndicatorsViewModel object to Partial View DashboardIndicatorsList
            return(PartialView(PartialViews.DashboardIndicatorsList, list));
        }
예제 #19
0
        public void When_GetClassCalledForErrorState_ReturnCorrectClass()
        {
            var model = new Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary();

            model.AddModelError("test", "error");
            var result = HtmlExtensions.GetClass("test", model);

            Assert.AreEqual(ErrorClass, result);
        }
예제 #20
0
            public void ThenReturnsTheExpectedPermission(bool userPermission, bool expectedResult)
            {
                FakeHttpContextBase.User = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim> {
                    new Claim(DasClaimTypes.ShowReservations, userPermission.ToString(), "bool")
                }));
                var result = HtmlExtensions.CanShowReservationsLink(null);

                Assert.AreEqual(expectedResult, result);
            }
예제 #21
0
        public void When_DobVariableGetClassCalled_ReturnCorrectClass(string field, string expected)
        {
            var model = new Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary();

            model.AddModelError(field, "error");
            var result = HtmlExtensions.GetDOBClass(DobField, DobDay, DobMonth, DobYear, model);

            Assert.AreEqual(result, expected);
        }
예제 #22
0
        private string CheckSummary(AddSummaryTypeModel model)
        {
            string result = "";

            if (string.IsNullOrEmpty(model.add_summary) || model.add_summary.Length > 10)
            {
                result = HtmlExtensions.Lang("_Error_Financing_SummaryType_Add");
            }
            return(result);
        }
예제 #23
0
        public void OnException(ExceptionContext filterContext)
        {
            var ex = filterContext.Exception;



            var viewData = new ViewDataDictionary()
            {
                { "Exception", new ServiceException(ex) },
            };


            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Account", action = "LogOn" }));

            var request = filterContext.RequestContext.HttpContext.Request;
            var rw      = request.Headers.Get("X-Requested-With");

            filterContext.ExceptionHandled = true;


            var    response = filterContext.RequestContext.HttpContext.Response;
            string message  = "";

            //ajax
            if (!string.IsNullOrEmpty(rw) && rw.Equals("XMLHttpRequest", StringComparison.InvariantCultureIgnoreCase))
            {
                //message = HtmlExtensions.RenderPartialViewToString(filterContext.Controller.ControllerContext, "FilteredErrorAjax", null, viewData);
                message             = HtmlExtensions.RenderPartialViewToString(filterContext.Controller.ControllerContext, "FilteredError", null, viewData);
                response.StatusCode = 999;
            }
            //not ajax
            else
            //post to frame
            if (filterContext.RequestContext.HttpContext.Request.HttpMethod.Equals("POST", StringComparison.InvariantCultureIgnoreCase) &&
                (request["insideframe"] ?? "").Equals("true", StringComparison.InvariantCultureIgnoreCase)

                )
            {
                //message = HtmlExtensions.RenderPartialViewToString(filterContext.Controller.ControllerContext, "FilteredErrorPost", null, viewData);
                message             = HtmlExtensions.RenderPartialViewToString(filterContext.Controller.ControllerContext, "FilteredError", null, viewData);
                response.StatusCode = 999;
            }

            //get
            else
            {
                message             = HtmlExtensions.RenderPartialViewToString(filterContext.Controller.ControllerContext, "FilteredError", null, viewData);
                response.StatusCode = 400;
            }

            response.Write(message);

            response.StatusDescription = filterContext.Exception.Message;
            response.End();
        }
예제 #24
0
        [Ignore] // TODO: Create unit test for HtmlExtensions.Include()
        public void IncludeTest()
        {
            HtmlHelper  html        = null;         // TODO: Initialize to an appropriate value
            string      fileAndPath = string.Empty; // TODO: Initialize to an appropriate value
            IHtmlString expected    = null;         // TODO: Initialize to an appropriate value
            IHtmlString actual;

            actual = HtmlExtensions.Include(html, fileAndPath);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
예제 #25
0
        public void TestFormTextForThrowsExceptionWhenHelperIsNull()
        {
            // Arrange
            Expression <Func <TestModel, string> > expression = m => m.Value;

            // Act
            Action s = () => HtmlExtensions.FormTextFor(null, expression);

            // Assert
            s.ShouldThrow <ArgumentNullException>("Helper can't be null");
        }
예제 #26
0
        public ActionResult RoleError()
        {
            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();

            if (authentication == null)
            {
                return(RedirectToAction("LogOn", "User"));
            }

            ViewBag.Title = HtmlExtensions.Lang("System_RoleError_Title");
            return(View());
        }
 /// <summary>
 /// Gets the indicatorby corporate.
 /// </summary>
 /// <returns></returns>
 public ActionResult GetIndicatorbyCorporate()
 {
     using (var bal = new DashboardIndicatorsBal())
     {
         //Get the Entity list
         var list = bal.GetDashboardIndicatorsListByCorporate(Helpers.GetSysAdminCorporateID(), Helpers.GetDefaultFacilityId());
         //Pass the View Model in ActionResult to View DashboardIndicators
         var orderByExpression = HtmlExtensions.GetOrderByExpression <DashboardIndicatorsCustomModel>("Dashboard");
         var data = HtmlExtensions.OrderByDir <DashboardIndicatorsCustomModel>(list, "ASC", orderByExpression);
         //Pass the View Model in ActionResult to View DashboardIndicators
         return(PartialView(PartialViews.DashboardIndicatorsList, data));
     }
 }
예제 #28
0
 /// <summary>
 /// Binds the indicators by order.
 /// </summary>
 /// <param name="sort">The sort.</param>
 /// <param name="sortdir">The sortdir.</param>
 /// <returns></returns>
 public ActionResult BindIndicatorsDataByOrder(string sort, string sortdir)
 {
     using (var bal = new DashboardIndicatorDataBal())
     {
         //Get the Entity list
         var list = bal.GetDashboardIndicatorDataList(Helpers.GetSysAdminCorporateID(), Helpers.GetDefaultFacilityId());
         //Intialize the View Model i.e. DashboardIndicatorsView which is binded to Main View Index.cshtml under DashboardIndicators
         var orderByExpression = HtmlExtensions.GetOrderByExpression <DashboardIndicatorDataCustomModel>(sort);
         var data = HtmlExtensions.OrderByDir <DashboardIndicatorDataCustomModel>(list, sortdir, orderByExpression);
         //Pass the View Model in ActionResult to View DashboardIndicators
         return(PartialView(PartialViews.DashboardIndicatorDataList, data));
     }
 }
예제 #29
0
        private static void ProcessNormalRequestError(ExceptionContext filterContext)
        {
            if (filterContext.Exception is HttpException &&
                ((HttpException)filterContext.Exception).GetHttpCode() == 401)
            {
                filterContext.ExceptionHandled = true;
                filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
                filterContext.Result =
                    new RedirectToRouteResult(HtmlExtensions.ParseExpression <HomeController>(c => c.Index()));

                ChalkableAuthentication.SignOut();
            }
        }
예제 #30
0
        public static ProductVM GenerateProductVM(BookStoreContext db, bool success = false)
        {
            ProductVM model = new ProductVM
            {
                DropdownPublisher = HtmlExtensions.GenerateDropdownPublisher(db),
                DropdownType      = HtmlExtensions.GenerateDropdownEnum <ProductType>(),
                DropdownUnit      = HtmlExtensions.GenerateDropdownEnum <UnitType>(),
                Success           = success,
                Product           = new Product(),
            };

            model.DropdownCategory = HtmlExtensions.GenerateDropdownProductCategory(db, model.ProductType);
            return(model);
        }