public ActionResult EnquiryStatus(EnquiryStatus model) { if (!ModelState.IsValid) { FillEnquiryStatus(); var allErrors = ModelState.Values.SelectMany(v => v.Errors); return(View(model)); } var repo = new EnquiryBookingRepository(); { var result = new EnquiryBookingRepository().UpdateEnquiryStatus(model); if (result.EnquiryId > 0) { TempData["Success"] = "Updated Successfully!"; ////TempData["EnquiryRef"] = result.EnquiryRef; return(RedirectToAction("PendingEnquiryStatus")); //return RedirectToAction("Projects", "EnquiryBooking"); } else { return(RedirectToAction("Edit")); } } }
public EnquiryStatusOptionsView(EnquiryStatus status) { InitializeComponent(); DataContext = _viewModel = new EnquiryStatusesViewModel(status); Loaded += OnEnquiryStatusViewLoaded; }
public ActionResult EnquiryStatus(int?EnquiryId) { FillEnquiryStatus(); EnquiryBookingRepository repo = new EnquiryBookingRepository(); EnquiryStatus model = repo.GetEnquiryStatusDetails(EnquiryId ?? 0); return(View(model)); }
public EnquiryStatusesViewModel(EnquiryStatus status) { var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve <IDataUnitLocator>(); _adminDataUnit = dataUnitLocator.ResolveDataUnit <IAdminDataUnit>(); EnquiryStatus = status; IsEditable = status.Status != "Booked"; SaveChangesCommand = new RelayCommand(SaveChangesCommandExecuted, SaveChangesCommandCanExecute); EnquiryStatus.PropertyChanged += EnquiryStatus_PropertyChanged; }
public bool Delete(int id) { EnquiryStatus status = FindById(id); if (status == null) { return(false); } db.EnquiryStatus.Remove(status); db.SaveChanges(); return(true); }
public void Save(EnquiryStatus enquiryStatus) { if (enquiryStatus.Id == 0) { db.EnquiryStatus.Add(enquiryStatus); } else { db.Entry(enquiryStatus).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); }
public EnquiryStatus GetEnquiryStatusDetails(int EnquiryId) { using (IDbConnection connection = OpenConnection(dataConnection)) { string qry = "select EnquiryId, EnquiryRef, convert (varchar(50), EnquiryDate, 103)EnquiryDate,EnquiryClient,"; qry += " ModeofContactName,ClientTypeName,ProjectTypeName,EnquiryReference,EnquiryContactNo,"; qry += " EnquiryEmail,EnquiryLocation,EnquiryDetails,EnquiryStatus EnquiryStatusUpdate"; qry += " from EnquiryBooking HD"; qry += " inner join ClientType CT on CT.ClientTypeId = HD.ClientTypeId"; qry += " inner join ModeOfContact MOC on MOC.ModeofContactId = HD.ModeofContactId"; qry += " inner join ProjectType PT on PT.ProjectTypeId = HD.ProjectTypeId"; qry += " where HD.EnquiryId = " + EnquiryId.ToString(); EnquiryStatus EnquiryStatus = connection.Query <EnquiryStatus>(qry).FirstOrDefault(); return(EnquiryStatus); } }
//public EnquiryStatus UpdateEnquiryStatus(EnquiryStatus model) // { // using (IDbConnection connection = OpenConnection(dataConnection)) // { // string sql = @"UPDATE EnquiryBooking SET EnquiryProfileSending = @EnquiryProfileSending ,EnquiryOfferSending = @EnquiryOfferSending, // EnquiryLayoutReceiving = @EnquiryLayoutReceiving // OUTPUT INSERTED.EnquiryId WHERE EnquiryId = EnquiryId"; // try // { // var id = connection.Execute(sql, model); // model.EnquiryId = id; // } // catch (Exception ex) // { // model.EnquiryId = 0; // } // return model; // } // } public EnquiryStatus UpdateEnquiryStatus(EnquiryStatus model) { using (IDbConnection connection = OpenConnection(dataConnection)) { string sql = @"UPDATE EnquiryBooking SET EnquiryStatus = @EnquiryStatusUpdate OUTPUT INSERTED.EnquiryId WHERE EnquiryId = @EnquiryId"; try { var id = connection.Execute(sql, model); model.EnquiryId = id; } catch (Exception ex) { model.EnquiryId = 0; } return(model); } }