protected void rcmb_AttPeriodElement_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         if (rcmb_AttPeriodElement.SelectedIndex > 0)
         {
             SMHR_EMPLOYEETRANSACTION _obj_smhr_emptrans = new SMHR_EMPLOYEETRANSACTION();
             _obj_smhr_emptrans.EMPBNKTRN_BU_ID     = Convert.ToInt32(rcmb_AttBusinessUnit.SelectedValue);
             _obj_smhr_emptrans.EMPBNKTRN_ORG_ID    = Convert.ToInt32(Session["ORG_ID"]);
             _obj_smhr_emptrans.EMPBNKTRN_PERIOD_ID = Convert.ToInt32(rcmb_AttPeriod.SelectedValue);
             _obj_smhr_emptrans.EMPBNKTRN_PRDDTL_ID = Convert.ToInt32(rcmb_AttPeriodElement.SelectedValue);
             _obj_smhr_emptrans.OPERATION           = operation.Select;
             DataTable dt_Details = BLL.get_EmpTrans(_obj_smhr_emptrans);
             if (dt_Details.Rows.Count != 0)
             {
                 rg_Attendence.DataSource = dt_Details;
                 rg_Attendence.DataBind();
                 rg_Attendence.Visible = true;
                 for (int index = 0; index < rg_Attendence.Items.Count; index++)
                 {
                     if (rg_Attendence.Items[index]["STATUS"].Text == "1")
                     {
                         rg_Attendence.Items[index].Enabled = false;
                     }
                 }
             }
             else
             {
                 BLL.ShowMessage(this, "No Records to Display");
                 rg_Attendence.DataSource = dt_Details;
                 rg_Attendence.DataBind();
                 rg_Attendence.Visible = true;
             }
         }
         else
         {
             BLL.ShowMessage(this, "Select Period Element!");
             rg_Attendence.DataSource = null;
             rg_Attendence.DataBind();
             rg_Attendence.Visible = false;
             return;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "EmpTransDetails", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
         return;
     }
 }
