public override DTO.BackSaleOrderMng.EditFormData GetData(int id, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Success, Message = "Get success" }; try { using (BackSaleOrderMngEntities context = CreateContext()) { DTO.BackSaleOrderMng.EditFormData data = new DTO.BackSaleOrderMng.EditFormData(); if (id > 0) { data.Data = converter.DB2DTO_BackOrder(context.BackSaleOrderMng_BackOrder_View.Include("BackSaleOrderMng_BackOrderDetail_View").Where(o => o.BackOrderID == id).FirstOrDefault()); } else { data.Data = new DTO.BackSaleOrderMng.BackOrder(); } DAL.Support.DataFactory support_factory = new Support.DataFactory(); data.Seasons = support_factory.GetSeason().ToList(); data.Salers = support_factory.GetSaler().ToList(); data.PaymentTerms = support_factory.GetPaymentTerm().ToList(); data.DeliveryTerms = support_factory.GetDeliveryTerm().ToList(); data.VATPercent = support_factory.GetVATPercent(); data.Currency = support_factory.GetCurrency().ToList(); data.SaleOrderTypes = support_factory.GetSaleOrderType(); return(data); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(new DTO.BackSaleOrderMng.EditFormData()); } }