コード例 #1
0
        private void ClaimApplication_GetAll()
        {
            Entity.ClaimManagement.ClaimApplicationMaster ClaimApplicationMaster = new Entity.ClaimManagement.ClaimApplicationMaster();
            ClaimApplicationMaster.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue);
            ClaimApplicationMaster.PeriodFrom = (string.IsNullOrEmpty(txtFromDate.Text.Trim())) ? DateTime.MinValue : Convert.ToDateTime(txtFromDate.Text.Trim());
            ClaimApplicationMaster.PeriodTo   = (string.IsNullOrEmpty(txtToDate.Text.Trim())) ? DateTime.MinValue : Convert.ToDateTime(txtToDate.Text.Trim());
            ClaimApplicationMaster.Status     = Convert.ToInt32(ddlStatus.SelectedValue);
            Business.ClaimManagement.ClaimApplication objClaimApplication = new Business.ClaimManagement.ClaimApplication();
            DataTable dtClaimApplication = objClaimApplication.ClaimApplication_GetAll(ClaimApplicationMaster);

            if (dtClaimApplication != null)
            {
                gvClaimReport.DataSource = dtClaimApplication;
                gvClaimReport.DataBind();
            }
        }
コード例 #2
0
        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;
            }
        }