public override DTO.ShowroomReceiptMng.EditFormData GetData(int id, out Library.DTO.Notification notification) { DTO.ShowroomReceiptMng.EditFormData editFormData = new DTO.ShowroomReceiptMng.EditFormData(); notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; try { using (ShowroomReceiptMngEntities context = CreateContext()) { if (id > 0) { ShowroomReceiptMng_ShowroomReceipt_View dbItem; dbItem = context.ShowroomReceiptMng_ShowroomReceipt_View .Include("ShowroomReceiptMng_ShowroomReceiptDetail_View") .FirstOrDefault(o => o.ShowroomReceiptID == id); editFormData.Data = converter.DB2DTO_ShowroomReceipt(dbItem); } else { editFormData.Data = new DTO.ShowroomReceiptMng.ShowroomReceipt(); editFormData.Data.ShowroomReceiptDetails = new List <DTO.ShowroomReceiptMng.ShowroomReceiptDetail>(); editFormData.Data.Season = DALBase.Helper.GetCurrentSeason(); editFormData.Data.ReceiptDate = DateTime.Now.ToString("dd/MM/yyyy");; } //get support list DAL.Support.DataFactory support_factory = new Support.DataFactory(); editFormData.Users = support_factory.GetUser().ToList(); editFormData.Showrooms = support_factory.GetShowroom(); editFormData.Seasons = support_factory.GetSeason().ToList(); return(editFormData); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(editFormData); } }