public string InsertUpdateEstimate(EstimateViewModel estimateVM) { //object resultFromBusiness = null; try { AppUA appUA = Session["AppUA"] as AppUA; estimateVM.PSASysCommon = new PSASysCommonViewModel(); estimateVM.PSASysCommon.CreatedBy = appUA.UserName; estimateVM.PSASysCommon.CreatedDate = _pSASysCommon.GetCurrentDateTime(); estimateVM.PSASysCommon.UpdatedBy = appUA.UserName; estimateVM.PSASysCommon.UpdatedDate = _pSASysCommon.GetCurrentDateTime(); object ResultFromJS = JsonConvert.DeserializeObject(estimateVM.DetailJSON); string ReadableFormat = JsonConvert.SerializeObject(ResultFromJS); estimateVM.EstimateDetailList = JsonConvert.DeserializeObject <List <EstimateDetailViewModel> >(ReadableFormat); object result = _estimateBusiness.InsertUpdateEstimate(Mapper.Map <EstimateViewModel, Estimate>(estimateVM)); if (estimateVM.ID == Guid.Empty) { return(JsonConvert.SerializeObject(new { Status = "OK", Record = result, Message = "Insertion successfull" })); } else { return(JsonConvert.SerializeObject(new { Status = "OK", Record = result, Message = "Updation successfull" })); } } catch (Exception ex) { AppConstMessage cm = _appConstant.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Status = "ERROR", Record = "", Message = cm.Message })); } }
public async Task <ActionResult> AddInvoice(EstimateViewModel model) { try { var list = new List <InvoiceViewModel>(); if (ModelState.IsValid) { var loan = _mapper.Map <Loan>(model); var data = await _invoiceService.EstimateInvoicesAsync(loan); await _invoiceService.AddInvoiceAsync(loan, data); list.AddRange(_mapper.Map <List <InvoiceViewModel> >(data)); } else { return(Json(new { status = 500 }, JsonRequestBehavior.AllowGet)); } return(Json(new { status = 200 }, JsonRequestBehavior.AllowGet)); } catch (System.Exception) { return(Json(new { status = 500 }, JsonRequestBehavior.AllowGet)); } }
public EnterMarginAttributes(int revisionid, EstimateViewModel ev) { InitializeComponent(); _revisionid = revisionid; PopulateDetails(ev); }
public EstimateViewModel Map(TaxiResponse response) { if (response == null) { return(null); } var vm = new EstimateViewModel { Origin = response.Origin, Destination = response.Destination, Trips = new List <TripViewModel>() }; if (response.Details == null) { return(vm); } foreach (var detail in response.Details) { var trip = new TripViewModel { Information = detail.Details, CarClass = detail.CarType.ToString(), TaxiService = detail.TaxiService.ToString() }; vm.Trips.Add(trip); } return(vm); }
public ActionResult EstimateDetails(int Id) { ApplicationDbContext pkr = new ApplicationDbContext(); EstimateViewModel models = pkr.Estimate.Single(est => est.Id == Id); return(View(models)); }
public ActionResult SaveEstimate() { try{ string address = Request.Form["address"].ToString(); decimal bundleArea = Convert.ToDecimal(Request.Form["adjustedArea"].ToString()); EstimateViewModel model = new EstimateViewModel(); model.address = address; model.bundle = Convert.ToInt32(bundleArea / 100 * 3); model.Email = Convert.ToString(User.Identity.Name); using (var pkr = new ApplicationDbContext()) { EstimateViewModel est = new EstimateViewModel(); est.address = model.address; est.bundle = model.bundle; est.Email = model.Email; pkr.Estimate.Add(est); pkr.SaveChanges(); } return(View(model)); } catch { return(View("Error")); } }
public ActionResult AddEstimate(EstimateViewModel b) { es.Add(b); List <EstimateViewModel> z = es.GetAll(); Session["EstimatAll"] = z; return(RedirectToAction("EstimateViewAll")); }
public ActionResult Estimate(string sname, string semail, string sphone) { int?samount = 100; var vm = new EstimateViewModel(sname, semail, sphone, samount); // return RedirectToAction("Confirmation", vm); return(View("Confirmation", vm)); }
public MainViewModel(string baseApiUrl) { Estimate = new EstimateViewModel(); SwaggerUrl = new Uri(new Uri(baseApiUrl), "/swagger").ToString(); ////throw new InvalidOperationException(); }
private void PopulateDetails(EstimateViewModel ev) { RetailSystemClient mrsClient = new RetailSystemClient(); mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl()); mrsClient.MarginReport_GetDetailsCompleted += new EventHandler <MarginReport_GetDetailsCompletedEventArgs>(mrsClient_MarginReport_GetDetailsCompleted); mrsClient.MarginReport_GetDetailsAsync(_revisionid); _estmateViewModel = ev; }
public ActionResult NewEstimate(EstimateViewModel zz) { es.Update(zz); List <EstimateViewModel> z = es.GetAll(); Session["EstimatAll"] = z; if (Session["EstiSearch"] == null) { return(RedirectToAction("EstimateViewAll")); } return(RedirectToAction("EstimateSearch")); }
private EstimateViewModel GetEstimateViewModel(Estimate estimate) { var user = _userLogic.Get(estimate.UserId); var estimateViewModel = new EstimateViewModel { ProjectId = estimate.ProjectId, SelectedPoker = estimate.SelectedPoker, UserImage = user.ImagePath, UserName = user.Name, UserId = user.Id.ToString() }; return(estimateViewModel); }
private void SaveData(string pdesc, string pextradesc, string pinternaldesc, decimal pquantity, decimal pprice) { //EstimateDetails ed = new EstimateDetails(); //ed.EstimateDetailsId = int.Parse(txtEstimateDeatilsID.Text); //ed.ProductDescription = pdesc; //ed.ExtraDescription = pextradesc; //ed.InternalDescription = pinternaldesc; //ed.Quantity = pquantity; //ed.Price = pprice; //_estimatevm.UpdateEstimateDetails((EstimateDetails)this.DataContext); EstimateViewModel vm = (EstimateViewModel)this.Resources["EstimateVM"]; vm.UpdateEstimateDetails((EstimateDetails)this.DataContext, 0); }
public ActionResult EditEstimate(int id) { EstimateViewModel z = es.GetEdit(id); ViewData["EstimatAll"] = z; List <VehicleinfoViewModel> x = vh.GetAll(); Session["VehicleAll"] = x; List <CustomerinfoViewModel> w = cs.GetAll(); Session["CustomerAll"] = w; List <PolicyViewModel> a = pl.GetAll(); Session["PolicyAll"] = a; return(View()); }
public async Task <ActionResult> Estimate(EstimateViewModel model) { var list = new List <InvoiceViewModel>(); if (ModelState.IsValid) { var data = await _invoiceService.EstimateInvoicesAsync(_mapper.Map <Loan>(model)); TempData["estimateError"] = null; list.AddRange(_mapper.Map <List <InvoiceViewModel> >(data)); } else { ModelState.AddModelError("*", TempData["estimateError"].ToString()); } return(PartialView(list)); }
// GET: AssignedTasks/Estimate public IActionResult Estimate() { var aspNetUserId = User.FindFirst(ClaimTypes.NameIdentifier).Value; var memberList = _context.GroupMembers.Where(x => x.AspNetUserId == aspNetUserId).ToList(); var taskList = _context.AssignedTasks.Where(x => x.AspNetUserId == aspNetUserId).ToList(); EstimateViewModel viewModel = new EstimateViewModel(); viewModel.TaskTitles = taskList.Select(x => x.Title).ToList(); viewModel.GroupMemberNames = memberList.Select(x => x.Name).ToList(); foreach (var t in taskList) { foreach (var m in memberList) { SuggestedMinute pm = new SuggestedMinute(); pm.TaskId = t.Id; pm.GroupMemberId = m.Id; viewModel.ProposedMinutes.Add(pm); } } return(View(viewModel)); }
public ActionResult EstimateForm(Guid id, Guid?enquiryID) { EstimateViewModel estimateVM = null; AppUA appUA = Session["AppUA"] as AppUA; try { if (id != Guid.Empty) { estimateVM = Mapper.Map <Estimate, EstimateViewModel>(_estimateBusiness.GetEstimate(id)); estimateVM.IsUpdate = true; estimateVM.IsDocLocked = estimateVM.DocumentOwners.Contains(appUA.UserName); estimateVM.EnquirySelectList = _enquiryBusiness.GetEnquiryForSelectList(enquiryID); estimateVM.Currency = new CurrencyViewModel(); } else if (id == Guid.Empty && enquiryID == null) { estimateVM = new EstimateViewModel(); estimateVM.IsUpdate = false; estimateVM.ID = Guid.Empty; estimateVM.EnquiryID = null; estimateVM.EnquirySelectList = new List <SelectListItem>(); estimateVM.DocumentStatus = new DocumentStatusViewModel(); estimateVM.DocumentStatus.Description = "-"; estimateVM.Branch = new BranchViewModel(); estimateVM.Branch.Description = "-"; //estimateVM.Customer = new CustomerViewModel(); //estimateVM.Customer.CompanyName = "-"; estimateVM.IsDocLocked = false; estimateVM.CurrencyCode = "INR"; estimateVM.CurrencyRate = 1; estimateVM.Currency = new CurrencyViewModel() { CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList()) }; } else if (id == Guid.Empty && enquiryID != null) { EnquiryViewModel enquiryVM = Mapper.Map <Enquiry, EnquiryViewModel>(_enquiryBusiness.GetEnquiry((Guid)enquiryID)); estimateVM = new EstimateViewModel(); estimateVM.IsUpdate = false; estimateVM.ID = Guid.Empty; estimateVM.CustomerID = enquiryVM.CustomerID; estimateVM.EnquirySelectList = _enquiryBusiness.GetEnquiryForSelectList(enquiryID); estimateVM.EnquiryID = enquiryID; estimateVM.DocumentStatus = new DocumentStatusViewModel(); estimateVM.DocumentStatus.Description = "-"; estimateVM.Branch = new BranchViewModel(); estimateVM.Branch.Description = "-"; estimateVM.Customer = enquiryVM.Customer; estimateVM.IsDocLocked = false; estimateVM.CurrencyCode = enquiryVM.CurrencyCode; estimateVM.CurrencyRate = enquiryVM.CurrencyRate; estimateVM.Currency = new CurrencyViewModel() { CurrencyList = Mapper.Map <List <Currency>, List <CurrencyViewModel> >(_currencyBusiness.GetCurrencyForSelectList()) }; } } catch (Exception ex) { throw ex; } Permission _permission = _pSASysCommon.GetSecurityCode(appUA.UserName, "CostPrice"); string p = _permission.AccessCode; if ((p.Contains("R") || p.Contains("W"))) { estimateVM.CostPriceHasAccess = true; } else { estimateVM.CostPriceHasAccess = false; } return(PartialView("_EstimateForm", estimateVM)); }
public MaterialsListViewAdapter(List <Tuple <Material, int> > materials, Context context, EstimateViewModel estimatedViewModel) { this.ViewModel = estimatedViewModel; this.materials = materials; this.context = context; }
public EstimateInvoice() { InitializeComponent(); ViewModel = new EstimateViewModel(); this.DataContext = ViewModel; }
public IActionResult Estimate(EstimateViewModel assignedTask) { CalculateEstimatedTimeForTasks(assignedTask.ProposedMinutes); AssignTasks(); return(RedirectToAction(nameof(TaskSummary))); }