protected void lnk_Delete_Command(object sender, CommandEventArgs e)
    {
        try
        {
            SMHR_PERIODTYPE _obj_smhr_periodtype = new SMHR_PERIODTYPE();
            _obj_smhr_periodtype.PERIODTYPE_ID          = Convert.ToInt32(Convert.ToString(e.CommandArgument));
            _obj_smhr_periodtype.PERIODTYPE_LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]);
            _obj_smhr_periodtype.PERIODTYPE_LASTMDFDATE = DateTime.Now;
            _obj_smhr_periodtype.OPERATION = operation.Check;

            if (Convert.ToString(BLL.get_PeriodType(_obj_smhr_periodtype).Rows[0]["Count"]) != "0")
            {
                BLL.ShowMessage(this, "This type is Already assigned to Period, so cannot be deleted");
                return;
            }


            _obj_smhr_periodtype.OPERATION = operation.Delete;
            if (BLL.set_PeriodType(_obj_smhr_periodtype))
            {
                BLL.ShowMessage(this, "Deleted Successfully");
            }

            else
            {
                BLL.ShowMessage(this, "Deletion failed");
            }
            LoadGrid();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodType", ex.StackTrace, DateTime.Now);
        }
    }
    protected void rcmb_PeriodType_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        try
        {
            rcmb_DurationType.Items.Clear();
            _obj_Smhr_PeriodType = new SMHR_PERIODTYPE();
            _obj_Smhr_PeriodType.PERIODTYPE_ID = Convert.ToInt32(rcmb_PeriodType.SelectedItem.Value);
            DataTable dtperiodtype = BLL.get_PeriodType(_obj_Smhr_PeriodType);
            int       days         = Convert.ToInt32(dtperiodtype.Rows[0]["PERIODTYPE_NOOFDAYS"]);

            if (days >= 31)
            {
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Select", "-1"));
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Years", "1"));
            }
            else
            {
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Select", "-1"));
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Years", "1"));
                rcmb_DurationType.Items.Add(new RadComboBoxItem("Months", "2"));
            }

            Rg_PeriodDetails.DataSource = null;
            Rg_PeriodDetails.DataBind();
            rcmb_DurationType.SelectedIndex = 1;
            btn_Save.Visible = false;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodCalender", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
 public void LoadCombos()
 {
     try
     {
         _obj_Smhr_PeriodType           = new SMHR_PERIODTYPE();
         rcmb_PeriodType.DataSource     = BLL.get_PeriodType(_obj_Smhr_PeriodType);
         rcmb_PeriodType.DataTextField  = "PERIODTYPE_NAME";
         rcmb_PeriodType.DataValueField = "PERIODTYPE_ID";
         rcmb_PeriodType.DataBind();
         rcmb_PeriodType.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "0"));
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodCalender", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
예제 #4
0
 protected void txt_TextChanged(object sender, EventArgs e)
 {
     try
     {
         TextBox txt        = new TextBox();
         TextBox txtAnnual  = new TextBox();
         Label   lblCalMode = new Label();
         _obj_Smhr_PeriodType = new SMHR_PERIODTYPE();
         _obj_Smhr_PeriodType.PERIODTYPE_ID = Convert.ToInt32(rcb_Type.SelectedItem.Value);
         DataTable dt_PeriodType = BLL.get_PeriodType(_obj_Smhr_PeriodType);
         if (dt_PeriodType.Rows.Count != 0)
         {
             ViewState["days"] = Convert.ToInt32(dt_PeriodType.Rows[0]["PERIODTYPE_NOOFMONTHS"]);
         }
         int iMonth = (int)ViewState["days"];
         for (int index = 0; index < RG_SalaryStruct.Items.Count; index++)
         {
             txt        = RG_SalaryStruct.Items[index].FindControl("txtNumber") as TextBox;
             txtAnnual  = RG_SalaryStruct.Items[index].FindControl("txtAnnualNumber") as TextBox;
             lblCalMode = RG_SalaryStruct.Items[index].FindControl("lblCALMODE_1") as Label;
             string str = txt.Text;
             if (txt.Text != "")
             {
                 if (lblCalMode.Text.ToUpper() == "DIRECT")
                 {
                     try
                     {
                         txtAnnual.Text = Convert.ToString(iMonth * (Convert.ToDouble(txt.Text)));
                     }
                     catch
                     {
                     }
                 }
                 else if (lblCalMode.Text.ToUpper() == "PERCENTAGE")
                 {
                     txtAnnual.Text = txt.Text;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_SalaryStructure", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void lnk_Edit_Command(object sender, CommandEventArgs e)
    {
        try
        {
            _obj_smhr_periodtype = new SMHR_PERIODTYPE();

            _obj_smhr_periodtype.PERIODTYPE_ID = Convert.ToInt32(Convert.ToString(e.CommandArgument));
            lbl_PeriodTypeID.Text = Convert.ToString(e.CommandArgument);
            dt = BLL.get_PeriodType(_obj_smhr_periodtype);

            rtxt_PeriodTypeCode.Text = Convert.ToString(dt.Rows[0]["PERIODTYPE_NAME"]);
            rtxt_noofdays.Text       = Convert.ToString(dt.Rows[0]["PERIODTYPE_NOOFDAYS"]);

            btn_Edit.Visible         = true;
            Rm_PT_page.SelectedIndex = 1;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodType", ex.StackTrace, DateTime.Now);
        }
    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            _obj_smhr_periodtype = new SMHR_PERIODTYPE();
            _obj_smhr_periodtype.PERIODTYPE_NAME        = Convert.ToString(rtxt_PeriodTypeCode.Text);
            _obj_smhr_periodtype.PERIODTYPE_NOOFDAYS    = Convert.ToInt32(rtxt_noofdays.Text);
            _obj_smhr_periodtype.PERIODTYPE_CREATEDBY   = Convert.ToInt32(Session["USER_ID"]);
            _obj_smhr_periodtype.PERIODTYPE_CREATEDDATE = DateTime.Now;
            _obj_smhr_periodtype.PERIODTYPE_LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]);
            _obj_smhr_periodtype.PERIODTYPE_LASTMDFDATE = DateTime.Now;

            switch (((Button)sender).ID.ToUpper())
            {
            case "BTN_EDIT":
                _obj_smhr_periodtype.PERIODTYPE_ID = Convert.ToInt32(lbl_PeriodTypeID.Text);
                _obj_smhr_periodtype.OPERATION     = operation.Check;
                if (Convert.ToString(BLL.get_PeriodType(_obj_smhr_periodtype).Rows[0]["Count"]) != "1")
                {
                    BLL.ShowMessage(this, "Period Type with this Name Already Exists");
                    return;
                }
                _obj_smhr_periodtype.OPERATION = operation.Update;
                if (BLL.set_PeriodType(_obj_smhr_periodtype))
                {
                    BLL.ShowMessage(this, "Information Updated Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Information Not Saved");
                }

                break;

            case "BTN_SAVE":
                _obj_smhr_periodtype.OPERATION = operation.Check;
                if (Convert.ToString(BLL.get_PeriodType(_obj_smhr_periodtype).Rows[0]["Count"]) != "0")
                {
                    BLL.ShowMessage(this, "Period Type with this Name Already Exists");
                    return;
                }
                _obj_smhr_periodtype.OPERATION = operation.Insert;
                if (BLL.set_PeriodType(_obj_smhr_periodtype))
                {
                    BLL.ShowMessage(this, "Information Saved Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Information Not Saved");
                }
                break;

            default:
                break;
            }
            Rm_PT_page.SelectedIndex = 0;
            LoadGrid();
            Rg_PeriodType.DataBind();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PeriodType", ex.StackTrace, DateTime.Now);
        }
    }
예제 #7
0
 protected void rcb_Type_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         _obj_Smhr_PeriodType = new SMHR_PERIODTYPE();
         _obj_Smhr_PeriodType.PERIODTYPE_ID = Convert.ToInt32(rcb_Type.SelectedItem.Value);
         DataTable dt_PeriodType = BLL.get_PeriodType(_obj_Smhr_PeriodType);
         if (dt_PeriodType.Rows.Count != 0)
         {
             ViewState["days"] = Convert.ToInt32(dt_PeriodType.Rows[0]["PERIODTYPE_NOOFMONTHS"]);
             int iMonth = (int)ViewState["days"];
         }
         _obj_smhr_organisation                 = new SMHR_ORGANISATION();
         _obj_smhr_organisation.MODE            = 2;
         _obj_smhr_organisation.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
         DataTable dt_Org          = BLL.get_Organisation(_obj_smhr_organisation);
         TextBox   txtNumber       = new TextBox();
         TextBox   txtAnnualNumber = new TextBox();
         CheckBox  chk_Select      = new CheckBox();
         Label     lblCalMode      = new Label();
         for (int index = 0; index < RG_SalaryStruct.Items.Count; index++)
         {
             chk_Select      = RG_SalaryStruct.Items[index].FindControl("chk_Select") as CheckBox;
             txtNumber       = RG_SalaryStruct.Items[index].FindControl("txtNumber") as TextBox;
             txtAnnualNumber = RG_SalaryStruct.Items[index].FindControl("txtAnnualNumber") as TextBox;
             lblCalMode      = RG_SalaryStruct.Items[index].FindControl("lblCALMODE_1") as Label;
             if (chk_Select.Checked)
             {
                 if (dt_Org.Rows.Count != 0)
                 {
                     if (Convert.ToString(dt_Org.Rows[0]["ORGANISATION_ANNUALPROCESS"]) != "")
                     {
                         if (Convert.ToInt32(dt_Org.Rows[0]["ORGANISATION_ANNUALPROCESS"]) == 1)
                         {
                             if (txtAnnualNumber.Text != "")
                             {
                                 if (lblCalMode.Text.ToUpper() == "DIRECT")
                                 {
                                     txtNumber.Text = Convert.ToString((Convert.ToDouble(txtAnnualNumber.Text)) / Convert.ToInt32(dt_PeriodType.Rows[0]["PERIODTYPE_NOOFMONTHS"]));
                                 }
                                 else if (lblCalMode.Text.ToUpper() == "PERCENTAGE")
                                 {
                                     txtNumber.Text = txtAnnualNumber.Text;
                                 }
                             }
                         }
                         else
                         {
                             if (txtNumber.Text != "")
                             {
                                 if (lblCalMode.Text.ToUpper() == "DIRECT")
                                 {
                                     txtAnnualNumber.Text = Convert.ToString(Convert.ToInt32(dt_PeriodType.Rows[0]["PERIODTYPE_NOOFMONTHS"]) * (Convert.ToDouble(txtNumber.Text)));
                                 }
                                 else if (lblCalMode.Text.ToUpper() == "PERCENTAGE")
                                 {
                                     txtAnnualNumber.Text = txtNumber.Text;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_SalaryStructure", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }