private MessageBoxResult MainPage_CloseCommand(string PageId) { MessageBoxResult lBoxResult = MessageBoxResult.None; HSQuotation lEdit = DataContext as HSQuotation; if (PageId.ToUpper().Contains("OPEN QUOTATION") || PageId.ToUpper().Contains("OPEN MASTER QUOTATION")) { if (lEdit.CustomerId != null && lEdit.CustomerId > 0) { lBoxResult = MessageBox.Show("Please Save changes..", "Confirm Quotation", MessageBoxButton.YesNo, MessageBoxImage.Warning); } } else { if (lEdit.CustomerId != null && lEdit.CustomerId > 0) { lBoxResult = MessageBox.Show(" Yes : Save and Close\n No : Close without Save\n Cancel : Cancel Close", "Confirm Quotation", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning); } } if (lBoxResult == MessageBoxResult.Yes) { if (lEdit.CustomerId != null && lEdit.CustomerId > 0) { lEdit.SaveQuotation(); } } return(lBoxResult); }
public async Task <ActionResult> RFQFinalPreview(int?id) { using (BTCEntities db = new BTCEntities()) { ViewBag.TravelAgency = db.TravelAgency.ToList(); ViewBag.Cities = db.City.ToList(); ViewBag.Currencies = db.Currency.ToList(); ViewBag.ApprovalBy = db.Users.ToList(); RFQ rfqlist = await db.RFQ.Include(a => a.TravelRequests).Include(a => a.TravelAgency).Include(a => a.Users).Where(a => a.ID == id).FirstOrDefaultAsync(); ViewBag.fileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == (rfqlist.RFQName + "Pro" + rfqlist.ProcessingSection + "Trav" + rfqlist.TravelAgencyID)).Select(x => x.Attachments).ToList(); MasterRFQ = rfqlist; if (rfqlist.ProcessingSection == (int)ProcessingSections.AT || rfqlist.ProcessingSection == (int)ProcessingSections.ATHS || rfqlist.ProcessingSection == (int)ProcessingSections.ATHSPC || rfqlist.ProcessingSection == (int)ProcessingSections.ATPC) { ATQuotation atquot = new ATQuotation(); atquot.DestinationID = rfqlist.TravelRequests.PortOfDestinationID; atquot.DepartureDate = rfqlist.TravelRequests.DepartureDate; atquot.DepartureTime = rfqlist.TravelRequests.DepartureTime; atquot.OriginID = rfqlist.TravelRequests.PortOfOriginID; atquot.ReturnDate = rfqlist.TravelRequests.ReturnDate; atquot.ReturnTime = rfqlist.TravelRequests.ReturnTime; atquot.TicketClass = rfqlist.TravelRequests.TicketClass; ViewBag.ATQuotation = atquot; } if (rfqlist.ProcessingSection == (int)ProcessingSections.ATHS || rfqlist.ProcessingSection == (int)ProcessingSections.ATHSPC || rfqlist.ProcessingSection == (int)ProcessingSections.HS || rfqlist.ProcessingSection == (int)ProcessingSections.HSPC) { HSQuotation hsquot = new HSQuotation(); hsquot.CheckInDate = rfqlist.TravelRequests.CheckInDate; hsquot.CheckInTime = rfqlist.TravelRequests.CheckInTime; hsquot.CheckOutDate = rfqlist.TravelRequests.CheckOutDate; hsquot.CheckOutTime = rfqlist.TravelRequests.CheckOutTime; hsquot.HotelCategory = rfqlist.TravelRequests.HotelCategory; hsquot.HotelName = rfqlist.TravelRequests.HotelName; hsquot.RoomCategory = rfqlist.TravelRequests.RoomCategory; hsquot.RoomType = rfqlist.TravelRequests.RoomType; ViewBag.HSQuotation = hsquot; } if (rfqlist.ProcessingSection == (int)ProcessingSections.ATHSPC || rfqlist.ProcessingSection == (int)ProcessingSections.ATPC || rfqlist.ProcessingSection == (int)ProcessingSections.HSPC || rfqlist.ProcessingSection == (int)ProcessingSections.PC) { PCQuotation pcquot = new PCQuotation(); pcquot.DropOffDate = rfqlist.TravelRequests.DropOffDate; pcquot.DropoffLocation = rfqlist.TravelRequests.DropOffLocation; pcquot.DropOffTime = rfqlist.TravelRequests.DropOffTime; pcquot.PickUpDate = rfqlist.TravelRequests.PickUpDate; pcquot.PickupLocation = rfqlist.TravelRequests.PickUpLocation; pcquot.PickUpTime = rfqlist.TravelRequests.PickUpTime; pcquot.PreferredVehicle = rfqlist.TravelRequests.PreferredVehicle; ViewBag.PCQuotation = pcquot; } using (EmployeeDetailsDBService EmpDBService = new EmployeeDetailsDBService("", rfqlist.TravelRequests.Users1.HREmployeeID.ToString())) { ViewBag.FullEmployeeDetails = EmpDBService.FullEmployeeDetails(); } return(View(rfqlist)); } }
public QuotationEditor(int SalesId) { InitializeComponent(); lDataContext = new CommonFunction().JSDataContext(); MainPage.CloseCommand -= MainPage_CloseCommand; MainPage.CloseCommand += MainPage_CloseCommand; HSQuotation lEditSales = new HSQuotation(); DataSource.Sale lSales = lDataContext.Sales.SingleOrDefault(p => p.Id == SalesId); if (lSales != null) { lEditSales.Id = lSales.Id; lEditSales.CustomerId = lSales.CustomerId.Value; lEditSales.SelectedCustomer = lSales.Customer; lEditSales.SalesDate = lSales.SalesDate; lEditSales.SellerId = lSales.SellerId; lEditSales.Description = lSales.Description; //lEditSales.Order = lEditSales.Order; //lEditSales.Order = lSales.Order; lEditSales.IsMaster = lSales.Master; lEditSales.ExpireDate = lSales.ExpireDate; //lEditSales.SalesPerson = new HSEmployee { Id = lSales.Id, SelectedPerson = lSales.Employee.Person }; lEditSales.DeleteEnabled = true; foreach (DataSource.SalesItem l in lSales.SalesItems) { lEditSales.SalesItems.Add(new HSOrderItem { Id = l.Id, CustomerId = lSales.CustomerId.Value, OrderId = l.SalesId.Value, ProductId = l.ProductId.Value, SelectedProduct = l.Product, UnitPrice = l.UnitPrice, VatId = l.VatId, SelectedVat = l.VatRate, Quantity = l.Quantity, SellingUnitId = l.SellingUnitId, SelectedSellingUnit = l.SellingUnit, ProductName = l.Product.Name, ProductDescription = l.Product.Description, VAT = l.VatRate.Name, Unit = (l.SellingUnit == null) ? "NA" : l.SellingUnit.Unit, Description = l.Description }); } this.DataContext = lEditSales; } }
public ReportViewer(HSQuotation lSales, ObservableCollection <HSOrderItem> lOrderItems) { InitializeComponent(); Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource(); reportSource.ReportDocument = new rptQuotation(lSales, lOrderItems); // Assigning the report to the report viewer. DefaultViewer.ReportSource = reportSource; this.Header = "Quotation Report"; }
public static HSQuotation PrintSales(int salesId) { JSDataContext lDataContext = new CommonFunction().JSDataContext(); HSQuotation lEditSales = new HSQuotation(); DataSource.Sale lSales = lDataContext.Sales.SingleOrDefault(p => p.Id == salesId); if (lSales != null) { lEditSales.Id = lSales.Id; lEditSales.CustomerId = lSales.CustomerId.Value; lEditSales.SelectedCustomer = lSales.Customer; lEditSales.SalesDate = lSales.SalesDate; lEditSales.SellerId = lSales.SellerId; lEditSales.Description = lSales.Description; lEditSales.Order = lEditSales.Order; //lEditSales.Order = lSales; //lEditSales.SalesPerson = new HSEmployee { Id = lSales.Id, SelectedPerson = lSales.Employee.Person }; lEditSales.DeleteEnabled = true; foreach (DataSource.SalesItem l in lSales.SalesItems) { lEditSales.SalesItems.Add(new HSOrderItem { Id = l.Id, CustomerId = lSales.CustomerId.Value, OrderId = l.SalesId.Value, ProductId = l.ProductId.Value, SelectedProduct = l.Product, UnitPrice = l.UnitPrice, VatId = l.VatId, VAT = l.VatRate.Name, SelectedVat = l.VatRate, Quantity = l.Quantity, SellingUnitId = l.SellingUnitId, Unit = l.SellingUnit.Unit, SelectedSellingUnit = l.SellingUnit, ProductName = l.Product.Name, ProductDescription = l.Product.Description, Description = l.Description }); } } return(lEditSales); }
private void OnPrintCommandExecuted(object Param) { HSQuotationHistory lSalesHistory = Param as HSQuotationHistory; HSQuotation lEditOrder = CommonFunction.PrintSales(lSalesHistory.SalesId); SunSeven.Reports.ReportViewer lRptViewer = new Reports.ReportViewer(lEditOrder, lEditOrder.SalesItems); Window lWindows = Models.CommonFunction.GetApplicationWindow(); if (lWindows != null) { lRptViewer.Owner = lWindows; } lRptViewer.ShowDialog(); }
public ActionResult ViewHSQuotations(int?id) { using (BTCEntities db = new BTCEntities()) { quotation = db.Quotation.Include(a => a.TravelRequests).Where(x => x.ID == id).FirstOrDefault(); List <HSQuotation> hsQuotes = new List <HSQuotation>(); ViewBag.Cities = db.City.ToList(); if (id > 0 && quotation.HSQuotation.Count > 0) { foreach (var item in db.HSQuotation.Include(x => x.Quotation).Include(x => x.Quotation.TravelRequests).Where(a => a.QuotationID == id && a.IsActive == true && a.IsDeleted == false)) { HSQuotation hsQuote = item; ViewBag.fileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); ViewBag.HSfileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); hsQuotes.Add(hsQuote); } } return(View(hsQuotes)); } }
public ActionResult AddHSQuotation(HSQuotation hsquote, FormCollection formCollection) { ModelState.Remove("CheckInTime"); ModelState.Remove("CheckOutTime"); if (ModelState.IsValid) { using (BTCEntities db = new BTCEntities()) { hsquote.ID = string.IsNullOrEmpty(Convert.ToString(formCollection["HSId"])) ? 0 : Convert.ToInt32(formCollection["HSId"]); if ((bool)hsquote.IsLowest && db.HSQuotation.Include(a => a.Quotation).Where(a => a.QuotationID == hsquote.QuotationID && a.ID != hsquote.ID && (bool)a.IsLowest).Count() > 0) { hsquote.Quotation = db.Quotation.Where(a => a.ID == hsquote.QuotationID).FirstOrDefault(); TempData["ErrorMessage"] = new List <string>() { "Only One quotaiton can be the lowest" }; TempData["HSQuotationVal"] = hsquote; return(RedirectToAction("AddHSQuotation", new { quoteid = hsquote.QuotationID })); } var dbhsquote = db.HSQuotation.Include(a => a.Quotation).Where(a => a.QuotationID == hsquote.QuotationID && a.ID == hsquote.ID).FirstOrDefault(); dbhsquote.HotelName = string.IsNullOrEmpty(hsquote.HotelName) ? "" : hsquote.HotelName; dbhsquote.HotelCategory = string.IsNullOrEmpty(hsquote.HotelCategory) ? "" : hsquote.HotelCategory; dbhsquote.RoomCategory = string.IsNullOrEmpty(hsquote.RoomCategory) ? "" : hsquote.RoomCategory; dbhsquote.RoomType = string.IsNullOrEmpty(hsquote.RoomType) ? "" : hsquote.RoomType; dbhsquote.TravelSector = string.IsNullOrEmpty(hsquote.TravelSector) ? "" : hsquote.TravelSector; dbhsquote.CheckInTime = string.IsNullOrEmpty(Convert.ToString(formCollection["CheckInTime"])) ? new TimeSpan() : DateTime.ParseExact(Convert.ToString(formCollection["CheckInTime"]), "hh:mm tt", CultureInfo.InvariantCulture).TimeOfDay; dbhsquote.CheckOutTime = string.IsNullOrEmpty(Convert.ToString(formCollection["CheckOutTime"])) ? new TimeSpan() : DateTime.ParseExact(Convert.ToString(formCollection["CheckOutTime"]), "hh:mm tt", CultureInfo.InvariantCulture).TimeOfDay; dbhsquote.Amount = hsquote.Amount; dbhsquote.CheckInDate = hsquote.CheckInDate; dbhsquote.CheckOutDate = hsquote.CheckOutDate; dbhsquote.IsDeleted = false; dbhsquote.IsActive = true; dbhsquote.IsLowest = hsquote.IsLowest; db.HSQuotation.Attach(dbhsquote); var entry = db.Entry(dbhsquote); entry.Property(a => a.Amount).IsModified = true; entry.Property(a => a.CheckInDate).IsModified = true; entry.Property(a => a.CheckInTime).IsModified = true; entry.Property(a => a.CheckOutDate).IsModified = true; entry.Property(a => a.CheckOutTime).IsModified = true; entry.Property(a => a.HotelCategory).IsModified = true; entry.Property(a => a.HotelName).IsModified = true; entry.Property(a => a.IsActive).IsModified = true; entry.Property(a => a.IsDeleted).IsModified = true; entry.Property(a => a.RoomCategory).IsModified = true; entry.Property(a => a.RoomType).IsModified = true; entry.Property(a => a.TravelSector).IsModified = true; entry.Property(a => a.IsLowest).IsModified = true; db.SaveChanges(); return(RedirectToAction("AddQuotation", new { id = dbhsquote.Quotation.RFQID })); } } else { using (BTCEntities db = new BTCEntities()) { hsquote.Quotation = db.Quotation.Where(a => a.ID == hsquote.QuotationID).FirstOrDefault(); } var errlist = ModelState.Values.Where(e => e.Errors.Count > 0).Select(a => a.Errors); List <string> sberr = new List <string>(); foreach (var item in errlist) { sberr.Add(item[0].ErrorMessage); } TempData["ErrorMessage"] = sberr.ToList(); TempData["HSQuotationVal"] = hsquote; } return(RedirectToAction("AddHSQuotation", new { quoteid = hsquote.QuotationID })); }
public ActionResult AddHSQuotation(int?quoteid, int?hsquoteid) { ModelState.Clear(); using (BTCEntities db = new BTCEntities()) { HSQuotation hsQuote = new HSQuotation(); ViewBag.Cities = db.City.ToList(); quotation = db.Quotation.Include(a => a.TravelRequests).Where(x => x.ID == quoteid).FirstOrDefault(); if (TempData["HSQuotationVal"] != null) { hsQuote = (HSQuotation)TempData["HSQuotationVal"]; ViewBag.fileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); ViewBag.ATfileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); } else { var hsquotes = db.HSQuotation.Include(x => x.Quotation).Include(x => x.Quotation.TravelRequests).Where(a => a.QuotationID == quoteid && a.IsDeleted == false)?.ToList(); if (hsquoteid > 0 && hsquotes.Where(a => a.ID == hsquoteid).Count() > 0) { hsQuote = db.HSQuotation.Include(x => x.Quotation).Include(x => x.Quotation.TravelRequests).Where(a => a.QuotationID == quoteid && a.ID == hsquoteid && a.IsDeleted == false).FirstOrDefault(); ViewBag.fileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); ViewBag.HSfileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); } else { if (hsquotes.Where(a => a.IsActive == false).Count() <= 0) { var tempatQuote = db.HSQuotation.Include(x => x.Quotation).Include(x => x.Quotation.TravelRequests).Where(a => a.QuotationID == quoteid).FirstOrDefault(); hsQuote.IsActive = false; hsQuote.IsDeleted = false; hsQuote.IsLowest = false; hsQuote.CheckInDate = tempatQuote.CheckInDate; hsQuote.CheckInTime = tempatQuote.CheckInTime; hsQuote.CheckOutDate = tempatQuote.CheckOutDate; hsQuote.CheckOutTime = tempatQuote.CheckOutTime; hsQuote.HotelCategory = tempatQuote.HotelCategory; hsQuote.QuotationID = tempatQuote.QuotationID; hsQuote.QuotationName = tempatQuote.QuotationName; hsQuote.RoomCategory = tempatQuote.RoomCategory; hsQuote.RoomType = tempatQuote.RoomType; hsQuote.TravelSector = tempatQuote.TravelSector; hsQuote.Quotation = tempatQuote.Quotation; db.HSQuotation.Add(hsQuote); db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); ViewBag.fileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); ViewBag.HSfileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); } else { hsQuote = db.HSQuotation.Include(x => x.Quotation).Include(x => x.Quotation.TravelRequests).Where(a => a.QuotationID == quoteid && a.IsActive == false).FirstOrDefault(); ViewBag.fileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); ViewBag.HSfileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == quotation.TravelRequests.ApplicationNumber + ".HS-Q" + hsQuote.ID).Select(x => x.Attachments).Include(a => a.AttachmentLink).Include(a => a.Users)?.ToList(); } } } pageNo = 2; quotation.HSQuotation.Add(hsQuote); quotation.ATQuotation.Clear(); quotation.PCQuotation.Clear(); CheckErrorMessages(); return(View(hsQuote)); } }
public ActionResult PreviewRFQ(RFQ rfq) { using (BTCEntities db = new BTCEntities()) { if (ModelState.IsValid) { var dbrfq = db.RFQ.Find(rfq.ID); dbrfq.Processing = (int)ProcessingStatus.BeingProcessed; dbrfq.UserID = dbuser.ID; dbrfq.Remarks = rfq.Remarks; dbrfq.IsDeleted = rfq.IsDeleted; db.RFQ.Attach(dbrfq); var entry = db.Entry(dbrfq); entry.State = EntityState.Modified; entry.Property(a => a.Remarks).IsModified = true; entry.Property(a => a.UserID).IsModified = true; entry.Property(a => a.Processing).IsModified = true; entry.Property(a => a.IsDeleted).IsModified = true; db.SaveChanges(); Quotation quote = new Quotation { TravelRequestID = (int)dbrfq.TravelRequestID, IsDeleted = true, RFQID = rfq.ID }; db.Quotation.Add(quote); db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = false; var travelreq = db.TravelRequests.Where(a => a.ID == rfq.TravelRequestID).FirstOrDefault(); ATQuotation ATquote = new ATQuotation() { QuotationID = quote.ID, QuotationName = travelreq.ApplicationNumber + " / AT - Q", City = travelreq.City, City1 = travelreq.City1, DepartureDate = travelreq.DepartureDate, DepartureTime = travelreq.DepartureTime, DestinationID = travelreq.City.ID, OriginID = travelreq.City1.ID, ReturnDate = travelreq.ReturnDate, ReturnTime = travelreq.ReturnTime, TicketClass = travelreq.TicketClass, IsActive = false, IsDeleted = false }; db.ATQuotation.Add(ATquote); HSQuotation HSquote = new HSQuotation() { QuotationID = quote.ID, QuotationName = db.TravelRequests.Where(a => a.ID == rfq.TravelRequestID).FirstOrDefault().ApplicationNumber + " / HS - Q", CheckInDate = travelreq.CheckInDate, CheckInTime = travelreq.CheckInTime, CheckOutDate = travelreq.CheckOutDate, CheckOutTime = travelreq.CheckOutTime, HotelCategory = travelreq.HotelCategory, RoomCategory = travelreq.RoomCategory, RoomType = travelreq.RoomType, IsActive = false, IsDeleted = false }; db.HSQuotation.Add(HSquote); PCQuotation PCquote = new PCQuotation() { QuotationID = quote.ID, QuotationName = db.TravelRequests.Where(a => a.ID == rfq.TravelRequestID).FirstOrDefault().ApplicationNumber + " / PC - Q", DropOffDate = travelreq.DropOffDate, DropoffLocation = travelreq.DropOffLocation, DropOffTime = travelreq.DropOffTime, PickUpDate = travelreq.PickUpDate, PickupLocation = travelreq.PickUpLocation, PickUpTime = travelreq.PickUpTime, PreferredVehicle = travelreq.PreferredVehicle, IsActive = false, IsDeleted = false }; db.PCQuotation.Add(PCquote); db.SaveChanges(); MasterRFQ = dbrfq; return(RedirectToAction("RFQPostMerger", new { id = rfq.TravelRequestID })); } else { var errlist = ModelState.Values.Where(e => e.Errors.Count > 0).Select(a => a.Errors); List <string> sberr = new List <string>(); foreach (var item in errlist) { sberr.Add(item[0].ErrorMessage); } TempData["ErrorMessage"] = sberr.ToList(); } ViewBag.TravelAgency = db.TravelAgency.ToList(); ViewBag.Cities = db.City.ToList(); ViewBag.Currencies = db.Currency.ToList(); ViewBag.ApprovalBy = db.Users.ToList(); RFQ rfqitem = db.RFQ.Include(a => a.TravelRequests).Include(a => a.TravelAgency).Include(a => a.Users).Where(a => a.ID == rfq.ID).FirstOrDefault(); ViewBag.fileUploader = db.AttachmentLink.Where(a => a.AttachmentFor == (rfqitem.RFQName + "Pro" + rfqitem.ProcessingSection + "Trav" + rfqitem.TravelAgencyID)).Select(x => x.Attachments).ToList(); MasterRFQ = rfqitem; using (EmployeeDetailsDBService EmpDBService = new EmployeeDetailsDBService("", rfqitem.TravelRequests.Users1.HREmployeeID.ToString())) { ViewBag.FullEmployeeDetails = EmpDBService.FullEmployeeDetails(); } return(View(rfqitem)); } }