protected void btnSave_Click(object sender, EventArgs e) { try { Business.ClaimManagement.ClaimApprovalConfiguration objClaimApprovalConfiguration = new Business.ClaimManagement.ClaimApprovalConfiguration(); Entity.ClaimManagement.ClaimApprovalConfiguration ClaimApprovalConfiguration = new Entity.ClaimManagement.ClaimApprovalConfiguration(); ClaimApprovalConfiguration.ClaimApprovalConfigurationId = ClaimApprovalConfigurationId; ClaimApprovalConfiguration.ApproverDesignationId = Convert.ToInt32(ddlApproverDesignation.SelectedValue); ClaimApprovalConfiguration.ClaimDesignationConfigurationId = Convert.ToInt32(ddlRequestorDesignation.SelectedValue); ClaimApprovalConfiguration.ApprovalLevel = Convert.ToInt32(ddlApprovalLevel.SelectedValue); int response = objClaimApprovalConfiguration.ClaimApprovalConfig_Save(ClaimApprovalConfiguration); if (response > 0) { Clear(); ClaimApprovalConfig_GetAll(); Message.IsSuccess = true; Message.Text = "Saved Successfully"; } else { Message.IsSuccess = false; Message.Text = "Exists"; } Message.Show = true; } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
private void ClaimApprovalConfig_GetAll() { Business.ClaimManagement.ClaimApprovalConfiguration objClaimApprovalConfiguration = new Business.ClaimManagement.ClaimApprovalConfiguration(); DataTable dt = objClaimApprovalConfiguration.ClaimApprovalConfig_GetAll(new Entity.ClaimManagement.ClaimApprovalConfiguration() { }); gvClaimApprovalConfiguration.DataSource = dt; gvClaimApprovalConfiguration.DataBind(); }
private void ClaimApprovalConfig_GetById() { Business.ClaimManagement.ClaimApprovalConfiguration objClaimApprovalConfiguration = new Business.ClaimManagement.ClaimApprovalConfiguration(); DataTable dt = objClaimApprovalConfiguration.ClaimApprovalConfig_GetAll(new Entity.ClaimManagement.ClaimApprovalConfiguration() { ClaimApprovalConfigurationId = ClaimApprovalConfigurationId }); if (dt.Rows.Count > 0) { ddlRequestorDesignation.SelectedValue = dt.Rows[0]["ClaimDesignationConfigId"].ToString(); ddlApproverDesignation.SelectedValue = dt.Rows[0]["ApproverDesignationId"].ToString(); ddlApprovalLevel.SelectedValue = dt.Rows[0]["ApproverLevel"].ToString(); } }
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); }
protected void gvClaimApprovalConfiguration_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "E") { ClaimApprovalConfigurationId = Convert.ToInt32(e.CommandArgument.ToString()); ClaimApprovalConfig_GetById(); } else { if (e.CommandName == "D") { Business.ClaimManagement.ClaimApprovalConfiguration objClaimApprovalConfiguration = new Business.ClaimManagement.ClaimApprovalConfiguration(); ClaimApprovalConfigurationId = Convert.ToInt32(e.CommandArgument.ToString()); int RowsAffected = objClaimApprovalConfiguration.ClaimApprovalConfig_Delete(ClaimApprovalConfigurationId); if (RowsAffected > 0) { Clear(); ClaimApprovalConfig_GetAll(); Message.Show = true; Message.Text = "Deleted Successfully"; } else { Message.Show = false; Message.Text = "Data Dependency Exists"; } Message.Show = true; } } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
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; } }