public TaskDTO(getAllTasks_Result t) { this.TaskID = t.TaskID; this.TaskTypeId = t.TaskTypeId; this.Description = t.Description; this.PropertyID = t.PropertyID; this.SubPropertyID = t.SubPropertyID; this.ClassificationID = t.ClassificationID; this.ClientClassificationID = t.ClientClassificationID; this.ReportDate = t.ReportDate; this.DateForHandling = t.DateForHandling; this.IsHandled = t.IsHandled; this.HandlingDate = t.HandlingDate; this.HandlingWay = t.HandlingWay; status = t.status; }
public static bool UpdateRental(RentalDTO rd) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { Rental r = db.Rentals.Find(rd.RentalID); r.PropertyID = rd.PropertyID; r.SubPropertyID = rd.SubPropertyID; r.UserID = rd.UserID; r.RentPayment = rd.RentPayment; r.PaymentTypeID = rd.PaymentTypeID; r.EnteryDate = rd.EnteryDate; r.EndDate = rd.EndDate; if (r.ContactRenew != rd.ContactRenew) { if (rd.ContactRenew == true && rd.EndDate.Value < DateTime.Today.AddMonths(3)) { Bl.TaskBL.AddRenewTask(rd.PropertyID, rd.SubPropertyID); } else { getAllTasks_Result task = db.getAllTasks().Where(t => t.PropertyID == rd.PropertyID && t.TaskTypeId == 2 && t.status == true && t.SubPropertyID == rd.SubPropertyID).FirstOrDefault(); if (task != null) { Bl.TaskBL.DeleteTask(task.TaskID); } } } r.ContactRenew = rd.ContactRenew; if (rd.Dock != null) { Document doc = new Document(); doc.DocCoding = rd.Dock; doc.DocUser = rd.RentalID; doc.type = 3; doc.DocName = rd.DocName; DocumentBL.AddUserDocuments(new DocumentDTO(doc)); } db.SaveChanges(); return(true); } return(false); }