protected void RG_Allowance_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        try
        {
            if (rcmb_FromPeriod.SelectedIndex > 0)
            {
                btn_submit.Visible = true;
                btn_Cancel.Visible = true;
                SMHR_ALLOWANCE _obj_smhr_allowance = new SMHR_ALLOWANCE();

                _obj_smhr_allowance.ALLOWANCE_ORG_ID    = Convert.ToInt32(Session["ORG_ID"]);
                _obj_smhr_allowance.ALLOWANCE_PERIOD_ID = Convert.ToInt32(rcmb_FromPeriod.SelectedValue);
                _obj_smhr_allowance.ALLOWANCE_CONFG_ID  = valID;   //Convert.ToInt32(Request.QueryString["val"]);
                DataTable DT = new DataTable();
                _obj_smhr_allowance.OPERATION = operation.Get;
                DT = BLL.GET_ALLOWANCE(_obj_smhr_allowance);
                if (DT.Rows.Count == 0)
                {
                    _obj_smhr_allowance.OPERATION = operation.Select;
                    DT = BLL.GET_ALLOWANCE(_obj_smhr_allowance);
                }
                RG_Allowance.DataSource = DT;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
 protected void rcmb_FromPeriod_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         if (rcmb_FromPeriod.SelectedIndex > 0)
         {
             RG_Allowance.Visible = true;
             btn_submit.Visible   = true;
             btn_Cancel.Visible   = true;
             SMHR_ALLOWANCE _obj_smhr_allowance = new SMHR_ALLOWANCE();
             _obj_smhr_allowance.OPERATION           = operation.Get;
             _obj_smhr_allowance.ALLOWANCE_ORG_ID    = Convert.ToInt32(Session["ORG_ID"]);
             _obj_smhr_allowance.ALLOWANCE_PERIOD_ID = Convert.ToInt32(rcmb_FromPeriod.SelectedValue);
             DataTable DT = new DataTable();
             DT = BLL.GET_ALLOWANCE(_obj_smhr_allowance);
             RG_Allowance.DataSource = DT;
             RG_Allowance.DataBind();
         }
         else
         {
             rcmb_FromPeriod.SelectedIndex = 0;
             BLL.ShowMessage(this, "Please Select Financial Period");
             return;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Allowance", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
         return;
     }
 }
    private DataTable GetAllowance(out string errorMsg)
    {
        errorMsg = string.Empty;
        DataTable dt = GetGridAllowance();

        try
        {
            RadTextBox     txtDependent, txtEligible;
            SMHR_ALLOWANCE _obj_allowance = new SMHR_ALLOWANCE();
            _obj_allowance.OPERATION        = operation.Select;
            _obj_allowance.ALLOWANCE_ORG_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable dtallowance = BLL.GET_ALLOWANCE(_obj_allowance);
            foreach (GridDataItem d in RG_Allowance.Items)
            {
                txtDependent = new RadTextBox();

                txtDependent = d.FindControl("txtDependent") as RadTextBox;

                txtEligible = new RadTextBox();
                txtEligible = d.FindControl("txtEligible") as RadTextBox;
                dt.Rows.Add(Convert.ToInt32(Session["ORG_ID"]), Convert.ToInt32(rcmb_FromPeriod.SelectedValue), Convert.ToInt32(d.Cells[2].Text), txtDependent.Text, txtEligible.Text);
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Allowance", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
        return(dt);
    }
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        try
        {
            if (rcmb_FromPeriod.SelectedIndex <= 0)
            {
                BLL.ShowMessage(this, "Please Select Financial Period");
                return;
            }

            string    errorMsg    = string.Empty;
            DataTable dtallowance = GetAllowance(out errorMsg);
            if (!string.IsNullOrEmpty(errorMsg))
            {
                BLL.ShowMessage(this, errorMsg);
                return;
            }
            SMHR_ALLOWANCE all = new SMHR_ALLOWANCE();
            all.ALLOWANCE_GRIDDATA    = dtallowance;
            all.ALLOWANCE_ORG_ID      = Convert.ToInt32(Session["ORG_ID"]);
            all.ALLOWANCE_PERIOD_ID   = Convert.ToInt32(rcmb_FromPeriod.SelectedValue);
            all.ALLOWANCE_CREATEDBY   = Convert.ToInt32(Session["USER_ID"]);
            all.ALLOWANCE_CREATEDDATE = DateTime.Now;
            all.ALLOWANCE_LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]);
            all.ALLOWANCE_LASTMDFDATE = DateTime.Now;
            switch (((Button)sender).Text.ToUpper())
            {
            case "SAVE":
                all.OPERATION = operation.Insert;
                if (BLL.Set_Allowance(all))
                {
                    BLL.ShowMessage(this, "Information Saved Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Information Not Saved");
                }
                break;

            default:
                break;
            }
            rcmb_FromPeriod.ClearSelection();
            rcmb_FromPeriod.Text = string.Empty;
            RG_Allowance.Visible = false;
            btn_submit.Visible   = false;
            btn_Cancel.Visible   = false;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Allowance", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
            return;
        }
    }
