示例#1
0
        public static bool HasPermisson(this WebViewPage view)
        {
            var controller = view.ViewContext.RouteData.Values["controller"].ToString();
            var action     = view.ViewContext.RouteData.Values["action"].ToString();

            return(FunctionsService.Authorize(controller, action, view.GetNhaThuoc(false)));
        }
示例#2
0
        // [Audit]
        public JsonResult GetRevenueDrugSynthesis()
        {
            var requestParams = this.ToRequestParams <ReportRequestModel>();

            if (requestParams.reportFromDate == DateTime.MinValue)
            {
                return(null);
            }

            IResponseData <RevenueDrugSynthesisResponse> response = new ResponseData <RevenueDrugSynthesisResponse>();

            try
            {
                var reportDate = requestParams.reportFromDate;
                var filter     = new FilterObject()
                {
                    FromDate = reportDate.AbsoluteStart(),
                    ToDate   = reportDate.AbsoluteEnd()
                };
                if (User.IsInRole(MedMan.App_Start.Constants.Security.Roles.User.Value))
                {
                    var nhathuoc  = this.GetNhaThuoc();
                    var hasPermis = FunctionsService.Authorize("Baocao", "Index", nhathuoc);
                    if (!hasPermis)
                    {
                        filter.StaffIds = new int[] { WebSessionManager.Instance.CurrentUserId };
                    }
                }
                var service = IoC.Container.Resolve <IRevenueDrugSynthesisReportService>();
                var data    = service.GetRevenueDrugSynthesis(WebSessionManager.Instance.CurrentDrugStoreCode, filter);
                response.SetData(data);
            }
            catch (ValidationException ex)
            {
                response.SetErrors(ex.Errors);
                response.SetStatus(HttpStatusCode.PreconditionFailed);
            }

            return(Json(response));
        }
示例#3
0
        public ActionResult DrugTransHistories(int?drugId)
        {
            var drug = new CacheDrug();

            if (drugId > 0)
            {
                var drugInfo = MainApp.Instance.GetCacheDrugs(MedSessionManager.CurrentDrugStoreCode, drugId.Value).FirstOrDefault();
                if (drugInfo != null)
                {
                    drug = drugInfo;
                }
            }
            var nhathuoc  = this.GetNhaThuoc();
            var viewModel = new
            {
                Drug = drug,
                HasViewReceiptNotePrivilage  = FunctionsService.Authorize("PhieuNhaps", "Details", nhathuoc) ? 1 : 0,
                HasViewDeliveryNotePrivilage = FunctionsService.Authorize("PhieuXuats", "Details", nhathuoc) ? 1 : 0
            };

            ViewBag.ViewModel = JsonConvert.SerializeObject(viewModel);

            return(View("~/Areas/Production/Views/Reports/TransHistoryReport.cshtml"));
        }
示例#4
0
 public static bool HasPermisson(this WebViewPage view, string controller, string action)
 {
     return(FunctionsService.Authorize(controller.ToLower(), action.ToLower(), view.GetNhaThuoc(false)));
 }