public static int ClaimApprovalDetails_Save(Entity.ClaimManagement.ClaimApprovalDetails ClaimApprovalDetails) { int retValue = 0; using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString())) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_HR_ClaimApprovalDetails_Save"; cmd.Parameters.AddWithValue("@ClaimApprovalDetailId", ClaimApprovalDetails.ClaimApprovalDetailId); cmd.Parameters.AddWithValue("@ClaimApplicationId", ClaimApprovalDetails.ClaimApplicationId); cmd.Parameters.AddWithValue("@ApproverId", ClaimApprovalDetails.ApproverId); cmd.Parameters.AddWithValue("@Status", ClaimApprovalDetails.Status); cmd.Parameters.AddWithValue("@Remarks", ClaimApprovalDetails.Remarks); if (con.State == ConnectionState.Closed) { con.Open(); } retValue = cmd.ExecuteNonQuery(); con.Close(); } } return(retValue); }
protected void btnCancel_Click(object sender, EventArgs e) { try { if (ClaimApprovalValidation()) { Entity.ClaimManagement.ClaimApprovalDetails claimApprovalDetails = new Entity.ClaimManagement.ClaimApprovalDetails(); claimApprovalDetails.ApproverId = Convert.ToInt32(HttpContext.Current.User.Identity.Name); claimApprovalDetails.ClaimApplicationId = Business.Common.Context.ClaimApplicationId; claimApprovalDetails.Status = (int)ClaimStatusEnum.Rejected; claimApprovalDetails.Remarks = txtRemarks.Text.Trim(); int response = new Business.ClaimManagement.ClaimApprovalDetails().Claim_Approve(claimApprovalDetails); if (response > 0) { //If final Appoval approved then update status in Master table new Business.ClaimManagement.ClaimApplication().ClaimApplicationMaster_Save( new Entity.ClaimManagement.ClaimApplicationMaster() { ClaimApplicationId = Business.Common.Context.ClaimApplicationId, Status = (int)ClaimStatusEnum.Rejected }); //Claim Balance reverting //ClaimAccontBalance_Revert(Business.Common.Context.ClaimApplicationId); GetClaimApplications_ByApproverId(ckShowAll.Checked ? (int)ClaimStatusEnum.None : (int)ClaimStatusEnum.Pending); MessageSuccess.IsSuccess = true; MessageSuccess.Text = "Claim cancelled."; MessageSuccess.Show = true; ModalPopupExtender1.Hide(); } else { Message.IsSuccess = false; Message.Text = "Response not given."; Message.Show = true; TabContainer1.ActiveTab = Approval; ModalPopupExtender1.Show(); } } else { TabContainer1.ActiveTab = Approval; ModalPopupExtender1.Show(); } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
private int ClaimApprovalDetails_Save(int claimApplicationId) { int response = 0; Business.ClaimManagement.ClaimApprovalConfiguration objClaimApprovalConfiguration = new Business.ClaimManagement.ClaimApprovalConfiguration(); DataTable dtClaimEmployeeWiseApprovalConfiguration = objClaimApprovalConfiguration.ClaimEmployeeWiseApprovalConfiguration_GetAll( new Entity.ClaimManagement.ClaimApprovalConfiguration() { EmployeeId = Convert.ToInt32(HttpContext.Current.User.Identity.Name) }); Business.ClaimManagement.ClaimApprovalDetails objClaimApprovalDetails = new Business.ClaimManagement.ClaimApprovalDetails(); Entity.ClaimManagement.ClaimApprovalDetails ClaimApprovalDetails = new Entity.ClaimManagement.ClaimApprovalDetails(); //If ClaimEmployeeWiseApprovalConfiguration is configured if (dtClaimEmployeeWiseApprovalConfiguration != null && dtClaimEmployeeWiseApprovalConfiguration.AsEnumerable().Any() && dtClaimEmployeeWiseApprovalConfiguration.Select("ApprovalLevel = 1").Any()) { ClaimApprovalDetails.ApproverId = Convert.ToInt32(dtClaimEmployeeWiseApprovalConfiguration.Select("ApprovalLevel = 1").FirstOrDefault()["ApproverId"].ToString()); } else //If not confiured then send approval to Reporting employee { DataTable dtEmployee = new Business.HR.EmployeeMaster().EmployeeMaster_ById(new Entity.HR.EmployeeMaster() { EmployeeMasterId = Convert.ToInt32(HttpContext.Current.User.Identity.Name) }); if (dtEmployee != null && dtEmployee.AsEnumerable().Any()) { ClaimApprovalDetails.ApproverId = Convert.ToInt32(dtEmployee.Rows[0]["ReportingEmployeeId"].ToString()); } } ClaimApprovalDetails.ClaimApprovalDetailId = 0; ClaimApprovalDetails.ClaimApplicationId = claimApplicationId; ClaimApprovalDetails.Status = (int)ClaimStatusEnum.Pending; ClaimApprovalDetails.Remarks = "APPROVAL PENDING"; response = objClaimApprovalDetails.ClaimApprovalDetails_Save(ClaimApprovalDetails); return(response); }
public int Claim_Approve(Entity.ClaimManagement.ClaimApprovalDetails ClaimApprovalDetails) { return(DataAccess.ClaimManagement.ClaimApprovalDetails.Claim_Approve(ClaimApprovalDetails)); }
protected void btnApprove_Click(object sender, EventArgs e) { try { if (ClaimApprovalValidation()) { Entity.ClaimManagement.ClaimApprovalDetails ClaimApprovalDetails = new Entity.ClaimManagement.ClaimApprovalDetails(); ClaimApprovalDetails.ApproverId = Convert.ToInt32(HttpContext.Current.User.Identity.Name); ClaimApprovalDetails.ClaimApplicationId = Business.Common.Context.ClaimApplicationId; ClaimApprovalDetails.Status = (int)ClaimStatusEnum.Approved; ClaimApprovalDetails.Remarks = txtRemarks.Text.Trim(); int response = new Business.ClaimManagement.ClaimApprovalDetails().Claim_Approve(ClaimApprovalDetails); if (response > 0) { //Fetching Requestor Id Entity.ClaimManagement.ClaimApplicationMaster ClaimApplicationMaster = new Entity.ClaimManagement.ClaimApplicationMaster(); Business.ClaimManagement.ClaimApplication objClaimApplication = new Business.ClaimManagement.ClaimApplication(); ClaimApplicationMaster.ClaimApplicationId = Business.Common.Context.ClaimApplicationId; DataTable dtClaimApplication = objClaimApplication.ClaimApplication_GetAll(ClaimApplicationMaster); Business.ClaimManagement.ClaimApprovalConfiguration objClaimApprovalConfiguration = new Business.ClaimManagement.ClaimApprovalConfiguration(); DataTable dtClaimEmployeeWiseApprovalConfiguration = objClaimApprovalConfiguration.ClaimEmployeeWiseApprovalConfiguration_GetAll( new Entity.ClaimManagement.ClaimApprovalConfiguration() { EmployeeId = (dtClaimApplication != null && dtClaimApplication.AsEnumerable().Any()) ? Convert.ToInt32(dtClaimApplication.Rows[0]["EmployeeId"].ToString()) : 0 }); int currentClaimApproverLevel = 0; if (dtClaimEmployeeWiseApprovalConfiguration != null && dtClaimEmployeeWiseApprovalConfiguration.AsEnumerable().Any() && dtClaimEmployeeWiseApprovalConfiguration.Select("ApproverId = " + HttpContext.Current.User.Identity.Name).Any()) { //Fetching the current approver approval level currentClaimApproverLevel = Convert.ToInt32(dtClaimEmployeeWiseApprovalConfiguration .Select("ApproverId = " + HttpContext.Current.User.Identity.Name).FirstOrDefault()["ApprovalLevel"].ToString()); currentClaimApproverLevel = currentClaimApproverLevel + 1; } if (dtClaimEmployeeWiseApprovalConfiguration != null && dtClaimEmployeeWiseApprovalConfiguration.AsEnumerable().Any() && dtClaimEmployeeWiseApprovalConfiguration.Select("ApprovalLevel = " + currentClaimApproverLevel).Any()) { Business.ClaimManagement.ClaimApprovalDetails objClaimApprovalDetails = new Business.ClaimManagement.ClaimApprovalDetails(); ClaimApprovalDetails.ClaimApprovalDetailId = 0; ClaimApprovalDetails.ClaimApplicationId = Business.Common.Context.ClaimApplicationId; ClaimApprovalDetails.Status = (int)ClaimStatusEnum.Pending; ClaimApprovalDetails.ApproverId = Convert.ToInt32(dtClaimEmployeeWiseApprovalConfiguration.Select("ApprovalLevel = " + currentClaimApproverLevel).FirstOrDefault()["ApproverId"].ToString()); //Assigning Claim Request to next approver int approvalResponse = objClaimApprovalDetails.ClaimApprovalDetails_Save(ClaimApprovalDetails); if (approvalResponse > 0) { GetClaimApplications_ByApproverId(ckShowAll.Checked ? (int)ClaimStatusEnum.None : (int)ClaimStatusEnum.Pending); MessageSuccess.IsSuccess = true; MessageSuccess.Text = "Approval moved to next level."; MessageSuccess.Show = true; ModalPopupExtender1.Hide(); } } else { //If final Appoval approved then update status in Master table new Business.ClaimManagement.ClaimApplication().ClaimApplicationMaster_Save( new Entity.ClaimManagement.ClaimApplicationMaster() { ClaimApplicationId = Business.Common.Context.ClaimApplicationId, Status = (int)ClaimStatusEnum.Approved, ApprovedAmount = Convert.ToDecimal(lblTotalApprovedAmount.Text.Trim()) }); GetClaimApplications_ByApproverId(ckShowAll.Checked ? (int)ClaimStatusEnum.None : (int)ClaimStatusEnum.Pending); MessageSuccess.IsSuccess = true; MessageSuccess.Text = "Claim approved."; MessageSuccess.Show = true; ModalPopupExtender1.Hide(); txtRemarks.Text = string.Empty; Message.Show = false; } Claim_Heading_Update(Business.Common.Context.ClaimApplicationId, txtClaimHeader.Text.Trim()); Claim_Adjust_Update(); } else { Message.IsSuccess = false; Message.Text = "Response not given."; Message.Show = true; TabContainer1.ActiveTab = Approval; ModalPopupExtender1.Show(); } } else { TabContainer1.ActiveTab = Approval; ModalPopupExtender1.Show(); } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }