public ActionResult View(int id) { var hasAccess = AuthorizationManager.HasAccess("InstagramContract.View"); if (!hasAccess) { throw new Exception("شما مجاز به انجام این عملیات نیستید"); } var total = 0; LogManagement.Logging($"View InstagramContract id:{id}", (int)LogType.Info, "View InstagramContract", "InstagramContractController/ViewAction"); var model = InstagramContractService.GetInstance().GetDefaultQuery(new InstagramContractSearchObject(), new List <Navigations> { Navigations.person, Navigations.City }, out total) .Where(w => w.Id == id).FirstOrDefault(); var planDpService = PlanDurationPriceService.GetInstance(); var planTypeService = PlanTypeService.GetInstance(); model.InstagramContractPlans.ToList().ForEach(item => { var ptId = planDpService.GetEntity(item.PlanDurationPriceId).PlanTypeId; item.PlanTitle = planTypeService.GetEntity(ptId).PlanTitle; }); return(View(model)); }
public ActionResult GetPlanDurationPrices(int id) { var planType = PlanDurationPriceService.GetInstance().GetDefaultQuery().OrderBy(p => p.DisplayOrder) .Where(w => w.PlanTypeId == id).Select(s => new { Id = s.Id, Price = s.Price, Duration = s.Duration, PlanDescription = s.PlanDescription }).ToList(); return(Json(planType, JsonRequestBehavior.AllowGet)); //message }
private ContractDTO GetReportDTO(int id) { var total = 0; var Contract = InstagramContractService.GetInstance().GetDefaultQuery(new InstagramContractSearchObject(), out total) .Where(w => w.Id == id).FirstOrDefault(); var geoDivisionService = GeoDivisionService.GetInstance(); var city = geoDivisionService.GetDefaultQuery().Where(w => w.Id == Contract.CustomerCityId).FirstOrDefault(); var state = geoDivisionService.GetDefaultQuery().Where(w => w.Id == city.ParentId).FirstOrDefault(); var personName = PersonService.GetInstance().GetEntity(Contract.PersonId ?? 0)?.FullName; var obj = new ContractDTO { ContractNo = Contract.ContractNo.ToString(), CustomerCity = city.Title, PlanDescription = HtmlConvert(Contract.ContractPlanDescriptions), CustomerManagerName = Contract.CustomerManagerName, CustomerMobile = Contract.CustomerMobile, CustomerName = Contract.CustomerName, InstagramId = Contract.InstagramId, CustomerState = state.Title, PersonName = personName, DiscountPriceStr = Contract.DiscountTotalPrice.ToString("N0", new NumberFormatInfo() { NumberGroupSizes = new[] { 3 }, NumberGroupSeparator = "," }), PaymentPriceStr = Contract.PaymentTotalPrice.ToString("N0", new NumberFormatInfo() { NumberGroupSizes = new[] { 3 }, NumberGroupSeparator = "," }), ContractDate = Contract.ContractDate.ToPersianString(), ContractContext = HtmlConvert(Contract.ContractContext), TotalPriceStr = Contract.TotalPrice.ToString("N0", new NumberFormatInfo() { NumberGroupSizes = new[] { 3 }, NumberGroupSeparator = "," }), }; var contractPlans = new List <ContractPlanDTO>(); var rowIndex = 0; Contract.InstagramContractPlans.ToList().ForEach(item => { rowIndex++; var planTypeId = PlanDurationPriceService.GetInstance().GetDefaultQuery() .Where(w => w.Id == item.PlanDurationPriceId).Select(s => s.PlanTypeId).FirstOrDefault(); var planTitle = PlanTypeService.GetInstance().GetEntity(planTypeId).PlanTitle; var objItem = new ContractPlanDTO { DiscountStr = item.Discount.ToString("N0", new NumberFormatInfo() { NumberGroupSizes = new[] { 3 }, NumberGroupSeparator = "," }), DurationTitle = item.DurationTitle, PersianStartDate = item.StartDate.ToPersianString(), PlanTitle = planTitle, RowIndex = rowIndex.ToString(), TotalPriceStr = item.TotalPrice.ToString("N0", new NumberFormatInfo() { NumberGroupSizes = new[] { 3 }, NumberGroupSeparator = "," }), PriceStr = item.Price.ToString("N0", new NumberFormatInfo() { NumberGroupSizes = new[] { 3 }, NumberGroupSeparator = "," }), }; contractPlans.Add(objItem); }); obj.ContractPlans = contractPlans; return(obj); }