private void Save()
 {
     if (ClaimControlValidation())
     {
         Business.ClaimManagement.ClaimCategory objClaimCategory = new Business.ClaimManagement.ClaimCategory();
         Entity.ClaimManagement.ClaimCategory   Model            = new Entity.ClaimManagement.ClaimCategory
         {
             ClaimCategoryTypeId      = int.Parse(ddlCategoryType.SelectedValue),
             ClaimCategoryId          = ClaimCategoryId,
             ClaimCategoryName        = txtName.Text,
             ClaimCategoryDescription = txtDescription.Text,
         };
         int rows = objClaimCategory.ClaimCategorySave(Model);
         if (rows > 0)
         {
             ClearControls();
             ClaimCategoryGetAll();
             ClaimCategoryId   = 0;
             Message.IsSuccess = true;
             Message.Text      = "Saved Successfully";
         }
         else
         {
             Message.IsSuccess = false;
             Message.Text      = "Unable to save data.";
         }
         Message.Show = true;
     }
 }
 private void ClaimCategoryGetAll()
 {
     Business.ClaimManagement.ClaimCategory objClaimCategory = new Business.ClaimManagement.ClaimCategory();
     gvClaimCategory.DataSource = objClaimCategory.ClaimCategoryGetAll(new Entity.ClaimManagement.ClaimCategory()
     {
     });
     gvClaimCategory.DataBind();
 }
        private void ClaimCategory_GetById()
        {
            Business.ClaimManagement.ClaimCategory objClaimCategory = new Business.ClaimManagement.ClaimCategory();
            DataTable dtClaimCategory = objClaimCategory.ClaimCategory_GetById(ClaimCategoryId);

            if (dtClaimCategory != null)
            {
                txtDescription.Text           = dtClaimCategory.Rows[0]["Description"].ToString();
                txtName.Text                  = dtClaimCategory.Rows[0]["CategoryName"].ToString();
                ddlCategoryType.SelectedValue = dtClaimCategory.Rows[0]["ClaimCategoryTypeId"].ToString();
            }
        }
예제 #4
0
        private void LoadClaimCategory()
        {
            Business.ClaimManagement.ClaimCategory objClaimCategory = new Business.ClaimManagement.ClaimCategory();
            DataTable dtClaimMaster = objClaimCategory.ClaimCategoryGetAll(new Entity.ClaimManagement.ClaimCategory());

            if (dtClaimMaster != null)
            {
                ddlClaimCategory.DataSource     = dtClaimMaster;
                ddlClaimCategory.DataTextField  = "CategoryName";
                ddlClaimCategory.DataValueField = "ClaimCategoryId";
                ddlClaimCategory.DataBind();
            }
            ddlClaimCategory.InsertSelect();
        }
        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));
        }