public ActionResult UpdateCustom(string key, List <spView_WebTemplate_OI_GetAll_Custom1_Result> changed, List <spView_WebTemplate_OI_GetAll_Custom1_Result> added, List <spView_WebTemplate_OI_GetAll_Custom1_Result> deleted) { var order_no = TempData.Peek("OrderNumber").ToString(); OrderOISTIModels obj = new OrderOISTIModels(); ////Performing update operation if (added != null && added.Count() > 0) { foreach (var temp in added) { obj.OrderNumber = order_no; obj.ProductCode = System.Convert.ToInt32(temp.product_code); obj.QuantityRequired = temp.QuantityRequired; obj.Notes = temp.Notes; obj.Quantity_Allocated = temp.QuantityRequired; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; obj.ProductCode = System.Convert.ToInt32(temp.product_code); obj.QuantityRequired = temp.QuantityRequired; obj.Notes = temp.Notes; obj.Quantity_Allocated = temp.QuantityRequired; obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Update(string key, List <spView_WebTemplate_OI_STIGetAll_Result> changed, List <spView_WebTemplate_OI_STIGetAll_Result> added, List <spView_WebTemplate_OI_STIGetAll_Result> deleted) { Formulas formulas = new Formulas(); var order_no = TempData.Peek("OrderNumber").ToString(); OrderOISTIModels obj = new OrderOISTIModels(); ////Performing update operation if (changed != null && changed.Count() > 0) { foreach (var temp in changed) { obj.OrderNumber = order_no; //obj.StartDate = System.Convert.ToDateTime(temp.StartDate); //obj.EndDate = System.Convert.ToDateTime(temp.EndDate); //obj.FacilityCode = System.Convert.ToInt32(temp.FacilityCode); obj.ProductCode = System.Convert.ToInt32(temp.ProductCode); obj.PhysicalCountAtBeginningOfReviewPeriod = temp.PhysicalCountAtBeginningOfReviewPeriod; obj.QuantityReceivedDuringTheTwoMonthsCycle = temp.QuantityReceivedDuringTheTwoMonthsCycle; obj.QuantityUsedDuringTwoMonths = temp.QuantityUsedDuringTwoMonths; obj.NumberOfDaysOutOfStock = temp.NumberOfDaysOutOfStock; obj.ThisMonthPhysicalCount = temp.ThisMonthPhysicalCount; obj.LossesAndAdjustments = temp.LossesAndAdjustments; obj.AMC = ((temp.QuantityUsedDuringTwoMonths * 30) / (60 - temp.NumberOfDaysOutOfStock)); obj.MonthsOfStock = ((temp.ThisMonthPhysicalCount) / (temp.AMC)); obj.QuantityRequired = Convert.ToDouble(formulas.Allocated((4 * (temp.AMC) - (temp.ThisMonthPhysicalCount)))); obj.MaximumStockQuantity = (2 * temp.QuantityUsedDuringTwoMonths); obj.Notes = temp.Notes; obj.Quantity_Allocated = Convert.ToDouble(formulas.Allocated((temp.QuantityRequired))); obj.RFSONotes = temp.RFSONotes; obj.Update(); } } //Performing delete operation //if (deleted != null && deleted.Count() > 0) //{ // foreach (var temp in deleted) // { // db.core_householdmember.Remove(db.core_householdmember.FirstOrDefault(o => o.id == temp.id)); // } //} //db.SaveChanges(); //var data = 0; return Json(data, JsonRequestBehavior.AllowGet); var data = 0; return(Json(data, JsonRequestBehavior.AllowGet)); }