protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomList <SalaryRuleBackup> SalaryRuleBackupList = new CustomList <SalaryRuleBackup>();
                SalaryRuleBackupList = (CustomList <SalaryRuleBackup>)HttpContext.Current.Session["SalaryRule_grdSalaryRuleList"];
                CustomList <ASL.Hr.DAO.SalaryRule> SRList        = new CustomList <ASL.Hr.DAO.SalaryRule>();
                CustomList <ASL.Hr.DAO.SalaryRule> DeletedSRList = new CustomList <ASL.Hr.DAO.SalaryRule>();
                if (chkApproved.Checked && chkApproved.Enabled)
                {
                    foreach (SalaryRuleBackup sRB in SalaryRuleBackupList)
                    {
                        sRB.ApprovalDate = txtApprovalDate.Text.ToDateTime();
                        sRB.ApproveBy    = txtApproveBy_nc.Text;
                        sRB.IsApproved   = chkApproved.Checked;

                        ASL.Hr.DAO.SalaryRule sR = new ASL.Hr.DAO.SalaryRule();
                        sR.SalaryRuleCode   = sRB.SalaryRuleCode;
                        sR.SalaryHeadKey    = sRB.SalaryHeadKey;
                        sR.sCriteria        = sRB.sCriteria;
                        sR.ParentHeadID     = sRB.ParentHeadID;
                        sR.ParentHeadValue  = sRB.ParentHeadValue;
                        sR.PartialHeadID    = sRB.PartialHeadID;
                        sR.PartialHeadValue = sRB.PartialHeadValue;
                        sR.IsFixed          = sRB.IsFixed;
                        sR.IsHigher         = sRB.IsHigher;
                        sR.Formula1         = sRB.Formula1;
                        sR.Formula2         = sRB.Formula2;
                        SRList.Add(sR);

                        ASL.Hr.DAO.SalaryRule deletedSR = new ASL.Hr.DAO.SalaryRule();
                        deletedSR.SalaryRuleCode = sRB.SalaryRuleCode;
                        deletedSR.Delete();
                        DeletedSRList.Add(deletedSR);
                    }
                }
                if (SalaryRuleBackupList.Count != 0)
                {
                    if (!CheckUserAuthentication(SalaryRuleBackupList, SRList, DeletedSRList))
                    {
                        return;
                    }
                    manager.SaveSalaryRule(ref SalaryRuleBackupList, ref DeletedSRList, ref SRList);
                    txtSalaryRuleID.Text = manager.SalaryRuleCode;
                    this.SuccessMessage  = (StaticInfo.SavedSuccessfullyMsg);
                }
            }
            catch (SqlException ex)
            {
                this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }