private List <Models.ClaimModel> GetPendingClaim(int employeeId) { List <Models.ClaimModel> model = new List <Models.ClaimModel>(); DataTable dtPendingClaim = new Business.ClaimManagement.ClaimApplication().ClaimApplication_GetAll( new Entity.ClaimManagement.ClaimApplicationMaster() { EmployeeId = employeeId, Status = (int)ClaimStatusEnum.Pending } ); if (dtPendingClaim != null && dtPendingClaim.AsEnumerable().Any()) { foreach (DataRow dr in dtPendingClaim.Rows) { model.Add(new Models.ClaimModel { ClaimNo = string.Format("Claim No: {0}", dr["ClaimNo"].ToString()), ClaimHeading = string.Format("Claim Header: {0}", dr["ClaimHeading"].ToString()), ClaimDateTime = string.Format("Claim Date: {0}", dr["ClaimDateTime"].ToString()), PeriodFrom = string.Format("Period From: {0}", dr["PeriodFrom"].ToString()), PeriodTo = string.Format("Period To: {0}", dr["PeriodTo"].ToString()), StatusName = string.Format("Claim Status: {0}", dr["StatusName"].ToString()), TotalAmount = string.Format("Claim Amount: {0}", dr["TotalAmount"].ToString()) }); } } return(model); }
private string PrepareVoucherJson() { string employeeName = string.Empty; List <VoucherDescription> voucherDescriptionList = new List <VoucherDescription>(); foreach (GridViewRow gvr in gvApprovedClaim.Rows) { CheckBox chkSelect = (CheckBox)gvr.FindControl("chkitem"); if (chkSelect.Checked) { Business.ClaimManagement.ClaimApplication objClaimApplication = new Business.ClaimManagement.ClaimApplication(); DataSet dsClaim = objClaimApplication.GetClaimApplicationDetails_ByClaimApplicationId(Convert.ToInt32(gvApprovedClaim.DataKeys[gvr.RowIndex].Values[0].ToString())); if (dsClaim != null && dsClaim.Tables.Count > 0 && dsClaim.Tables[0] != null && dsClaim.Tables[0].Rows.Count > 0) { employeeName = dsClaim.Tables[0].Rows[0]["Requestor"].ToString(); string claimCategories = string.Empty; DataTable dtClaimDetails = new Business.ClaimManagement.ClaimApplication().ClaimApplicationDetails_GetAll(new ClaimApplicationDetails() { ClaimApplicationId = Convert.ToInt32(dsClaim.Tables[0].Rows[0]["ClaimId"].ToString()) }); if (dtClaimDetails != null && dtClaimDetails.AsEnumerable().Any()) { foreach (DataRow drClaimDetail in dtClaimDetails.Rows) { DataTable dtClaimCategory = new Business.ClaimManagement.ClaimCategory().ClaimCategory_GetById(Convert.ToInt32(drClaimDetail["CategoryId"].ToString())); if (dtClaimCategory != null && dtClaimCategory.AsEnumerable().Any()) { claimCategories = claimCategories + dtClaimCategory.Rows[0]["CategoryName"].ToString() + ","; } } } VoucherDescription voucherPaymentDetails = new VoucherDescription() { Amount = Convert.ToDecimal(dsClaim.Tables[0].Rows[0]["ApprovedAmount"].ToString()), Description = string.Format("{0}-{1}-{2}", dsClaim.Tables[0].Rows[0]["ClaimNo"].ToString(), dsClaim.Tables[0].Rows[0]["ClaimHeading"].ToString(), claimCategories.Trim(',')) }; voucherDescriptionList.Add(voucherPaymentDetails); } } } string chequeNo = string.Empty, payMethod = string.Empty; foreach (DataRow dr in _ClaimPaymentDetails.Rows) { chequeNo += dr["PaymentDetails"] + ","; payMethod += dr["PaymentModeName"] + ","; } VoucherJson voucherJson = new VoucherJson() { AmountInWords = "", ChequeNo = chequeNo.TrimEnd(','), CreateDate = DateTime.UtcNow.AddHours(5).AddMinutes(33), EmployeeName = employeeName, PayMethod = payMethod.TrimEnd(','), TotalAmount = Convert.ToDecimal(lblTotalAmountPaying.Text), VoucherDescriptionList = voucherDescriptionList }; return(JsonConvert.SerializeObject(voucherJson)); }