public object GetSaleOrder(int clientID, int checkSelect, string season, string proformaInvoiceNo, string articleCode, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; List <DTO.SaleOrderDetailDTO> saleOrderDetail = new List <DTO.SaleOrderDetailDTO>(); List <DTO.SaleOrderDetailSparepartDTO> saleOrderDetailSparepart = new List <DTO.SaleOrderDetailSparepartDTO>(); //try to get data try { using (DraftCommercialInvoiceMngEntities context = CreateContext()) { if (checkSelect == 0) { return(converter.DB2DTO_SaleOrderDetail(context.DraftCommerialInvoiceMng_function_SaleOrderDetail(clientID, season, proformaInvoiceNo, articleCode).ToList())); } else { return(converter.DB2DTO_SaleOrderDetailSparepart(context.DraftCommerialInvoiceMng_function_SaleOrderDetailSparepart(clientID, season, proformaInvoiceNo, articleCode).ToList())); } } } 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); } if (checkSelect == 0) { return(saleOrderDetail); } else { return(saleOrderDetailSparepart); } } }
//public bool Delete(int id, out Notification notification) //{ // notification = new Notification { Type = NotificationType.Success }; // try // { // using (var context = CreateContext()) // { // var dbItem = context.OutsourcingCost.Where(o => o.OutsourcingCostID == id).FirstOrDefault(); // context.OutsourcingCost.Remove(dbItem); // context.SaveChanges(); // } // return true; // } // 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 false; // } //} public List <DTO.SupportClient> GetSupportClient(string client, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; List <DTO.SupportClient> data = new List <DTO.SupportClient>(); data = new List <DTO.SupportClient>(); try { using (DraftCommercialInvoiceMngEntities context = CreateContext()) { return(data = converter.DB2DTO_SupportClient(context.DraftCommercialInvoiceMng_function_SearchClient(client).ToList())); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; return(null); } }