Пример #1
0
 protected void rcmbBusinessUnit_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         RadNumericTextBox txt      = new RadNumericTextBox();
         CheckBox          chkCheck = new CheckBox();
         if (rcmbBusinessUnit.SelectedIndex > 0)
         {
             _obj_FoodAllowance = new SMHR_FOODALLOWANCE();
             _obj_FoodAllowance.FOODALLOWANCE_BU_ID  = Convert.ToInt32(rcmbBusinessUnit.SelectedValue);
             _obj_FoodAllowance.FOODALLOWANCE_ORG_ID = Convert.ToInt32(Session["ORG_ID"]);
             _obj_FoodAllowance.OPERATION            = operation.Select;
             DataTable dt = BLL.getFoodAllowance(_obj_FoodAllowance);
             if (dt.Rows.Count > 0)
             {
                 rgFoodAllowance.Visible    = true;;
                 rgFoodAllowance.DataSource = dt;
                 rgFoodAllowance.DataBind();
                 for (int iGridCount = 0; iGridCount < rgFoodAllowance.Items.Count; iGridCount++)
                 {
                     txt      = rgFoodAllowance.Items[iGridCount].FindControl("rntb") as RadNumericTextBox;
                     chkCheck = rgFoodAllowance.Items[iGridCount].FindControl("chkCheck") as CheckBox;
                     if (txt.Text != string.Empty)
                     {
                         chkCheck.Checked = true;
                     }
                 }
             }
             chkAll.Visible = true;
             chkAll.Checked = false;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frmFoodAllowance", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
         return;
     }
 }
Пример #2
0
    //public void loadPeriod()
    //{
    //    _obj_smhr_period = new SMHR_PERIOD();
    //    DataTable dt_Details = new DataTable();
    //    _obj_smhr_period.OPERATION = operation.Select;
    //    _obj_smhr_period.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
    //    dt_Details = BLL.get_PeriodHeaderDetails(_obj_smhr_period);
    //    rcmbPeriod.DataSource = dt_Details;
    //    rcmbPeriod.DataValueField = "PERIOD_ID";
    //    rcmbPeriod.DataTextField = "PERIOD_NAME";
    //    rcmbPeriod.DataBind();
    //    rcmbPeriod.Items.Insert(0, new RadComboBoxItem("Select", "-1"));
    //}

    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (rcmbBusinessUnit.SelectedIndex > 0)
            {
                int               countSaved = 0;
                int               countChk   = 0;
                Label             lbl        = new Label();
                RadNumericTextBox txt        = new RadNumericTextBox();
                CheckBox          chkCheck   = new CheckBox();
                for (int iGridCount = 0; iGridCount < rgFoodAllowance.Items.Count; iGridCount++)
                {
                    lbl      = rgFoodAllowance.Items[iGridCount].FindControl("lblEmpId") as Label;
                    txt      = rgFoodAllowance.Items[iGridCount].FindControl("rntb") as RadNumericTextBox;
                    chkCheck = rgFoodAllowance.Items[iGridCount].FindControl("chkCheck") as CheckBox;
                    if (chkCheck.Checked)
                    {
                        countChk += 1;
                    }
                    if ((Convert.ToString(txt.Text) != ""))
                    {
                        if (chkCheck.Checked == false)
                        {
                            BLL.ShowMessage(this, "Please Select Employee(s)");
                            return;
                        }
                        _obj_FoodAllowance = new SMHR_FOODALLOWANCE();
                        _obj_FoodAllowance.FOODALLOWANCE_BU_ID  = Convert.ToInt32(rcmbBusinessUnit.SelectedValue);
                        _obj_FoodAllowance.FOODALLOWANCE_ORG_ID = Convert.ToInt32(Session["ORG_ID"]);
                        _obj_FoodAllowance.CREATEDDATE          = DateTime.Now;
                        _obj_FoodAllowance.CREATEDBY            = Convert.ToInt32(Session["USER_ID"]);
                        _obj_FoodAllowance.LASTMDFDATE          = DateTime.Now;
                        _obj_FoodAllowance.LASTMDFBY            = Convert.ToInt32(Session["USER_ID"]);
                        _obj_FoodAllowance.FOODALLOWANCE_EMP_ID = Convert.ToInt32(lbl.Text);
                        _obj_FoodAllowance.FOODALLOWANCE_AMOUNT = Convert.ToDouble(txt.Text);
                        _obj_FoodAllowance.OPERATION            = operation.Insert;
                        if (BLL.setFoodAllowance(_obj_FoodAllowance))
                        {
                            countSaved += 1;
                        }
                    }
                    else
                    {
                        _obj_FoodAllowance                      = new SMHR_FOODALLOWANCE();
                        _obj_FoodAllowance.OPERATION            = operation.Delete;
                        _obj_FoodAllowance.FOODALLOWANCE_EMP_ID = Convert.ToInt32(lbl.Text);
                        _obj_FoodAllowance.FOODALLOWANCE_BU_ID  = Convert.ToInt32(rcmbBusinessUnit.SelectedValue);
                        bool status = BLL.setFoodAllowance(_obj_FoodAllowance);
                    }
                }
                if (countChk > countSaved)
                {
                    BLL.ShowMessage(this, "All selected employee(s) are not provided with values");
                    return;
                }
                else
                {
                    BLL.ShowMessage(this, "Total records saved are : " + countSaved);
                }
                rgFoodAllowance.Visible = false;
                chkAll.Visible          = false;
                loadBusinessUnit();
            }
            else
            {
                BLL.ShowMessage(this, "Please Select BusinessUnit");
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frmFoodAllowance", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }