public HttpResponseMessage addTarget(dynamic pTarget) { try { using (PRINCE_STGEntities dbCtx = new PRINCE_STGEntities()) { STG_TARGET target = new STG_TARGET(); target.TARGET_DATE = pTarget.TARGET_DATE; target.GEO_LEVEL1_CODE = "99999"; target.GEO_LEVEL2_CODE = "99999"; target.GEO_LEVEL3_CODE = "99999"; target.STORE_CODE = pTarget.STORE_CODE; target.PROD_LEVEL1_CODE = pTarget.PROD_LEVEL1_CODE; target.PROD_LEVEL2_CODE = pTarget.PROD_LEVEL2_CODE; target.PROD_LEVEL3_CODE = "99999"; target.PROD_LEVEL4_CODE = "99999"; target.PROD_LEVEL5_CODE = "99999"; target.PRODUCT_CODE = "99999"; target.TARGET_SALE_QTY = 99999; target.TARGET_SALE_VAL_AT_PRICE = pTarget.TARGET_SALE_VAL_AT_PRICE; target.TARGET_SALE_VAL_AT_COST = 99999; target.ARC_DATE = DateTime.Now; dbCtx.STG_TARGET.Add(target); dbCtx.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created, "Target successfully created.")); } } catch (Exception ex) { Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage updateSite(dynamic pSite) { try { using (var dbCtx = new PRINCE_STGEntities()) { int tempSite = pSite.SiteId; String tempSiteDesc = pSite.Description; Site site = dbCtx.Site.AsNoTracking().Where(wr => wr.SiteId == tempSite).SingleOrDefault(); site.Description = tempSiteDesc; site.Status = pSite.Status; dbCtx.Entry(site).State = System.Data.Entity.EntityState.Modified; dbCtx.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Site " + site.Description.Trim() + " is successfully Updated.")); } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public HttpResponseMessage addFootfall(dynamic pFootfall) { try { using (PRINCE_STGEntities dbCtx = new PRINCE_STGEntities()) { STG_STR_FOOTFALL foot = new STG_STR_FOOTFALL(); foot.FOOTFALL_DATE = pFootfall.FOOTFALL_DATE; foot.STORE_CODE = pFootfall.STORE_CODE; foot.FOOTFALL_COUNT = pFootfall.FOOTFALL_COUNT; foot.ARC_DATE = DateTime.Now; dbCtx.STG_STR_FOOTFALL.Add(foot); dbCtx.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created, "Footfall successfully created.")); } } //catch (DbEntityValidationException ex) //{ // ExceptionEntity exDesc = new ExceptionEntity(ex); // throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; //} //catch (Exception ex) //{ // ExceptionDescription exDesc = new ExceptionDescription(ex); // throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; //} catch (Exception ex) { Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } return(Request.CreateResponse(HttpStatusCode.OK)); }
//public HttpResponseMessage addStoreMerch(dynamic sStoreMerch) //{ // try // { // using (PRINCE_STGEntities dbCtx = new PRINCE_STGEntities()) // { // STG_merch merch = new STG_merch(); // merch.merch_DATE = sStoreMerch.merch_DATE; // merch.GEO_LEVEL1_CODE = "99999"; // merch.GEO_LEVEL2_CODE = "99999"; // merch.GEO_LEVEL3_CODE = "99999"; // merch.STORE_CODE = sStoreMerch.STORE_CODE; // merch.PROD_LEVEL1_CODE = sStoreMerch.PROD_LEVEL1_CODE; // merch.PROD_LEVEL2_CODE = sStoreMerch.PROD_LEVEL2_CODE; // merch.PROD_LEVEL3_CODE = sStoreMerch.PROD_LEVEL3_CODE; // merch.PROD_LEVEL4_CODE = "99999"; // merch.PROD_LEVEL5_CODE = "99999"; // merch.PRODUCT_CODE = "99999"; // merch.merch_VERSION = 99999; // merch.merch_SALE_QTY = 99999; // merch.merch_SALE_VAL_AT_PRICE = sStoreMerch.merch_SALE_VAL_AT_PRICE; // merch.merch_SALE_VAL_AT_COST = 99999; // merch.merch_MARKDOWN_QTY = 0; // merch.merch_MARKDOWN_VAL = 0; // merch.merch_SHRINKAGE_VAL = 0; // merch.merch_PURCHASE_QTY = 0; // merch.merch_PURCHASE_VAL = 0; // merch.merch_INV_OPENING_QTY = 0; // merch.merch_OPENING_VAL_AT_COST = 0; // merch.merch_OPENING_VAL_AT_PRICE = 0; // merch.merch_OTH1 = 99999; // merch.merch_OTH2 = 99999; // merch.merch_OTH3 = 99999; // merch.merch_OTH4 = 99999; // merch.merch_OTH5 = 99999; // merch.ARC_DATE = DateTime.Now; // dbCtx.STG_merch.Add(merch); // dbCtx.SaveChanges(); // return Request.CreateResponse(HttpStatusCode.Created, "merch successfully created."); // } // } // catch (Exception ex) // { // Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); // } // return Request.CreateResponse(HttpStatusCode.OK); //} public HttpResponseMessage updateStoreMerch(dynamic sStoreMerch) { try { using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { using (var dbCtxTran = enBi.Database.BeginTransaction()) { //DateTime merchdate = sStoreMerch.merch_DATE; int id = sStoreMerch.ID; //string storecode = sStoreMerch.STORE_CODE; STG_STR_MERCH_DET merch = enBi.STG_STR_MERCH_DET.Find(id); if (merch != null) { merch.ID = sStoreMerch.ID; merch.STRMRGRP_DATE = sStoreMerch.STRMRGRP_DATE; merch.STORE_CODE = sStoreMerch.STORE_CODE; merch.PROD_LEVEL1_CODE = sStoreMerch.PROD_LEVEL1_CODE; merch.PROD_LEVEL2_CODE = sStoreMerch.PROD_LEVEL2_CODE; merch.PROD_LEVEL3_CODE = sStoreMerch.PROD_LEVEL3_CODE; merch.PROD_LEVEL4_CODE = sStoreMerch.PROD_LEVEL4_CODE; merch.SELLING_AREA = sStoreMerch.SELLING_AREA; merch.TOTAL_AREA = sStoreMerch.TOTAL_AREA; merch.PERMENANT_FTE = sStoreMerch.PERMENANT_FTE; merch.CONTRACT_FTE = sStoreMerch.CONTRACT_FTE; merch.OTH_DET1 = sStoreMerch.OTH_DET1; merch.OTH_DET2 = sStoreMerch.OTH_DET2; merch.OTH_DET3 = sStoreMerch.OTH_DET3; merch.OTH_DET4 = sStoreMerch.OTH_DET4; merch.OTH_DET5 = sStoreMerch.OTH_DET5; merch.ARC_DATE = sStoreMerch.ARC_DATE; enBi.Entry(merch).State = System.Data.Entity.EntityState.Modified; enBi.SaveChanges(); dbCtxTran.Commit(); return(Request.CreateResponse(HttpStatusCode.OK, "Store Merch successfully Updated.")); } } } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } return(Request.CreateResponse(HttpStatusCode.OK, "Storemerch successfully Updated.")); }
public HttpResponseMessage updateTarget(dynamic pTarget) { try { using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { using (var dbCtxTran = enBi.Database.BeginTransaction()) { //DateTime merchdate = sStoreMerch.merch_DATE; int id = pTarget.ID; //string storecode = sStoreMerch.STORE_CODE; STG_TARGET target = enBi.STG_TARGET.Find(id); if (target != null) { target.ID = pTarget.ID; target.TARGET_DATE = pTarget.TARGET_DATE; target.GEO_LEVEL1_CODE = pTarget.GEO_LEVEL1_CODE; target.GEO_LEVEL2_CODE = pTarget.GEO_LEVEL2_CODE; target.GEO_LEVEL3_CODE = pTarget.GEO_LEVEL3_CODE; target.STORE_CODE = pTarget.STORE_CODE; target.PROD_LEVEL1_CODE = pTarget.PROD_LEVEL1_CODE; target.PROD_LEVEL2_CODE = pTarget.PROD_LEVEL2_CODE; target.PROD_LEVEL3_CODE = pTarget.PROD_LEVEL3_CODE; target.PROD_LEVEL4_CODE = pTarget.PROD_LEVEL4_CODE; target.PROD_LEVEL5_CODE = pTarget.PROD_LEVEL5_CODE; target.PRODUCT_CODE = pTarget.PRODUCT_CODE; target.TARGET_SALE_QTY = pTarget.TARGET_SALE_QTY; target.TARGET_SALE_VAL_AT_PRICE = pTarget.TARGET_SALE_VAL_AT_PRICE; target.TARGET_SALE_VAL_AT_COST = pTarget.TARGET_SALE_VAL_AT_COST; target.ARC_DATE = pTarget.ARC_DATE; enBi.Entry(target).State = System.Data.Entity.EntityState.Modified; enBi.SaveChanges(); dbCtxTran.Commit(); return(Request.CreateResponse(HttpStatusCode.OK, "Target successfully Updated.")); } } } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } return(Request.CreateResponse(HttpStatusCode.OK, "Target successfully Updated.")); }
public HttpResponseMessage updateStockAge(dynamic sStockAge) { try { using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { using (var dbCtxTran = enBi.Database.BeginTransaction()) { //DateTime merchdate = sStoreMerch.merch_DATE; int id = sStockAge.ID; string bndDesc = sStockAge.PRICE_BAND_CODE; string lvlCode = sStockAge.PROD_LEVEL1_CODE; //string storecode = sStoreMerch.STORE_CODE; STG_DIM_STOCKAGE_BAND stockage = enBi.STG_DIM_STOCKAGE_BAND.Find(id, bndDesc, lvlCode); if (stockage != null) { stockage.ID = sStockAge.ID; stockage.STOCKAGE_BAND_DESC = sStockAge.PRICE_BAND_DESC; stockage.STKAGE_PROD_LEVEL1_CODE = sStockAge.PROD_LEVEL1_CODE; stockage.STOCKAGE_BAND_LOWER = sStockAge.PRICE_BAND_LOWER; stockage.STOCKAGE_BAND_UPPER = sStockAge.PRICE_BAND_UPPER; stockage.STOCKAGE_BAND_SEQ = sStockAge.STOCKAGE_BAND_SEQ; stockage.LATEST = sStockAge.LATEST; stockage.ARC_DATE = sStockAge.ARC_DATE; enBi.Entry(stockage).State = System.Data.Entity.EntityState.Modified; enBi.SaveChanges(); dbCtxTran.Commit(); return(Request.CreateResponse(HttpStatusCode.OK, "Price Band successfully Updated.")); } } } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } return(Request.CreateResponse(HttpStatusCode.OK, "Price Band successfully Updated.")); }
public HttpResponseMessage updateStore(StoreDc pStore) { try { using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { using (var dbCtxTran = enBi.Database.BeginTransaction()) { TEMP_STORE store = enBi.TEMP_STORE.Where(wr => wr.STORE_CODE == pStore.STORE_CODE).FirstOrDefault(); if (store != null) { store.STORE_DESCRIPTION = pStore.STORE_DESCRIPTION; store.AREA_MANAGER = pStore.AREA_MANAGER; store.AREA_MANAGER_DESC = pStore.AREA_MANAGER_DESC; store.REGIONAL_MANAGER = pStore.REGIONAL_MANAGER; store.REGIONAL_MANAGER_DESC = pStore.REGIONAL_MANAGER_DESC; store.SOM = pStore.SOM; store.SOM_DESC = pStore.SOM_DESC; store.SENIOR_SOM = pStore.SENIOR_SOM; store.SENIOR_SOM_DESC = pStore.SENIOR_SOM_DESC; store.STORE_OPENING_HOUR = pStore.STORE_OPENING_HOUR; store.STORE_CLOSING_HOUR = pStore.STORE_CLOSING_HOUR; store.STORE_LATITUDE = pStore.STORE_LATITUDE; store.STORE_LONGITUDE = pStore.STORE_LONGITUDE; enBi.Entry(store).State = EntityState.Modified; enBi.SaveChanges(); dbCtxTran.Commit(); } } } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage saveUserMenu(List <TempUserMenu> pUser) { try { if (pUser.Count > 0) { int?userId = pUser[0].UserId; using (PRINCE_STGEntities entPrince = new PRINCE_STGEntities()) { List <UserMenu> listUserMenu = (from um in entPrince.UserMenu where um.UserId == userId select um).ToList(); foreach (UserMenu uMenu in listUserMenu) { foreach (TempUserMenu tUmenu in pUser) { if (uMenu.Code == tUmenu.Code) { uMenu.CanAdd = tUmenu.canAdd; uMenu.CanEdit = tUmenu.canEdit; uMenu.CanDelete = tUmenu.canDelete; uMenu.CanView = tUmenu.canView; break; } } entPrince.Entry(uMenu).State = EntityState.Modified; } entPrince.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "User Access Successfully Updated!")); } } return(Request.CreateResponse(HttpStatusCode.NotModified)); } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public HttpResponseMessage updateUser(TempUser pUser) { using (PRINCE_STGEntities entPrince = new PRINCE_STGEntities()) { User user = entPrince.User.Where(wr => wr.Code == pUser.Code).SingleOrDefault(); user.FirstName = pUser.FirstName; user.LastName = pUser.LastName; user.EmailAdd = pUser.EmailAdd; user.Status = pUser.Status; entPrince.Entry(user).State = EntityState.Modified; entPrince.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "User successfully updated!")); } }
public HttpResponseMessage addPlan(dynamic pPlan) { try { using (PRINCE_STGEntities dbCtx = new PRINCE_STGEntities()) { STG_PLAN plan = new STG_PLAN(); plan.PLAN_DATE = pPlan.PLAN_DATE; plan.GEO_LEVEL1_CODE = "99999"; plan.GEO_LEVEL2_CODE = "99999"; plan.GEO_LEVEL3_CODE = "99999"; plan.STORE_CODE = pPlan.STORE_CODE; plan.PROD_LEVEL1_CODE = pPlan.PROD_LEVEL1_CODE; plan.PROD_LEVEL2_CODE = pPlan.PROD_LEVEL2_CODE; plan.PROD_LEVEL3_CODE = pPlan.PROD_LEVEL3_CODE; plan.PROD_LEVEL4_CODE = "99999"; plan.PROD_LEVEL5_CODE = "99999"; plan.PRODUCT_CODE = "99999"; plan.PLAN_VERSION = 99999; plan.PLAN_SALE_QTY = 99999; plan.PLAN_SALE_VAL_AT_PRICE = pPlan.PLAN_SALE_VAL_AT_PRICE; plan.PLAN_SALE_VAL_AT_COST = 99999; plan.PLAN_MARKDOWN_QTY = 0; plan.PLAN_MARKDOWN_VAL = 0; plan.PLAN_SHRINKAGE_VAL = 0; plan.PLAN_PURCHASE_QTY = 0; plan.PLAN_PURCHASE_VAL = 0; plan.PLAN_INV_OPENING_QTY = 0; plan.PLAN_OPENING_VAL_AT_COST = 0; plan.PLAN_OPENING_VAL_AT_PRICE = 0; plan.PLAN_OTH1 = 99999; plan.PLAN_OTH2 = 99999; plan.PLAN_OTH3 = 99999; plan.PLAN_OTH4 = 99999; plan.PLAN_OTH5 = 99999; plan.ARC_DATE = DateTime.Now; dbCtx.STG_PLAN.Add(plan); dbCtx.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created, "Plan successfully created.")); } } catch (Exception ex) { Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage saveUser(TempUser pUser) { using (PRINCE_STGEntities entPrince = new PRINCE_STGEntities()) { int lastIdNo = (from u in entPrince.User.OrderByDescending(p => p.Id) select u.Id).FirstOrDefault(); User user = new User(); user.Code = lastIdNo + 1; user.FirstName = pUser.FirstName; user.LastName = pUser.LastName; user.EmailAdd = pUser.EmailAdd; user.Status = pUser.Status; user.Password = "******"; user.STORE_CODE = pUser.STORE_CODE; entPrince.User.Add(user); entPrince.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "User successfully save!")); } }
public HttpResponseMessage addSite(dynamic pSite) { try { using (PRINCE_STGEntities dbCtx = new PRINCE_STGEntities()) { int tempSite = pSite.SiteId; String tempSiteDesc = pSite.Description; Site site = dbCtx.Site.AsNoTracking().Where(wr => wr.SiteId == tempSite).SingleOrDefault(); if (site != null) { return(Request.CreateResponse(HttpStatusCode.Conflict, "Site Id: " + tempSite.ToString() + " already exist.")); } Site objSite = new Site(); objSite.SiteId = tempSite; objSite.Description = tempSiteDesc.Trim(); objSite.Status = "A"; dbCtx.Site.Add(objSite); dbCtx.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created, "Site " + objSite.Description.Trim() + " is successfully created.")); } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public ActionResult SaveData(List <STG_DIM_STOCKAGE_BAND> stockage) { try { bool status = false; if (ModelState.IsValid) { using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { foreach (var i in stockage) { enBi.STG_DIM_STOCKAGE_BAND.Add(i); } enBi.SaveChanges(); status = true; } } return(new JsonResult { Data = new { status = status } }); } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public HttpResponseMessage updatePlan(dynamic pPlan) { try { using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { using (var dbCtxTran = enBi.Database.BeginTransaction()) { //DateTime plandate = pPlan.PLAN_DATE; int id = pPlan.ID; //string storecode = pPlan.STORE_CODE; STG_PLAN plan = enBi.STG_PLAN.Find(id); if (plan != null) { plan.ID = pPlan.ID; plan.PLAN_DATE = pPlan.PLAN_DATE; plan.GEO_LEVEL1_CODE = pPlan.GEO_LEVEL1_CODE; plan.GEO_LEVEL2_CODE = pPlan.GEO_LEVEL2_CODE; plan.GEO_LEVEL3_CODE = pPlan.GEO_LEVEL3_CODE; plan.STORE_CODE = pPlan.STORE_CODE; plan.PROD_LEVEL1_CODE = pPlan.PROD_LEVEL1_CODE; plan.PROD_LEVEL2_CODE = pPlan.PROD_LEVEL2_CODE; plan.PROD_LEVEL3_CODE = pPlan.PROD_LEVEL3_CODE; plan.PROD_LEVEL4_CODE = pPlan.PROD_LEVEL4_CODE; plan.PROD_LEVEL5_CODE = pPlan.PROD_LEVEL5_CODE; plan.PRODUCT_CODE = pPlan.PRODUCT_CODE; plan.PLAN_VERSION = pPlan.PLAN_VERSION; plan.PLAN_SALE_QTY = pPlan.PLAN_SALE_QTY; plan.PLAN_SALE_VAL_AT_PRICE = pPlan.PLAN_SALE_VAL_AT_PRICE; plan.PLAN_SALE_VAL_AT_COST = pPlan.PLAN_SALE_VAL_AT_COST; plan.PLAN_MARKDOWN_QTY = pPlan.PLAN_MARKDOWN_QTY; plan.PLAN_MARKDOWN_VAL = pPlan.PLAN_MARKDOWN_VAL; plan.PLAN_SHRINKAGE_VAL = pPlan.PLAN_SHRINKAGE_VAL; plan.PLAN_PURCHASE_QTY = pPlan.PLAN_PURCHASE_QTY; plan.PLAN_PURCHASE_VAL = pPlan.PLAN_PURCHASE_VAL; plan.PLAN_INV_OPENING_QTY = pPlan.PLAN_INV_OPENING_QTY; plan.PLAN_OPENING_VAL_AT_COST = pPlan.PLAN_OPENING_VAL_AT_COST; plan.PLAN_OPENING_VAL_AT_PRICE = pPlan.PLAN_OPENING_VAL_AT_PRICE; plan.PLAN_OTH1 = pPlan.PLAN_OTH1; plan.PLAN_OTH2 = pPlan.PLAN_OTH2; plan.PLAN_OTH3 = pPlan.PLAN_OTH3; plan.PLAN_OTH4 = pPlan.PLAN_OTH4; plan.PLAN_OTH5 = pPlan.PLAN_OTH5; plan.ARC_DATE = pPlan.ARC_DATE; enBi.Entry(plan).State = System.Data.Entity.EntityState.Modified; enBi.SaveChanges(); dbCtxTran.Commit(); return(Request.CreateResponse(HttpStatusCode.OK, "Plan successfully Updated.")); } } } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } return(Request.CreateResponse(HttpStatusCode.OK, "Plan successfully Updated.")); }