public JsonResult SaveAWBAllocation(List <CostUpdateConsignmentVM> list) { List <CostUpdateConsignmentVM> AWBAllocationall = new List <CostUpdateConsignmentVM>(); List <CostUpdateConsignmentVM> AWBAllocation = new List <CostUpdateConsignmentVM>(); AWBAllocationall = (List <CostUpdateConsignmentVM>)Session["CostAWBAllocation"]; if (AWBAllocationall == null) { AWBAllocationall = new List <CostUpdateConsignmentVM>(); foreach (var item2 in list) { AWBAllocationall.Add(item2); } } else { int acheadid = Convert.ToInt32(list[0].RevenueCostMasterID); AWBAllocationall.RemoveAll(cc => cc.RevenueCostMasterID == acheadid); foreach (var item2 in list) { AWBAllocationall.Add(item2); } } Session["CostAWBAllocation"] = AWBAllocationall; return(Json(AWBAllocationall, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveAWBAllocation(List <SupplierInvoiceConsignmentVM> list) { List <SupplierInvoiceConsignmentVM> AWBAllocationall = new List <SupplierInvoiceConsignmentVM>(); List <SupplierInvoiceConsignmentVM> AWBAllocation = new List <SupplierInvoiceConsignmentVM>(); AWBAllocationall = (List <SupplierInvoiceConsignmentVM>)Session["SIAWBAllocation"]; if (AWBAllocationall == null) { AWBAllocationall = new List <SupplierInvoiceConsignmentVM>(); foreach (var item2 in list) { AWBAllocationall.Add(item2); } } else { int acheadid = list[0].AcHeadId; AWBAllocationall.RemoveAll(cc => cc.AcHeadId == acheadid); foreach (var item2 in list) { AWBAllocationall.Add(item2); } } Session["SIAWBAllocation"] = AWBAllocationall; return(Json(AWBAllocationall, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAWBAllocation(int Id, int tripno, decimal amount) { decimal consignmentamount = 0; List <CostUpdateConsignmentVM> AWBAllocationall = new List <CostUpdateConsignmentVM>(); List <CostUpdateConsignmentVM> AWBAllocation = new List <CostUpdateConsignmentVM>(); AWBAllocationall = (List <CostUpdateConsignmentVM>)Session["CostAWBAllocation"]; if (AWBAllocationall == null) { AWBAllocationall = new List <CostUpdateConsignmentVM>(); var list = (from c in db.InScanMasters where c.IsDeleted == false && (c.TruckDetailId == tripno || tripno == 0) orderby c.ConsignmentNo select new { InScanID = c.InScanID, TransactionDate = c.TransactionDate, ConsignmentNo = c.ConsignmentNo, TruckDetailID = c.TruckDetailId }).ToList(); if (list != null) { consignmentamount = amount / list.Count; foreach (var item2 in list) { CostUpdateConsignmentVM obj = new CostUpdateConsignmentVM(); obj.RevenueCostMasterID = Id; obj.ConsignmentNo = item2.ConsignmentNo; obj.InScanID = item2.InScanID; obj.Amount = consignmentamount; AWBAllocationall.Add(obj); } } Session["CostAWBAllocation"] = AWBAllocationall; return(Json(AWBAllocationall, JsonRequestBehavior.AllowGet)); } else { AWBAllocation = AWBAllocationall.Where(cc => cc.RevenueCostMasterID == Id).ToList(); } if (AWBAllocation == null || AWBAllocation.Count == 0) { AWBAllocation = new List <CostUpdateConsignmentVM>(); var list = (from c in db.InScanMasters where c.IsDeleted == false && (c.TruckDetailId == tripno) orderby c.ConsignmentNo select new { InScanID = c.InScanID, TransactionDate = c.TransactionDate, ConsignmentNo = c.ConsignmentNo, TruckDetailID = c.TruckDetailId }).ToList(); consignmentamount = amount / list.Count; foreach (var item2 in list) { CostUpdateConsignmentVM obj = new CostUpdateConsignmentVM(); obj.RevenueCostMasterID = Id; obj.ConsignmentNo = item2.ConsignmentNo; obj.InScanID = item2.InScanID; obj.Amount = consignmentamount; AWBAllocationall.Add(obj); } Session["CostAWBAllocation"] = AWBAllocationall; AWBAllocation = AWBAllocationall.Where(cc => cc.RevenueCostMasterID == Id).ToList(); } return(Json(AWBAllocation, JsonRequestBehavior.AllowGet)); }