public override DTO.SearchFormData GetDataWithFilter(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { DTO.SearchFormData searchFormData = new DTO.SearchFormData(); notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; totalRows = 0; try { string productionItemUD = null; string productionItemNM = null; string productionItemNMEN = null; int? companyID = fw_factory.GetCompanyID(userId); if (filters.ContainsKey("productionItemUD") && !string.IsNullOrEmpty(filters["productionItemUD"].ToString())) { productionItemUD = filters["productionItemUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("productionItemNM") && !string.IsNullOrEmpty(filters["productionItemNM"].ToString())) { productionItemNM = filters["productionItemNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("productionItemNMEN") && !string.IsNullOrEmpty(filters["productionItemNMEN"].ToString())) { productionItemNMEN = filters["productionItemNMEN"].ToString().Replace("'", "''"); } using (BreakdownPriceListMngEntities context = CreateContext()) { totalRows = context.BreakdownPriceListMng_function_SearchBreakdownPriceList(orderBy, orderDirection, productionItemUD, productionItemNM, productionItemNMEN).Count(); var result = context.BreakdownPriceListMng_function_SearchBreakdownPriceList(orderBy, orderDirection, productionItemUD, productionItemNM, productionItemNMEN); searchFormData.Data = converter.DB2DTO_Search(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); searchFormData.CompanyID = companyID.Value; //get exchange rate of USD var dbExchangeRate = context.BreakdownPriceListMng_function_GetExchangeRate(DateTime.Now, "USD").FirstOrDefault(); if (dbExchangeRate != null) { searchFormData.ExchangeRate = dbExchangeRate.ExchangeRate; } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(searchFormData); }
public bool Reset(int userId, int id, ref object dtoItem, out Library.DTO.Notification notification) { throw new NotImplementedException(); }
public object CustomFunction(int userId, string identifier, System.Collections.Hashtable input, out Library.DTO.Notification notification) { int id; object data; switch (identifier.ToLower()) { case "getdatadetail": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } return(bll.GetDataDetail(userId, Convert.ToInt32(input["id"]), out notification)); case "getsearchfilter": return(bll.GetSearchFilter(userId, out notification)); case "updateorderstatus": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("statusId")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow status id" }; return(null); } return(bll.UpdateOrderStatus(userId, Convert.ToInt32(input["id"]), Convert.ToInt32(input["statusId"]), out notification)); case "updateproductstatus": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("statusId")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow status id" }; return(null); } return(bll.UpdateProductStatus(userId, Convert.ToInt32(input["id"]), Convert.ToInt32(input["statusId"]), out notification)); case "updateproductstatus2": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("statusId")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow status id" }; return(null); } if (!input.ContainsKey("file")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow file" }; return(null); } return(bll.UpdateProductStatus2(userId, Convert.ToInt32(input["id"]), Convert.ToInt32(input["statusId"]), input["file"].ToString(), out notification)); case "updateprogress": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("data")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow data" }; return(null); } id = Convert.ToInt32(input["id"]); data = input["data"]; if (bll.UpdateProgressData(userId, id, ref data, out notification)) { return(data); } return(null); case "deleteprogress": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } return(bll.DeleteProgress(userId, Convert.ToInt32(input["id"]), out notification)); case "updatetechnicaldrawing": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("data")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow data" }; return(null); } id = Convert.ToInt32(input["id"]); data = input["data"]; if (bll.UpdateTechnicalDrawingData(userId, id, ref data, out notification)) { return(data); } return(null); case "approvetechnicaldrawing": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } return(bll.ApproveTechnicalDrawingData(userId, Convert.ToInt32(input["id"]), out notification)); case "resettechnicaldrawing": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } return(bll.ResetTechnicalDrawingData(userId, Convert.ToInt32(input["id"]), out notification)); case "deletetechnicaldrawing": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } return(bll.DeleteTechnicalDrawing(userId, Convert.ToInt32(input["id"]), out notification)); case "updateremark": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("data")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow data" }; return(null); } id = Convert.ToInt32(input["id"]); data = input["data"]; if (bll.UpdateRemarkData(userId, id, ref data, out notification)) { return(data); } return(null); case "deleteremark": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } return(bll.DeleteRemark(userId, Convert.ToInt32(input["id"]), out notification)); case "updateqaremark": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("data")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow data" }; return(null); } id = Convert.ToInt32(input["id"]); data = input["data"]; if (bll.UpdateQARemarkData(userId, id, ref data, out notification)) { return(data); } return(null); case "deleteqaremark": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } return(bll.DeleteQARemark(userId, Convert.ToInt32(input["id"]), out notification)); case "updateitem": if (!input.ContainsKey("id")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id" }; return(null); } if (!input.ContainsKey("data")) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow data" }; return(null); } id = Convert.ToInt32(input["id"]); data = input["data"]; if (bll.UpdateItemInfo(userId, id, ref data, out notification)) { return(data); } return(null); case "getmodellist": if (!input.ContainsKey("searchQuery") || input["searchQuery"] == null) { notification = new Notification(); notification.Type = NotificationType.Error; notification.Message = "Unknow search query"; return(null); } return(bll.GetModelList(userId, input["searchQuery"].ToString(), out notification)); case "getdetailfactorybreakdown": return(bll.GetDataDetailFactoryBreakdown(userId, Convert.ToInt32(input["sampleProductID"]), out notification)); case "exportexcelsampleorder": string sampleOrderUD = input["sampleOrderUD"] == null ? null : input["sampleOrderUD"].ToString(); string season = input["season"] == null ? null : input["season"].ToString(); string clientUD = input["clientUD"] == null ? null : input["clientUD"].ToString(); string clientNM = input["clientNM"] == null ? null : input["clientNM"].ToString(); int? purposeID = input["purposeID"] == null ? (int?)null : Convert.ToInt32(input["purposeID"].ToString()); int? transportTypeID = input["transportTypeID"] == null ? (int?)null : Convert.ToInt32(input["transportTypeID"].ToString()); int? sampleOrderStatusID = input["sampleOrderStatusID"] == null ? (int?)null : Convert.ToInt32(input["sampleOrderStatusID"].ToString()); string sampleItemCode = input["sampleItemCode"] == null ? null : input["sampleItemCode"].ToString(); string sampleItemName = input["sampleItemName"] == null ? null : input["sampleItemName"].ToString(); int? factoryID = input["sampleItemName"] == null ? (int?)null : Convert.ToInt32(input["factoryID"].ToString()); int? accountManager = input["accountManager"] == null ? (int?)null : Convert.ToInt32(input["accountManager"].ToString()); return(bll.ExportExcelSampleOrder(userId, sampleOrderUD, season, clientUD, clientNM, purposeID, transportTypeID, sampleOrderStatusID, factoryID, sampleItemCode, sampleItemName, accountManager, out notification)); } notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Custom function's identifier not matched" }; return(null); }
public object GetDataWithFilter(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { return(bll.GetDataWithFilter(userId, filters, pageSize, pageIndex, orderBy, orderDirection, out totalRows, out notification)); }
public bool DeleteData(int userId, int id, out Library.DTO.Notification notification) { return(bll.DeleteData(userId, id, out notification)); }
public bool UpdateData(int iRequesterID, int id, ref object dtoItem, out Library.DTO.Notification notification) { return(factory.UpdateData(iRequesterID, id, ref dtoItem, out notification)); }
public override DTO.MaterialColorMng.SearchFormData GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.MaterialColorMng.SearchFormData data = new DTO.MaterialColorMng.SearchFormData(); data.Data = new List <DTO.MaterialColorMng.MaterialColorSearchResult>(); totalRows = 0; string MaterialColorUD = null; string MaterialColorNM = null; if (filters.ContainsKey("MaterialColorUD") && !string.IsNullOrEmpty(filters["MaterialColorUD"].ToString())) { MaterialColorUD = filters["MaterialColorUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("MaterialColorNM") && !string.IsNullOrEmpty(filters["MaterialColorNM"].ToString())) { MaterialColorNM = filters["MaterialColorNM"].ToString().Replace("'", "''"); } //try to get data try { using (MaterialColorMngEntities context = CreateContext()) { totalRows = context.MaterialColorMng_function_SearchMaterialColor(MaterialColorUD, MaterialColorNM, orderBy, orderDirection).Count(); var result = context.MaterialColorMng_function_SearchMaterialColor(MaterialColorUD, MaterialColorNM, orderBy, orderDirection); data.Data = converter.DB2DTO_MaterialColorSearchResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public override bool DeleteData(int id, out Library.DTO.Notification notification) { throw new Exception(); }
public override DTO.ReportData GetData(int id, out Library.DTO.Notification notification) { throw new Exception(); }
public override bool UpdateData(int userId, int id, ref object dtoItem, out Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.PurchaseInvoiceDTO dtoPurchaseInvoice = ((Newtonsoft.Json.Linq.JObject)dtoItem).ToObject <DTO.PurchaseInvoiceDTO>(); try { using (PurchaseInvoiceMngEntities context = CreateContext()) { PurchaseInvoice dbItem = null; if (id == 0) { dbItem = new PurchaseInvoice(); context.PurchaseInvoice.Add(dbItem); } else { dbItem = context.PurchaseInvoice.Where(o => o.PurchaseInvoiceID == id).FirstOrDefault(); } if (dbItem == null) { notification.Message = "data not found!"; return(false); } else { if (!dtoPurchaseInvoice.PurchaseInvoiceTypeID.HasValue) { throw new Exception("Please select type of purchasing invoice"); } //upload file Module.Framework.DAL.DataFactory fwFactory = new Module.Framework.DAL.DataFactory(); string tempFolder = FrameworkSetting.Setting.AbsoluteUserTempFolder + userId.ToString() + @"\"; if (dtoPurchaseInvoice.File_HasChange.HasValue && dtoPurchaseInvoice.File_HasChange.Value) { dtoPurchaseInvoice.AttachedFile = fwFactory.CreateFilePointer(tempFolder, dtoPurchaseInvoice.File_NewFile, dtoPurchaseInvoice.AttachedFile, dtoPurchaseInvoice.FriendlyName); } //convert dto to db converter.DTO2DB_PurchaseInvoice(dtoPurchaseInvoice, ref dbItem, userId); if (id == 0) { dbItem.PurchaseInvoiceStatusID = 1; dbItem.SetStatusBy = userId; dbItem.SetStatusDate = DateTime.Now; } //remove orphan context.PurchaseInvoiceDetail.Local.Where(o => o.PurchaseInvoice == null).ToList().ForEach(o => context.PurchaseInvoiceDetail.Remove(o)); //save data context.SaveChanges(); //generate purchase invoice code if (string.IsNullOrEmpty(dbItem.PurchaseInvoiceUD)) { context.PurchaseInvoiceMng_function_GeneratePurchaseInvoiceUD(dbItem.PurchaseInvoiceID, dbItem.PurchaseInvoiceDate.Value.Year, dbItem.PurchaseInvoiceDate.Value.Month); } //get return data dtoItem = GetData(userId, dbItem.PurchaseInvoiceID, null, out notification).Data; return(true); } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; return(false); } }
public override bool Approve(int userId, int id, ref object dtoItem, out Library.DTO.Notification notification) { throw new Exception(); }
public override SearchFormData GetDataWithFilter(int userId, Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification) { DTO.SearchFormData searchFormData = new DTO.SearchFormData(); notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; totalRows = 0; try { string purchaseInvoiceUD = null; string purchaseInvoiceDate = null; string postingDate = null; int? factoryRawMaterialID = null; int? purchaseInvoiceStatusID = null; int? purchaseInvoiceTypeID = null; string invoiceNo = null; if (filters.ContainsKey("purchaseInvoiceUD") && !string.IsNullOrEmpty(filters["purchaseInvoiceUD"].ToString())) { purchaseInvoiceUD = filters["purchaseInvoiceUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("purchaseInvoiceDate") && !string.IsNullOrEmpty(filters["purchaseInvoiceDate"].ToString())) { purchaseInvoiceDate = filters["purchaseInvoiceDate"].ToString().Replace("'", "''"); } if (filters.ContainsKey("postingDate") && !string.IsNullOrEmpty(filters["postingDate"].ToString())) { postingDate = filters["postingDate"].ToString().Replace("'", "''"); } if (filters.ContainsKey("factoryRawMaterialID") && filters["factoryRawMaterialID"] != null) { factoryRawMaterialID = Convert.ToInt32(filters["factoryRawMaterialID"]); } if (filters.ContainsKey("purchaseInvoiceStatusID") && filters["purchaseInvoiceStatusID"] != null) { purchaseInvoiceStatusID = Convert.ToInt32(filters["purchaseInvoiceStatusID"]); } if (filters.ContainsKey("purchaseInvoiceTypeID") && filters["purchaseInvoiceTypeID"] != null) { purchaseInvoiceTypeID = Convert.ToInt32(filters["purchaseInvoiceTypeID"]); } if (filters.ContainsKey("invoiceNo") && !string.IsNullOrEmpty(filters["invoiceNo"].ToString())) { invoiceNo = filters["invoiceNo"].ToString().Replace("'", "''"); } DateTime?valpurchaseInvoiceDate = purchaseInvoiceDate.ConvertStringToDateTime(); DateTime?valpostingDate = postingDate.ConvertStringToDateTime(); using (PurchaseInvoiceMngEntities context = CreateContext()) { var result1 = context.PurchaseInvoiceMng_function_SearchPurchaseInvoice(purchaseInvoiceUD, valpurchaseInvoiceDate, valpostingDate, factoryRawMaterialID, purchaseInvoiceStatusID, purchaseInvoiceTypeID, invoiceNo, orderBy, orderDirection).ToList(); totalRows = result1.Count(); if (totalRows > 0) { searchFormData.TotalAmountDTO.totalAmountVND = result1.Where(x => x.Currency == "VND").Sum(x => x.Amount); searchFormData.TotalAmountDTO.totalAMountUSD = result1.Where(x => x.Currency == "USD").Sum(x => x.Amount); searchFormData.TotalAmountDTO.totalVATAmount = result1.Sum(x => x.VATAmount); searchFormData.TotalAmountDTO.totalAllAmountVND = searchFormData.TotalAmountDTO.totalVATAmount + searchFormData.TotalAmountDTO.totalAmountVND + (searchFormData.TotalAmountDTO.totalAMountUSD * result1[0].ExchangeRate); } var result = context.PurchaseInvoiceMng_function_SearchPurchaseInvoice(purchaseInvoiceUD, valpurchaseInvoiceDate, valpostingDate, factoryRawMaterialID, purchaseInvoiceStatusID, purchaseInvoiceTypeID, invoiceNo, orderBy, orderDirection); searchFormData.Data = converter.DB2DTO_Search(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); //get support list searchFormData.PurchaseInvoiceStatusDTOs = AutoMapper.Mapper.Map <List <SupportMng_PurchaseInvoiceStatus_View>, List <DTO.PurchaseInvoiceStatusDTO> >(context.SupportMng_PurchaseInvoiceStatus_View.ToList()); searchFormData.PurchaseInvoiceTypeDTOs = AutoMapper.Mapper.Map <List <SupportMng_PurchaseInvoiceType_View>, List <DTO.PurchaseInvoiceTypeDTO> >(context.SupportMng_PurchaseInvoiceType_View.ToList()); searchFormData.FactoryRawMaterialDTOs = AutoMapper.Mapper.Map <List <PurchaseInvoiceMng_GetFactoryRawMaterial_View>, List <DTO.FactoryRawMaterialDTO> >(context.PurchaseInvoiceMng_GetFactoryRawMaterial_View.ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(searchFormData); }
public override bool DeleteData(int userID, int id, out Library.DTO.Notification notification) { throw new NotImplementedException(); }
public override DTO.EditFormData GetData(int userId, int id, Hashtable param, out Library.DTO.Notification notification) { throw new NotImplementedException(); }
public string ClientOffer_Printout(int iRequesterID, int printOptionValue, int id, out Library.DTO.Notification notification) { return(factory.ClientOffer_Printout(id, printOptionValue, out notification)); }
public override DTO.ReportData GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { throw new Exception(); }
public DTO.EditForm GetData(int iRequesterID, int id, out Library.DTO.Notification notification) { return(factory.GetData(id, out notification)); }
public override bool UpdateData(int userId, int id, ref object dtoItem, out Library.DTO.Notification notification) { throw new NotImplementedException(); }
public override bool UpdateData(int id, ref DTO.MaterialColorMng.MaterialColor dtoItem, out Library.DTO.Notification notification) { notification = new Notification(); notification.Type = NotificationType.Success; int number; string indexName; try { using (var context = CreateContext()) { MaterialColor materialColor = null; if (id == 0) { materialColor = new MaterialColor(); context.MaterialColor.Add(materialColor); } else { materialColor = context.MaterialColor.FirstOrDefault(o => o.MaterialColorID == id); } if (materialColor == null) { notification.Message = "Material Color not found!"; return(false); } else { converter.DTO2BD_MaterialColor(dtoItem, ref materialColor); if (id <= 0) { // Generate code. using (var trans = context.Database.BeginTransaction()) { context.Database.ExecuteSqlCommand("SELECT * FROM MaterialColor WITH (TABLOCKX, HOLDLOCK)"); try { var newCode = context.MaterialColorMng_function_GenerateCode().FirstOrDefault(); if (!"***".Equals(newCode)) { materialColor.MaterialColorUD = newCode; context.SaveChanges(); } else { notification.Type = NotificationType.Error; notification.Message = "Auto generated code exceed maximum option: [ZZZ]"; } } catch (Exception ex) { trans.Rollback(); throw ex; } finally { trans.Commit(); } } } else { context.SaveChanges(); } dtoItem = GetData(materialColor.MaterialColorID, out notification).Data; return(true); } } } catch (DataException exData) { notification.Type = NotificationType.Error; ErrorHelper.DataExceptionParser(exData, out number, out indexName); if (number == 2601 && !string.IsNullOrEmpty(indexName)) { if ("MaterialColorUDUnique".Equals(indexName)) { notification.Message = "The Material Color Code is already exists."; } } else { notification.Message = exData.Message; } return(false); } catch (Exception ex) { notification.Type = NotificationType.Error; notification.Message = ex.Message; return(false); } }
public DTO.SearchFormData GetDataWithFilter(int iRequesterID, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { // keep log entry fwBLL.WriteLog(iRequesterID, 0, "get client offer list"); return(factory.GetDataWithFilter(filters, pageSize, pageIndex, orderBy, orderDirection, out totalRows, out notification)); }
public override bool Reset(int id, ref DTO.MaterialColorMng.MaterialColor dtoItem, out Library.DTO.Notification notification) { throw new NotImplementedException(); }
public DTO.ClientConditionItemDTO GetClientConditionItem(int iRequesterID, int id, out Library.DTO.Notification notification) { return(factory.GetClientConditionItem(id, out notification)); }
public object GetData(int userId, int id, out Library.DTO.Notification notification) { return(bll.GetData(userId, id, out notification)); }
public DTO.ClientConditionItemDTO UpdateClientConditionItem(int iRequesterID, int id, ref object dtoItem, out Library.DTO.Notification notification) { return(factory.UpdateClientConditionItem(iRequesterID, id, ref dtoItem, out notification)); }
public bool UpdateData(int userId, int id, ref object dtoItem, out Library.DTO.Notification notification) { return(bll.UpdateData(userId, id, ref dtoItem, out notification)); }
public string GetReportClientOfferOverview(int iRequesterID, string validFrom, string validTo, out Library.DTO.Notification notification) { return(factory.GetReportClientOfferOverview(validFrom, validTo, out notification)); }
public object GetInitData(int userId, out Library.DTO.Notification notification) { throw new NotImplementedException(); }
public bool DeleteClientConditionItem(int iRequesterID, int id, out Library.DTO.Notification notification) { return(factory.DeleteClientConditionItem(id, out notification)); }
public bool UpdateData(int userId, int id, ref object dtoItem, out Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.OutsourcingCostTypeDTO dtoOutSourcingCostType = ((Newtonsoft.Json.Linq.JObject)dtoItem).ToObject <DTO.OutsourcingCostTypeDTO>(); try { ////get companyID //Module.Framework.DAL.DataFactory fw_factory = new Framework.DAL.DataFactory(); //int? companyID = fw_factory.GetCompanyID(userId); using (OutsourcingCostTypeMngEntities context = CreateContext()) { OutsourcingCostType dbItem = null; if (id == 0) { dbItem = new OutsourcingCostType(); context.OutsourcingCostType.Add(dbItem); var listOutsourcingCostType = context.OutsourcingCostTypeMng_OutSourcingCostTypeMng_SearchView.ToList(); foreach (var item in listOutsourcingCostType) { if (dtoOutSourcingCostType.OutsourcingCostTypeUD == item.OutsourcingCostTypeUD) { notification.Message = "This code already exists. Please input another code!!"; notification.Type = Library.DTO.NotificationType.Error; return(false); } } } else { dbItem = context.OutsourcingCostType.Where(o => o.OutsourcingCostTypeID == id).FirstOrDefault(); } if (dbItem == null) { notification.Message = "data not found!"; return(false); } else { // //convert dto to db converter.DTO2DB_OutSourcingCostType(dtoOutSourcingCostType, ref dbItem); //dbItem.CompanyID = companyID; dbItem.UpdatedBy = userId; dbItem.UpdatedDate = DateTime.Now; //save data context.SaveChanges(); //get return data dtoItem = GetData(dbItem.OutsourcingCostTypeID, out notification).Data; 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 bool Reset(int userId, int id, ref object dtoItem, out Library.DTO.Notification notification) { return(bll.Reset(userId, id, ref dtoItem, out notification)); }