public T_OutStandingDetails GetOutStandingOutStandingDetail(T_OutStanding ObjOutStanding) { var ObjList = new T_OutStandingDetails(); try { using (_objUnitOfWork = new UnitOfWork()) { var queryOutStanding = _objUnitOfWork._T_OutStanding_Repository.Query(); var queryOutStandingDetail = _objUnitOfWork._T_OutStandingDetails_Repository.Query(); var vOutStanding = queryOutStanding.Where(x => x.Id == ObjOutStanding.Id).FirstOrDefault(); var vOutStandingDetail = queryOutStandingDetail.Where(x => x.OSId == ObjOutStanding.Id).ToList(); if (vOutStanding != null) { ObjList = vOutStandingDetail.ToList().Select(x => new T_OutStandingDetails() { OutStandingAmount = (vOutStanding.Amount - vOutStandingDetail.Sum(y => y.PaidAmount)), }).FirstOrDefault(); } } } catch (Exception ex) { throw ex; } return(ObjList); }
public JsonResult GetOutStandingOutStandingDetail(T_OutStanding ObjOutStanding) { var ObjList = new T_OutStandingDetails(); try { if (_blOutStanding.GetOutStandingDetailList(ObjOutStanding).Count > 0) { ObjList = _blOutStanding.GetOutStandingOutStandingDetail(ObjOutStanding); } else { var t_OutStanding = _blOutStanding.GetById(ObjOutStanding.Id); if (t_OutStanding != null) { ObjList.TotalOutStandingAmount = t_OutStanding.Amount; ObjList.OutStandingAmount = t_OutStanding.Amount; } } } catch (Exception ex) { throw ex; } return(Json(new { ObjList, Message = "Sucess" }, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateOutStandingDetails(T_OutStandingDetails ObjModel) { try { if (!string.IsNullOrWhiteSpace(Convert.ToString(ObjModel.Id))) { var vObjExists = _blOutStanding.GetByIdOutStandingDetail(ObjModel.Id); if (vObjExists == null) { Guid guidId = Guid.NewGuid(); Guid guidOSId = Guid.Parse(Convert.ToString(ObjModel.OSId)); T_OutStandingDetails _Obj_T_OutStanding = new T_OutStandingDetails() { Id = guidId, OSId = guidOSId, EventDate = Convert.ToDateTime(ObjModel.EventDate), SlNo = ObjModel.SlNo, OutStandingAmount = ObjModel.OutStandingAmount, PaidAmount = ObjModel.PaidAmount, DueAmount = ObjModel.DueAmount, Remark = ObjModel.Remark, CreatedBy = _objAuthentication.UserName, CreatedDate = DateTime.Now }; _blOutStanding.CreateOutStandingDetail(_Obj_T_OutStanding); return(Json(new { data = ObjModel, Success = true }, JsonRequestBehavior.AllowGet)); } else { vObjExists.OutStandingAmount = ObjModel.OutStandingAmount; vObjExists.PaidAmount = ObjModel.PaidAmount; vObjExists.DueAmount = ObjModel.DueAmount; vObjExists.Remark = ObjModel.Remark; vObjExists.ModifyBy = _objAuthentication.UserName; vObjExists.ModifyDate = DateTime.Now; _blOutStanding.UpdateOutStandingDetail(vObjExists); return(Json(new { data = ObjModel, Success = true }, JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { throw ex; } return(Json(new { data = ObjModel, Success = false }, JsonRequestBehavior.AllowGet)); }
public T_OutStandingDetails DeleteOutStandingDetail(T_OutStandingDetails ObjModel) { try { using (_objUnitOfWork = new UnitOfWork()) { _objUnitOfWork._T_OutStandingDetails_Repository.Delete(ObjModel.Id); _objUnitOfWork.Save(); } } catch (Exception ex) { throw ex; } return(ObjModel); }
public T_OutStandingDetails GetByIdOutStandingDetail(Guid UserId) { var ObjOutStanding = new T_OutStandingDetails(); try { using (_objUnitOfWork = new UnitOfWork()) { ObjOutStanding = _objUnitOfWork._T_OutStandingDetails_Repository.GetById(UserId); } } catch (Exception ex) { throw ex; } return(ObjOutStanding); }
public ActionResult DeleteOutStandingDetails(T_OutStandingDetails ObjModel) { try { if (!string.IsNullOrWhiteSpace(Convert.ToString(ObjModel.Id))) { var vObj = _blOutStanding.GetByIdOutStandingDetail(ObjModel.Id); if (vObj != null) { _blOutStanding.DeleteOutStandingDetail(ObjModel); } } } catch (Exception ex) { throw ex; } return(Json(ObjModel)); }