public List <QuotationViewModel> GetDealerCompanyList(long From, long To, long DealerProductId, long DealerServiceId) { //List<long> cMS_DealerCities = CMSEntities.CMS_DealerCity.Where(x => x.CityId == From || x.CityId == To).Select(x => x.CityId).ToList(); List <long> cMS_DealerCities = new List <long> { From, To }; List <CMS_DealerInfo> dealers = (from d in CMSEntities.CMS_DealerInfo join c in CMSEntities.CMS_DealerCity on d.DealerId equals c.DealerId where cMS_DealerCities.Contains(c.CityId) join p in CMSEntities.CMS_DealerProductCategory on d.DealerId equals p.DealerId where p.CategoryId == DealerProductId join s in CMSEntities.CMS_DealerService on d.DealerId equals s.DealerId where s.ServiceId == DealerServiceId select d).Include(x => x.CMS_DealerRate).ToList(); //List<decimal> perkgprice = dealers[0].CMS_DealerRate.Cast<CMS_DealerRate>().Select(x => x.PerKgPrice).ToList(); //dealers = dealers.Where(x => cMS_DealerCities.Contains(x.CMS_DealerCity.)) dealers = dealers.Distinct().ToList(); List <QuotationViewModel> dealerViewModels = new List <QuotationViewModel>(); foreach (CMS_DealerInfo cMS_DealerInfo in dealers) { QuotationViewModel dealerViewModel = new QuotationViewModel(); dealerViewModel.DealerId = cMS_DealerInfo.DealerId; dealerViewModel.RoleId = cMS_DealerInfo.RoleId; dealerViewModel.CompanyName = cMS_DealerInfo.CompanyName; dealerViewModel.CategoryName = CMSEntities.CMS_ProductCategoryMaster.Find(DealerProductId).CategoryName; dealerViewModel.ServiceName = CMSEntities.CMS_ServiceMaster.Find(DealerServiceId).ServiceName; dealerViewModel.PerCategoryPrice = cMS_DealerInfo.CMS_DealerRate.Cast <CMS_DealerRate>().FirstOrDefault().PerCategoryPrice; dealerViewModel.PerServicePrice = cMS_DealerInfo.CMS_DealerRate.Cast <CMS_DealerRate>().FirstOrDefault().PerServicePrice; dealerViewModel.PerKgPrice = cMS_DealerInfo.CMS_DealerRate.Cast <CMS_DealerRate>().FirstOrDefault().PerKgPrice; dealerViewModel.PerKmPrice = cMS_DealerInfo.CMS_DealerRate.Cast <CMS_DealerRate>().FirstOrDefault().PerKmPrice; dealerViewModels.Add(dealerViewModel); } return(dealerViewModels); }
/// <summary> /// Obtiene informacion de diferentes tablas en relacion a la cotizaciones /// </summary> /// <returns>Lista de cotizaciones</returns> public ActionResult QuotationList() { BostreamEntities1 db = new BostreamEntities1(); List <Quotation> quotationList = db.Quotations.ToList(); QuotationViewModel quotationViewModel = new QuotationViewModel(); var list = (from q in db.Quotations join c in db.Customers on q.CustomerID equals c.CustomerID join p in db.People on c.PersonID equals p.PersonId join s in db.Services on q.ServiceID equals s.ServiceID select new QuotationViewModel { CustomerID = c.CustomerID, Name = p.FirstName + " " + p.LastName, QuotationService = s.Name, CreationDate = q.CreationDate, ExpirationDate = q.ExpirationDate, Price = q.Price }).ToList(); return(View(list)); }
public ActionResult Index(QuotationViewModel qViewModel) { qViewModel.Enquiries = _enqRepo.GetEnquiryItemDetails(qViewModel.Enquiry.EnquiryId); _qRepo.GetQuotationTaskInfo(qViewModel.Quotation); qViewModel.Users = _enqRepo.drpGetUsers(); return(View("Index", qViewModel)); }
public PartialViewResult CloneTrainPassDetails(int quotationItemId) { QuotationViewModel qViewModel = new QuotationViewModel(); try { qViewModel.Quotation = _qRepo.GetQuotationTrainDetailsById(quotationItemId); qViewModel.Quotation.QuotationItemPassDetail = _qRepo.GetQuotationTrainPassDetailsById(quotationItemId); Set_Date_Session(qViewModel.Quotation); qViewModel.Quotation.QuotationItemId = 0; qViewModel.Quotation.QuotationItemId = _qRepo.InsertTrainQuotationItemPass(qViewModel.Quotation); } catch (Exception ex) { qViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01")); Logger.Error("Quotation Controller - CloneTrainTypeDetails " + ex.Message); } TempData["enqViewModel"] = qViewModel; return(PartialView("_QuotationEnquiryItem", qViewModel)); }
public PartialViewResult GetQuotationTrainPassDetailsById(int quotationItemId) { QuotationViewModel qViewModel = new QuotationViewModel(); try { qViewModel.Quotation = _qRepo.GetQuotationTrainDetailsById(quotationItemId); qViewModel.Quotation.QuotationItemTypeDetail = _qRepo.GetQuotationTrainTypeDetailsById(quotationItemId); qViewModel.Quotation.QuotationItemPassDetail = _qRepo.GetQuotationTrainPassDetailsById(quotationItemId); } catch (Exception ex) { qViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01")); Logger.Error("Quotation Controller - GetQuotationTrainDetailsById " + ex.Message); } TempData["enqViewModel"] = qViewModel; qViewModel.Cities = _pRepo.drpGetCountryStateCity(); qViewModel.Users = _enqRepo.drpGetUsers(); return(PartialView("_AddTrainCTS", qViewModel)); }
public PartialViewResult GetEnquiryFlightDetailsById(int enquiryItemId) { QuotationViewModel qViewModel = new QuotationViewModel(); try { qViewModel.Enquiry = _qRepo.GetFlightDetailsById(enquiryItemId); //qViewModel.Enquiry.EnquiryItemTypeDetails = _enqRepo.GetFlightTypeDetailsById(enquiryItemId); } catch (Exception ex) { qViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01")); Logger.Error("Enquiry Controller - GetFitDetailsById " + ex.Message); } TempData["qViewModel"] = qViewModel; qViewModel.Cities = _pRepo.drpGetCountryStateCity(); qViewModel.Users = _enqRepo.drpGetUsers(); return(PartialView("_AddFlightCTS", qViewModel)); }
public JsonResult InsertQuotationItem(QuotationViewModel qViewModel) { try { Set_Date_Session(qViewModel.Quotation); if (qViewModel.Quotation.QuotationId == 0) { qViewModel.Quotation.QuotationId = _qRepo.InsertQuotationBasic(qViewModel.Quotation); _qRepo.InsertQuotationTask(qViewModel.Quotation); } qViewModel.Quotation.QuotationItemId = _qRepo.InsertQuotationItem(qViewModel.Quotation); qViewModel.FriendlyMessage.Add(MessageStore.Get("Q04")); Logger.Debug("Quotation Controller InsertQuotationItem"); } catch (Exception ex) { qViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01")); Logger.Error("Quotation Controller - InsertQuotationItem " + ex.Message); } return(Json(qViewModel)); }
/// <summary> /// Request new Quotation /// </summary> /// <param name="model"></param> public void RequestQuote(QuotationViewModel model) { Buyer buyer = new Buyer(); if (model.BuyerId != null) { // retrieve existing buyer buyer = _buyerRepository.GetById(model.BuyerId.Value); } else { // create a new buyer and add it to the db buyer = _buyerRepository.Add(new Buyer(model.FullName, model.ContactEmail, model.PhoneNumber) { ShippingAddress = new Address(model.StreetAddress, model.City, model.State, model.Country, model.ZipCode), BillingAddress = new Address(model.StreetAddress, model.City, model.State, model.Country, model.ZipCode) }); } List <OrderItem> orderItems = model.OrderItems .Select(o => new OrderItem { PartNumber = o.PartNumber, Quantity = o.Quantity }).ToList(); _orderService.CreateOrder(buyer.Id, orderItems); }
public async Task <ActionResult> CreateQuote(Guid?id, string search = null) { try { var model = await _quote.GetRequestQuoteToEdit((Guid)id); QuotationViewModel quotation = new QuotationViewModel(); quotation.ReferenceNumber = model.ReferenceNumber; quotation.ProjectName = model.ProjectName; quotation.ProjectDescription = model.ProjectDescription; quotation.ClientId = model.ClientId; quotation.Documents = model.ProjectDocuments; quotation.QuoteRequestId = model.Id; quotation.Foreman = "1"; //quotation.GeneralWorkers = "1"; quotation.QuoteMaterials = await _quote.GetQuoteMaterials((Guid)id, search); quotation.QuoteEquipments = await _quote.GetQuoteEquipments((Guid)id, search); // if you want eg 5 items loaded initial (ToPagedList, 5) quotation.QuoteMaterials = quotation.QuoteMaterials.ToPagedList(1, 2); quotation.QuoteEquipments = quotation.QuoteEquipments.ToPagedList(1, 2); return(View(quotation)); } catch { return(RedirectToAction("BadRequest", "Home")); } }
public void BuildSelectLists(QuotationViewModel quotationViewModel) { quotationViewModel.PaymentTermDropDown = paymentTermSelectListBuilder.BuildSelectListItemsForPaymentTerms(paymentTermRepository.GetAllPaymentTerms()); quotationViewModel.PersonInChargeDropDown = aspNetUserSelectListBuilder.BuildSelectListItemsForAspNetUsers(aspNetUserRepository.GetAllAspNetUsers(), quotationViewModel.UserID); quotationViewModel.ApproverDropDown = aspNetUserSelectListBuilder.BuildSelectListItemsForAspNetUsers(aspNetUserRepository.GetAllAspNetUsers(), quotationViewModel.UserID); quotationViewModel.PreparedPersonDropDown = aspNetUserSelectListBuilder.BuildSelectListItemsForAspNetUsers(aspNetUserRepository.GetAllAspNetUsers(), quotationViewModel.UserID); }
public QuotationReport(QuotationViewModel viewModel) { InitializeComponent(); DataContext = viewModel; vm = viewModel; }
private void SetUsersSession(SessionInfo session) { QuotationViewModel qsViewModel = new QuotationViewModel(); try { Logger.Debug("Authentication Controller SetUserSession"); if (HttpContext.Session["SessionInfo"] == null) { HttpContext.Session.Add("SessionInfo", session); HttpContext.Session.Add("BookingCart", qsViewModel.Quotation.QuatationItem); } else { HttpContext.Session["SessionInfo"] = session; } } catch (Exception ex) { UserViewModel homeViewModel = new UserViewModel(); homeViewModel.FriendlyMessage.Add(MessageStore.Get("UM004")); Logger.Error("Authentication Controller - Set Session " + ex.Message); TempData["homeViewModel"] = homeViewModel; HttpContext.Session.Clear(); } }
public void TestInitialize() { _panel1 = new PanelViewModel(new Panel()) { Price = 5, Time = 5, TotalPrice = 5, }; _panel2 = new PanelViewModel(new Panel()) { }; _quotationStatus = new QuotationStatus(new DateTime(), QuotationStatusType.Created); _quotation = new Quotation(_quotationStatus) { PriceDifference = 50, HourPrice = 200, BasePrice = 50, ContributionRatio = 0.5, }; _quotationViewModel = new QuotationViewModel(_quotation); }
public void OnNavigatedTo(NavigationContext navigationContext) { if (navigationContext.NavigationService.Region.Name == RegionNames.MainRegion) { QuotationViewModel = new QuotationViewModel(quotationDb); } }
public JsonResult Update(QuotationViewModel qViewModel) { try { Set_Date_Session(qViewModel.Quotation); _qRepo.UpdateQuotationBasic(qViewModel.Quotation); if (qViewModel.IsApproval && qViewModel.QuotaionItems != null && qViewModel.QuotaionItems.Any()) { foreach (var item in qViewModel.QuotaionItems) { Set_Date_Session(item); _qRepo.UpdateQuotationItemStatus(item); } SendApprovedQuotationEmail(qViewModel.Quotation.QuotationId); } qViewModel.FriendlyMessage.Add(MessageStore.Get("Q02")); Logger.Debug("Quotation Controller UpdateQuotation"); } catch (Exception ex) { qViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01")); Logger.Error("Quotation Controller - UpdateQuotation " + ex.Message); } return(Json(qViewModel)); //return RedirectToAction("Index"); }
public QuotationPage() { InitializeComponent(); viewModel = new QuotationViewModel(); DataContext = viewModel; quotationPage = this; }
public PartialViewResult AddFlightCTS(QuotationViewModel qViewModel) { qViewModel.Cities = _pRepo.drpGetCountryStateCity(); qViewModel.Users = _enqRepo.drpGetUsers(); return(PartialView("_AddFlightCTS", qViewModel)); }
public async Task <PartialViewResult> PagedMarterial(Guid id, int?page) { QuotationViewModel quotation = new QuotationViewModel(); quotation.QuoteMaterials = await _quote.GetQuoteMaterials(id, null); quotation.QuoteMaterials = quotation.QuoteMaterials.ToPagedList(page ?? 1, 2); return(PartialView("_LoadMoreMaterial", quotation)); }
public async Task <PartialViewResult> PagedEquiptment(Guid id, int?page) { QuotationViewModel quotation = new QuotationViewModel(); quotation.QuoteEquipments = await _quote.GetQuoteEquipments(id, null); quotation.QuoteEquipments = quotation.QuoteEquipments.ToPagedList(page ?? 1, 2); return(PartialView("_LoadMoreEquiptment", quotation)); }
/// <summary> /// Initialize a new Quotation Report /// </summary> /// <param name="quoteFor">Specify the particular quotations that you are Reporting on /// All for allClients and Client for a particular client</param> /// <param name="viewModel">The ViewModel where all data is taken from</param> /// <param name="_who">Specifies who the quotation is for to be displayed on the form</param> public QuotationsReport(string quoteFor, QuotationViewModel viewModel, string _who) { InitializeComponent(); DataContext = viewModel; vm = viewModel; DcQutations.Who = _who; DcQutations.DateChanged += DcQutations_DateChanged; currentContext = SynchronizationContext.Current; QuoteFor = quoteFor; DcQutations.Month = 0; }
// GET: Quotations/Create public ActionResult Create(int?id) { Customer customer = db.Customers.SingleOrDefault(x => x.Id == id); QuotationViewModel model = new QuotationViewModel(); model.CustomerId = customer.Id; model.CustomerName = customer.Name; return(View(model)); }
public async Task <PartialViewResult> SearchEquiptment(Guid id, string searchTerm) { if (searchTerm == "undefined" || searchTerm == "") { searchTerm = null; } QuotationViewModel quotation = new QuotationViewModel(); quotation.QuoteEquipments = await _quote.GetQuoteEquipments(id, searchTerm); return(PartialView("_EquiptmentPartial", quotation)); }
public async Task <PartialViewResult> SearchMarterial(Guid id, string searchTerm) { if (searchTerm == "undefined" || searchTerm == "") { searchTerm = null; } QuotationViewModel quotation = new QuotationViewModel(); quotation.QuoteMaterials = await _quote.GetQuoteMaterials(id, searchTerm); return(PartialView("_MaterialPartial", quotation)); }
public ActionResult Edit(QuotationViewModel quotation) { if (ModelState.IsValid) { var entity = Mapper.Map <Quotation>(quotation); quotationService.Update(entity); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(customerService.GetAll(), "Id", "FullName"); ViewBag.ProductId = new SelectList(productService.GetAll(), "Id", "Name"); ViewBag.TaxId = new SelectList(taxService.GetAll(), "Id", "Name"); return(View(quotation)); }
public IActionResult Index(int pageNumber = 1, QuotationSortType sortOrder = QuotationSortType.None, QuotationFilterData filterData = null) { var paginationData = new PaginationData(pageNumber); var quotations = QuotationRepository.Get(sortOrder, filterData, paginationData).ToList(); var quotationModels = Mapper.Map <List <QuotationModel> >(quotations); var quotationCount = QuotationRepository.GetTotalCount(sortOrder, filterData); var paginationModel = new PaginationModel(paginationData, quotationCount); var model = new QuotationViewModel(quotationModels, sortOrder, filterData, paginationModel); return(View("Index", model)); }
// GET: Quotations/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuotationViewModel quotation = Mapper.Map <QuotationViewModel>(quotationService.Get(id.Value)); if (quotation == null) { return(HttpNotFound()); } return(View(quotation)); }
public JsonResult SupplierAddToCart(QuotationViewModel qViewModel) { QuotationViewModel qsViewModel = new QuotationViewModel(); JavaScriptSerializer json_serializer = new JavaScriptSerializer(); try { if (Request.Cookies["Bookings"].Value != null) { if (Request.Cookies["Bookings"].Value != "") { qsViewModel.Quotation.QuatationItem = json_serializer.Deserialize <List <BookingCartDetailsInfo> >(Request.Cookies["Bookings"].Value); string PackageName = qViewModel.Quotation.QuatationItem.Select(x => x.PackageName).FirstOrDefault(); if (!qsViewModel.Quotation.QuatationItem.Where(x => x.PackageName == PackageName).Any()) { qsViewModel.Quotation.QuatationItem.AddRange(qViewModel.Quotation.QuatationItem); string jsonData = json_serializer.Serialize(qsViewModel.Quotation.QuatationItem); Response.Cookies["Bookings"].Value = jsonData; HttpContext.Response.SetCookie(Response.Cookies["Bookings"]); } } else { string jsonData = json_serializer.Serialize(qViewModel.Quotation.QuatationItem); Response.Cookies["Bookings"].Value = jsonData; HttpContext.Response.SetCookie(Response.Cookies["Bookings"]); } } } catch (Exception ex) { qsViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01")); Logger.Error("SupplierSearch Controller - HotelAddToCart" + ex.ToString()); Request.Cookies["Bookings"].Value = null; } return(Json(qsViewModel, JsonRequestBehavior.AllowGet)); }
protected override void OnNavigatedTo(NavigationEventArgs e) { int quotationId = (e.Parameter as int?).Value; PageHelper.DoAsync(overlay, Dispatcher, () => { QuotationViewModel.LoadQuotationByPK(quotationId); PageHelper.MainUI(Dispatcher, () => { this.Bindings.Update(); }); }); }
public ActionResult DeleteConfirmed(int id, int customerId) { Quotation quotation = db.Quotations.Include("FileData").SingleOrDefault(x => x.Id == id); QuotationViewModel vm = new QuotationViewModel { Id = quotation.Id, Name = quotation.Name, CustomerId = customerId }; db.FileDatas.Remove(quotation.FileData); db.Quotations.Remove(quotation); db.SaveChanges(); return(RedirectToAction("Details", "Customers", new { id = customerId })); }
private void OnOpenQuotationEvent(QuotationEventArgs arg) { if (arg != null && arg.QuotationDataSet != null && arg.QuotationDataSet.Tables.Count == 4 && arg.QuotationDataSet.Tables[0].Rows.Count > 0) { QuotationViewModel = new QuotationViewModel(quotationDb, arg.QuotationDataSet); if (this.QuotationViewModel != null) { string qNo = this.QuotationViewModel.CurrentInsuranceDetail.InsuranceQtnNo; QuotationNo = string.Format("Quotation No : {0}", qNo); } ClearRegions(arg.RegionName); this.RegionManager.RequestNavigate(arg.RegionName, arg.Source); } else { } }