public SpotterSummaryViewModel GetSpotterMaster(string spotterRefNum) { glog.Debug("GetSpotterMaster: Entry"); var result = new ResultViewModel(); using (var db = new MainDbContext()) { try { var SpotterSummary = new SpotterSummaryViewModel(); var Summary = db.Spotter_Master.Where(w => w.SpotterRefNumber == spotterRefNum).FirstOrDefault(); if (Summary != null) { SpotterSummary.Amount = Math.Round((decimal)Summary.Amount, 2); SpotterSummary.PreparationDate = Summary.PreparationDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture); SpotterSummary.SpotterID = Summary.SpotterID; SpotterSummary.Status = Summary.Status; SpotterSummary.CreatedBy = Summary.CreatedBy; SpotterSummary.CreatedDate = Summary.CreatedDate.ToString(); } return(SpotterSummary); } catch (Exception ex) { glog.Error("GetSpotterMaster Exception: " + ex.Message + ex.InnerException); result.Status = 0; result.Message = "Please contact MIS, error: " + ex.Message; return(new SpotterSummaryViewModel()); } } }
public ApprovalSpotterDetails GetApprovalSpotterDetails(string SpotterRefNo, string strStatus) { ApprovalSpotterDetails obj = new ApprovalSpotterDetails(); using (var db = new MainDbContext()) { try { glog.Debug("GetApprovalSpotterDetails: Entry"); var SpotterSummary = new SpotterSummaryViewModel(); var Summary = db.Spotter_Master.Where(w => w.SpotterRefNumber == SpotterRefNo).FirstOrDefault(); var Reason = db.Spotter_Detail.Where(w => w.SpotterId == Summary.SpotterID).FirstOrDefault().RejectionReason; if (Summary != null) { obj.SpotterSummary.SpotterRefNumber = Summary.SpotterRefNumber; obj.SpotterSummary.Amount = Math.Round((decimal)Summary.Amount, 2); obj.SpotterSummary.ApprovedAmount = Math.Round((decimal)Summary.ApprovedAmount, 2); obj.SpotterSummary.PreparationDate = Summary.PreparationDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture); obj.SpotterSummary.SpotterID = Summary.SpotterID; obj.SpotterSummary.Status = Summary.Status; obj.SpotterSummary.CreatedBy = Summary.CreatedBy; obj.SpotterSummary.CreatedDate = Summary.CreatedDate.ToString(); obj.SpotterSummary.RejectReason = Reason; } var outstandingSpotterFee = new List <OutstandingSpotterFeeViewModel>(); outstandingSpotterFee = _clsPayment.RetrieveSpotterFeeByRefNumber(SpotterRefNo, strStatus); obj.OutstandingFee = outstandingSpotterFee; } catch (Exception ex) { var result = new ResultViewModel(); glog.Error("GetApprovalSpotterDetails Exception: " + ex.Message); result.Status = 0; result.Message = "Please contact MIS, error: " + ex.Message; glog.Debug("GetApprovalSpotterDetails: Exit"); } } glog.Debug("GetApprovalSpotterDetails: Exit"); return(obj); }