public JsonResult _GetTotal(string id) { int scaleID = int.Parse(id); decimal gw = 0; decimal nw = 0; decimal amt = 0; if (scaleID > 0) { IEnumerable <ScaleDetails> sDetails = new ScaleDetailsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString()).GetAllByParentID(scaleID); gw = sDetails.Sum(i => i.GrossWeight); nw = sDetails.Sum(i => i.NetWeight); amt = sDetails.Sum(i => i.Amount); } else { gw = TempEntityList.Sum(i => i.GrossWeight); nw = TempEntityList.Sum(i => i.NetWeight); amt = TempEntityList.Sum(i => i.Amount); } var data = new { GW = gw, NW = nw, Amt = amt }; return(Json(data, JsonRequestBehavior.AllowGet)); //string str = string.Format("{0}#{1}#{2}", gw, nw, amt); //return str; }
public string _GetTotalAppliedAmount(string id) { decimal totalApplyAmt = 0; int parentId = Convert.ToInt32(id); if (parentId > 0) { PaymentReceiptDetailsLibrary lib = new PaymentReceiptDetailsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString()); IEnumerable <PaymentReceiptDetails> resultList = lib.GetAllByParentID(parentId); totalApplyAmt = resultList.Sum(s => s.Apply_Amount); return(totalApplyAmt.ToString()); } if (Session["PaymentDetails"] != null && ((IList <PaymentReceiptDetails>)Session["PaymentDetails"]).Count > 0) { totalApplyAmt = TempEntityList.Sum(s => s.Apply_Amount); } return(totalApplyAmt.ToString()); }