Ejemplo n.º 2
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            bool selected                = false;
            int  records_saved           = 0;
            SMHR_EMPLOYEETRANSACTION obj = new SMHR_EMPLOYEETRANSACTION();
            obj.EMPBNKTRN_BU_ID       = Convert.ToInt32(rcmb_AttPeriod.SelectedItem.Value);
            obj.EMPBNKTRN_PRDDTL_ID   = Convert.ToInt32(rcmb_AttPeriodElement.SelectedItem.Value);
            obj.CREATEDBY             = Convert.ToInt32(Session["USER_ID"]);
            obj.CREATEDDATE           = DateTime.Now;
            obj.EMPBNKTRN_ORG_ID      = Convert.ToInt32(Session["org_id"]);
            obj.EMPBNKTRN_PERIOD_ID   = Convert.ToInt32(rcmb_AttPeriod.SelectedItem.Value);
            obj.EMPBNKTRN_TRAN_STATUS = Convert.ToInt32(rcmb_AttPeriod.SelectedItem.Value);

            for (int k = 0; k < rg_Attendence.Items.Count; k++)
            {
                CheckBox chk = rg_Attendence.Items[k].FindControl("chckbtn_Select") as CheckBox;
                if (chk.Checked)
                {
                    selected = true;
                    //Label lbl_emp_id = rg_Attendence.Items[k].FindControl("EMP_ID") as Label;
                    Label             lbl_emp_id  = rg_Attendence.Items[k].FindControl("lbl_Empid") as Label;
                    Label             lbl_bank_id = rg_Attendence.Items[k].FindControl("lbl_Bankid") as Label;
                    RadNumericTextBox rnt         = new Telerik.Web.UI.RadNumericTextBox();
                    rnt = rg_Attendence.Items[k].FindControl("RadNumericTextBox1") as RadNumericTextBox;
                    obj.EMPBNKTRN_AMOUNT       = Convert.ToDouble(rnt.Value);
                    obj.EMPBNKTRN_BANK_DTLS_ID = Convert.ToInt32(lbl_bank_id.Text);
                    obj.EMPBNKTRN_EMP_ID       = Convert.ToInt32(lbl_emp_id.Text);
                    obj.OPERATION = operation.Check;
                    //if (Convert.ToString(BLL.check_EmpTrans(obj).Rows[0]["Count"]) != "0")
                    DataTable dt_Exist = BLL.check_EmpTrans(obj);
                    if (dt_Exist.Rows[0][0].ToString() != "0")
                    {
                        BLL.ShowMessage(this, "Employee with this combination Already Exists");
                        return;
                    }
                    obj.OPERATION = operation.Insert;
                    if (BLL.set_EmpTrans(obj))
                    {
                        records_saved += 1;
                    }
                    //multiple times same message will be displayed
                    //    BLL.ShowMessage(this, "Information Saved Successfully");
                    //else
                    //    BLL.ShowMessage(this, "Information Not Saved");
                }
            }
            if (!selected)
            {
                BLL.ShowMessage(this, "Select Atleast One Employee");
                return;
            }
            else
            {
                BLL.ShowMessage(this, "Total Records Saved Are:" + records_saved);
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "EmpTransDetails", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
            return;
        }
    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            bool selected                = false;
            int  records_saved           = 0;
            SMHR_EMPLOYEETRANSACTION obj = new SMHR_EMPLOYEETRANSACTION();
            obj.EMPBNKTRN_BU_ID       = Convert.ToInt32(rcmb_AttBusinessUnit.SelectedItem.Value);
            obj.EMPBNKTRN_PRDDTL_ID   = Convert.ToInt32(rcmb_AttPeriodElement.SelectedItem.Value);
            obj.CREATEDBY             = Convert.ToInt32(Session["USER_ID"]);
            obj.CREATEDDATE           = DateTime.Now;
            obj.EMPBNKTRN_ORG_ID      = Convert.ToInt32(Session["org_id"]);
            obj.EMPBNKTRN_PERIOD_ID   = Convert.ToInt32(rcmb_AttPeriod.SelectedItem.Value);
            obj.EMPBNKTRN_TRAN_STATUS = Convert.ToInt32(rcmb_AttPeriod.SelectedItem.Value);

            for (int k = 0; k < rg_Attendence.Items.Count; k++)
            {
                CheckBox chk = rg_Attendence.Items[k].FindControl("chckbtn_Select") as CheckBox;
                if (chk.Checked)
                {
                    selected = true;
                    //Label lbl_emp_id = rg_Attendence.Items[k].FindControl("EMP_ID") as Label;
                    Label             lbl_emp_id  = rg_Attendence.Items[k].FindControl("lbl_Empid") as Label;
                    Label             lbl_bank_id = rg_Attendence.Items[k].FindControl("lbl_Bankid") as Label;
                    RadNumericTextBox rnt         = new Telerik.Web.UI.RadNumericTextBox();
                    rnt = rg_Attendence.Items[k].FindControl("RadNumericTextBox1") as RadNumericTextBox;
                    obj.EMPBNKTRN_AMOUNT       = Convert.ToDouble(rnt.Value);
                    obj.EMPBNKTRN_BANK_DTLS_ID = Convert.ToInt32(lbl_bank_id.Text);
                    obj.EMPBNKTRN_EMP_ID       = Convert.ToInt32(lbl_emp_id.Text);
                    obj.OPERATION = operation.Check;
                    //if (Convert.ToString(BLL.check_EmpTrans(obj).Rows[0]["Count"]) != "0")
                    DataTable dt_Exist = BLL.check_EmpTrans(obj);
                    if (dt_Exist.Rows[0][0].ToString() != "0")
                    {
                        BLL.ShowMessage(this, "Employee with this combination Already Exists");
                        return;
                    }
                    _obj_smhr_payroll                 = new SMHR_PAYROLL();
                    _obj_smhr_payroll.MODE            = 33;
                    _obj_smhr_payroll.BUID            = Convert.ToInt32(rcmb_AttBusinessUnit.SelectedItem.Value);
                    _obj_smhr_payroll.EMP_ID          = Convert.ToInt32(lbl_emp_id.Text);
                    _obj_smhr_payroll.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                    _obj_smhr_payroll.PERIODDTLID     = Convert.ToInt32(rcmb_AttPeriodElement.SelectedItem.Value);
                    _obj_smhr_payroll.PERODID         = Convert.ToInt32(rcmb_AttPeriod.SelectedItem.Value);
                    DataTable dtPayrollCheck = BLL.get_PayDetails(_obj_smhr_payroll);
                    if (Convert.ToString(dtPayrollCheck.Rows[0]["COUNT"]) != "0")
                    {
                        BLL.ShowMessage(this, "Payroll has not been approved yet");
                    }
                    else
                    {
                        _obj_smhr_payroll.MODE = 34;
                        DataTable dtPayroll = BLL.get_PayDetails(_obj_smhr_payroll);
                        if (Convert.ToString(dtPayroll.Rows[0]["COUNT"]) != "0")
                        {
                            obj.OPERATION = operation.Insert;
                            if (BLL.set_EmpTrans(obj))
                            {
                                records_saved += 1;
                            }
                        }
                        else
                        {
                            BLL.ShowMessage(this, "Payroll has not been processed for this month");
                        }
                    }
                    //obj.OPERATION = operation.Insert;
                    //if (BLL.set_EmpTrans(obj))
                    //    records_saved += 1;
                    //multiple times same message will be displayed
                    //    BLL.ShowMessage(this, "Information Saved Successfully");
                    //else
                    //    BLL.ShowMessage(this, "Information Not Saved");
                }
            }
            if (!selected)
            {
                BLL.ShowMessage(this, "Select Atleast One Employee");
                return;
            }
            else
            {
                BLL.ShowMessage(this, "Total Records Saved Are:" + records_saved);
                SMHR_EMPLOYEETRANSACTION _obj_smhr_emptrans = new SMHR_EMPLOYEETRANSACTION();
                _obj_smhr_emptrans.EMPBNKTRN_BU_ID     = Convert.ToInt32(rcmb_AttBusinessUnit.SelectedValue);
                _obj_smhr_emptrans.EMPBNKTRN_ORG_ID    = Convert.ToInt32(Session["ORG_ID"]);
                _obj_smhr_emptrans.EMPBNKTRN_PERIOD_ID = Convert.ToInt32(rcmb_AttPeriod.SelectedValue);
                _obj_smhr_emptrans.EMPBNKTRN_PRDDTL_ID = Convert.ToInt32(rcmb_AttPeriodElement.SelectedValue);
                _obj_smhr_emptrans.OPERATION           = operation.Select;
                DataTable dt_Details = BLL.get_EmpTrans(_obj_smhr_emptrans);
                if (dt_Details.Rows.Count != 0)
                {
                    rg_Attendence.DataSource = dt_Details;
                    rg_Attendence.DataBind();
                    rg_Attendence.Visible = true;
                    for (int index = 0; index < rg_Attendence.Items.Count; index++)
                    {
                        if (rg_Attendence.Items[index]["STATUS"].Text == "1")
                        {
                            rg_Attendence.Items[index].Enabled = false;
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "EmpTransDetails", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
            return;
        }
    }