Example #5
0
    protected void rcbFinPeriod_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        try
        {
            rcbDependentName.SelectedIndex = 0;
            rntb_bal.Text = string.Empty;
            if (rcbFinPeriod.SelectedIndex > 0)
            {
                SMHR_ALLOWANCE _obj_SMHR_ALLOWANCE = new SMHR_ALLOWANCE();

                _obj_SMHR_ALLOWANCE.OPERATION                  = operation.Check;
                _obj_SMHR_ALLOWANCE.ORGANISATION_ID            = Convert.ToInt32(Session["ORG_ID"]);
                _obj_SMHR_ALLOWANCE.ALLOWANCE_PERIOD_ID        = Convert.ToInt32(rcbFinPeriod.SelectedValue);
                _obj_SMHR_ALLOWANCE.ALLOWANCE_EMPLOYEEGRADE_ID = Convert.ToInt32(rcbScale.SelectedValue);
                _obj_SMHR_ALLOWANCE.ALLOWANCE_CONFG_ID         = 1; //for getting Education allowance
                DataTable dtEmpFmlyAlwnces = BLL.GET_ALLOWANCE(_obj_SMHR_ALLOWANCE);
                if (dtEmpFmlyAlwnces.Rows.Count > 0)
                {
                    rntbEduAllScale.Text = Convert.ToString(dtEmpFmlyAlwnces.Rows[0]["ALLOWANCE_DEPENDENT"]);
                }
                else
                {
                    rntbEduAllScale.Text = "0";
                }
            }
            else
            {
                rntbEduAllScale.Text = string.Empty;
                BLL.ShowMessage(this, "Please select Financial Period");
                rcbFinPeriod.Focus();
                return;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Example #6
0
    protected void rcmb_Employee_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        try
        {
            rcbScale.SelectedIndex = 0;
            rntbEduAllScale.Text   = rad_ClaimAmount.Text = rntbRule75.Text = rntb_bal.Text = string.Empty;

            if (rcmb_Employee.SelectedIndex > 0)
            {
                int empID = Convert.ToInt32(rcmb_Employee.SelectedValue);

                SMHR_EMPLOYEE  _obj_smhr_employee  = new SMHR_EMPLOYEE();
                SMHR_ALLOWANCE _obj_SMHR_ALLOWANCE = new SMHR_ALLOWANCE();

                _obj_smhr_employee.OPERATION       = operation.Select;
                _obj_smhr_employee.EMP_ID          = empID;
                _obj_smhr_employee.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);

                DataTable dt_Details = BLL.get_Employee(_obj_smhr_employee);

                if (dt_Details.Rows.Count > 0)
                {
                    LoadBusinessUnits();
                    LoadDepartments();
                    LoadScales();
                    LoadFinancialPeriod();
                    LoadEmpFamilyDetails();

                    rcmb_BusinessUnit.SelectedIndex = rcmb_BusinessUnit.Items.FindItemIndexByValue(Convert.ToString(dt_Details.Rows[0]["EMP_BUSINESSUNIT_ID"]));
                    rcmb_Department.SelectedIndex   = rcmb_Department.Items.FindItemIndexByValue(Convert.ToString(dt_Details.Rows[0]["EMP_DEPARTMENT_ID"]));
                    rcbScale.SelectedIndex          = rcbScale.Items.FindItemIndexByValue(Convert.ToString(dt_Details.Rows[0]["EMP_GRADE"]));
                    //rcbFinPeriod.SelectedIndex = rcbFinPeriod.Items.FindItemIndexByValue(Convert.ToString(dt_Details.Rows[0]["EMP_PERIOD_ID"]));

                    /*_obj_SMHR_ALLOWANCE.OPERATION = operation.Check;
                     * _obj_SMHR_ALLOWANCE.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                     * _obj_SMHR_ALLOWANCE.ALLOWANCE_PERIOD_ID = Convert.ToInt32(rcbFinPeriod.SelectedValue);
                     * _obj_SMHR_ALLOWANCE.ALLOWANCE_EMPLOYEEGRADE_ID = Convert.ToInt32(rcbScale.SelectedValue);
                     * _obj_SMHR_ALLOWANCE.ALLOWANCE_CONFG_ID = 1; //for getting Education allowance
                     *
                     * DataTable dtEmpFmlyAlwnces = BLL.GET_ALLOWANCE(_obj_SMHR_ALLOWANCE);
                     *
                     * _OBJ_SMHR_EDU_ALLOWANCE.OPERATION = operation.Count;
                     * _OBJ_SMHR_EDU_ALLOWANCE.EDU_EMP_ID = empID;
                     * _OBJ_SMHR_EDU_ALLOWANCE.EDU_ORG_ID = Convert.ToInt32(Session["ORG_ID"]);
                     *
                     * DataTable dtEmpEduData = BLL.GetEduAllowance(_OBJ_SMHR_EDU_ALLOWANCE);
                     *
                     * if (dtEmpFmlyAlwnces.Rows.Count > 0)
                     *  rntbEduAllScale.Text = Convert.ToString(dtEmpFmlyAlwnces.Rows[0]["ALLOWANCE_DEPENDENT"]);
                     * else
                     *  rntbEduAllScale.Text = "0";
                     * if (dtEmpEduData.Rows.Count > 0)
                     *  rntb_bal.Text = Convert.ToString(Convert.ToDecimal(rntbEduAllScale.Value) - Convert.ToDecimal(dtEmpEduData.Rows[0]["CLAIM"]));
                     * else
                     *  rntb_bal.Text = rntbEduAllScale.Text;*/
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (rcmb_FromPeriod.SelectedIndex <= 0)
            {
                BLL.ShowMessage(this, "Please Select Financial Period");
                return;
            }

            RadNumericTextBox rntbDependent;
            RadNumericTextBox rntbEligible;

            Label lblGradeID;
            int   count = 0;

            for (int i = 0; i < RG_Allowance.Items.Count; i++)
            {
                rntbDependent = RG_Allowance.Items[i].FindControl("rntbDependent") as RadNumericTextBox;
                rntbEligible  = RG_Allowance.Items[i].FindControl("rntbEligible") as RadNumericTextBox;

                if (rntbDependent.Text != string.Empty || rntbEligible.Text != string.Empty)
                {
                    if ((rntbDependent.Text == string.Empty && rntbEligible.Text != string.Empty) || (rntbDependent.Text != string.Empty && rntbEligible.Text == string.Empty))
                    {
                        if (rntbDependent.Text == string.Empty && rntbEligible.Text != string.Empty)
                        {
                            BLL.ShowMessage(this, "Please Enter Dependent value for S.NO: " + (i + 1).ToString());
                            rntbDependent.Focus();
                            return;
                        }
                        else
                        {
                            BLL.ShowMessage(this, "Please Enter Eligible value for S.NO: " + (i + 1).ToString());
                            rntbEligible.Focus();
                            return;
                        }
                    }
                }
                if (rntbDependent.Text == string.Empty || rntbEligible.Text == string.Empty)
                {
                    count++;
                }
            }

            if (count == RG_Allowance.Items.Count)
            {
                BLL.ShowMessage(this, "No records have any entered values..");
                return;
            }

            string    errorMsg    = string.Empty;
            DataTable dtallowance = GetAllowance(out errorMsg);

            if (!string.IsNullOrEmpty(errorMsg))
            {
                BLL.ShowMessage(this, errorMsg);
                return;
            }

            SMHR_ALLOWANCE _obj_Alwnce = new SMHR_ALLOWANCE();

            if (payItemID > 0)
            {
                _obj_Alwnce.COMMITTEE_ID        = payItemID;
                _obj_Alwnce.ORGANISATION_ID     = Convert.ToInt32(Session["ORG_ID"]);
                _obj_Alwnce.ALLOWANCE_PERIOD_ID = Convert.ToInt32(rcmb_FromPeriod.SelectedValue);
                _obj_Alwnce.ALLOWANCE_CONFG_ID  = valID;
                _obj_Alwnce.CREATEDBY           = _obj_Alwnce.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]);
                _obj_Alwnce.OPERATION           = operation.Insert1;

                for (int i = 0; i < RG_Allowance.Items.Count; i++)
                {
                    rntbDependent = RG_Allowance.Items[i].FindControl("rntbDependent") as RadNumericTextBox;
                    rntbEligible  = RG_Allowance.Items[i].FindControl("rntbEligible") as RadNumericTextBox;
                    lblGradeID    = RG_Allowance.Items[i].FindControl("lblGradeID") as Label;

                    if (lblGradeID.Text != string.Empty && rntbDependent.Text != string.Empty && rntbEligible.Text != string.Empty)
                    {
                        _obj_Alwnce.ALLOWANCE_EMPLOYEEGRADE_ID = Convert.ToInt32(lblGradeID.Text);
                        _obj_Alwnce.ALLOWANCE_DEPENDENT        = Convert.ToDecimal(rntbDependent.Text);
                        _obj_Alwnce.ALLOWANCE_ELIGIBLE         = Convert.ToInt32(rntbEligible.Text);

                        BLL.Set_Allowance_New(_obj_Alwnce);
                    }
                }
            }

            BLL.ShowMessage(this, "Record(s) saved successfully..!");
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Allowance", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        try
        {
            if (rcmb_FromPeriod.SelectedIndex <= 0)
            {
                BLL.ShowMessage(this, "Please Select Financial Period");
                return;
            }

            RadNumericTextBox rntbDependent;
            RadNumericTextBox rntbEligible;
            int count = 0;

            for (int i = 0; i < RG_Allowance.Items.Count; i++)
            {
                rntbDependent = RG_Allowance.Items[i].FindControl("rntbDependent") as RadNumericTextBox;
                rntbEligible  = RG_Allowance.Items[i].FindControl("rntbEligible") as RadNumericTextBox;

                if (rntbDependent.Text != string.Empty || rntbEligible.Text != string.Empty)
                {
                    if ((rntbDependent.Text == string.Empty && rntbEligible.Text != string.Empty) || (rntbDependent.Text != string.Empty && rntbEligible.Text == string.Empty))
                    {
                        if (rntbDependent.Text == string.Empty && rntbEligible.Text != string.Empty)
                        {
                            BLL.ShowMessage(this, "Please Enter Dependent value for S.NO: " + (i + 1).ToString());
                            rntbDependent.Focus();
                            return;
                        }
                        else
                        {
                            BLL.ShowMessage(this, "Please Enter Eligible value for S.NO: " + (i + 1).ToString());
                            rntbEligible.Focus();
                            return;
                        }
                    }
                }
                if (rntbDependent.Text == string.Empty || rntbEligible.Text == string.Empty)
                {
                    count++;
                }
            }

            if (count == RG_Allowance.Items.Count)
            {
                BLL.ShowMessage(this, "No records have any entered values..");
                return;
            }

            string    errorMsg    = string.Empty;
            DataTable dtallowance = GetAllowance(out errorMsg);
            if (!string.IsNullOrEmpty(errorMsg))
            {
                BLL.ShowMessage(this, errorMsg);
                return;
            }

            SMHR_ALLOWANCE all = new SMHR_ALLOWANCE();
            all.ALLOWANCE_GRIDDATA  = dtallowance;
            all.ALLOWANCE_ORG_ID    = Convert.ToInt32(Session["ORG_ID"]);
            all.ALLOWANCE_PERIOD_ID = Convert.ToInt32(rcmb_FromPeriod.SelectedValue);
            all.MODE = payItemID;
            all.ALLOWANCE_CONFG_ID    = valID;
            all.ALLOWANCE_CREATEDBY   = Convert.ToInt32(Session["USER_ID"]);
            all.ALLOWANCE_CREATEDDATE = DateTime.Now;
            all.ALLOWANCE_LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]);
            all.ALLOWANCE_LASTMDFDATE = DateTime.Now;

            switch (((Button)sender).Text.ToUpper())
            {
            case "SAVE":
                all.OPERATION = operation.Insert;
                if (BLL.Set_Allowance(all))
                {
                    BLL.ShowMessage(this, "Information Saved Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Information Not Saved");
                }
                break;

            default:
                break;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Allowance", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
            return;
        }
    }