public string FeesPayment(FeesPaymentDetail ObjFeesPaymentDetail) { PayUResponse ObjPayUResponse = null; string TxnUid = null; ObjPayUResponse = new PayUResponse(); string PaymentForMonths = ObjFeesPaymentDetail.feesDetail.Select(x => x.ForMonth.ToString()).Aggregate((a, b) => a + "," + b); TxnUid = this.accountService.TransactionIdExists(ObjFeesPaymentDetail.ExistingClientUid, PaymentForMonths, 1); if (TxnUid != null) { ObjFeesPaymentDetail.TxnUid = TxnUid; ObjFeesPaymentDetail.TxnIdExists = 1; } else { ObjFeesPaymentDetail.TxnIdExists = 0; TxnUid = accountService.Generatetxnid(); if (ObjFeesPaymentDetail != null && ObjFeesPaymentDetail.feesDetail.Count > 0) { StudentParentDetail ObjStudentParentDetail = accountService.GetStudentDetailByUid(ObjFeesPaymentDetail.ExistingClientUid); if (ObjStudentParentDetail != null) { ObjFeesPaymentDetail = accountService.FeesPaymentDataService(ObjFeesPaymentDetail, ObjStudentParentDetail); ObjPayUResponse.txnid = TxnUid; ObjPayUResponse.amount = ObjFeesPaymentDetail.TotalAmount.ToString(); int FineCode = ObjFeesPaymentDetail.feesDetail.FirstOrDefault().FineCode; int FeeCode = ObjFeesPaymentDetail.feesDetail.FirstOrDefault().FeeCode; string PaymentStatus = accountService.InsertPaymentInformation(ObjPayUResponse, PaymentForMonths, ObjStudentParentDetail.AccedemicStartYear, ObjFeesPaymentDetail.ExistingClientUid, ObjFeesPaymentDetail.PayeeCode, FeeCode, FineCode); } else { // unable to get parent detail } } } return(JsonConvert.SerializeObject(ObjFeesPaymentDetail)); }
public FeesPaymentDetail FeesPaymentDataService(FeesPaymentDetail ObjFeesPaymentDetail, StudentParentDetail ObjStudentParentDetail) { Double TotalAmount = 0.0; if (!string.IsNullOrEmpty(ObjFeesPaymentDetail.ExistingClientUid)) { if (ObjStudentParentDetail != null) { Schoolfeedetails ObjSchoolfeedetails = GetFeeDetailByClassDetailUid(ObjStudentParentDetail.ClassDetailUid); if (ObjSchoolfeedetails != null) { foreach (var Fees in ObjFeesPaymentDetail.feesDetail) { if (ObjSchoolfeedetails.IsFeeChanged) { if (Fees.ForMonth == Convert.ToDateTime(ObjSchoolfeedetails.AffectedDate).Month - 1) { TotalAmount += ObjSchoolfeedetails.NewAmount; } else { TotalAmount += ObjSchoolfeedetails.Amount; } } else { TotalAmount += ObjSchoolfeedetails.Amount; } } ObjFeesPaymentDetail.Mobile = ObjStudentParentDetail.FatherMobileno; ObjFeesPaymentDetail.Email = ObjStudentParentDetail.Fatheremailid; ObjFeesPaymentDetail.PersonName = ObjStudentParentDetail.FatherFirstName + " " + ObjStudentParentDetail.FatherLastName; ObjFeesPaymentDetail.TotalAmount = TotalAmount; ObjFeesPaymentDetail.PayeeCode = 1; } } } return(ObjFeesPaymentDetail); }