Ejemplo n.º 1
0
    private List <t_Data_Raw_Indexes> GetIndexes()
    {
        List <t_Data_Raw_Indexes> list = new List <t_Data_Raw_Indexes>();

        foreach (Telerik.Web.UI.GridItem row in grv.Items)
        {
            Telerik.Web.UI.RadTextBox        TextBoxDescription   = row.FindControl("txtDescription") as Telerik.Web.UI.RadTextBox;
            Telerik.Web.UI.RadDatePicker     DatePicker           = row.FindControl("dtmTimeStamp") as Telerik.Web.UI.RadDatePicker;
            Telerik.Web.UI.RadNumericTextBox NummericTextBoxIndex = row.FindControl("nmrIndex") as Telerik.Web.UI.RadNumericTextBox;
            t_Data_Raw_Indexes data = new t_Data_Raw_Indexes();
            if (NummericTextBoxIndex.Value != null && DatePicker.SelectedDate != null)
            {
                data.Description = TextBoxDescription.Text;
                data.Index       = (double)NummericTextBoxIndex.Value;
                data.TimeStamp   = (DateTime)DatePicker.SelectedDate;
                data.SiteId      = cboSites.SelectedValue;
                list.Add(data);
            }
        }
        return(list);
    }
Ejemplo n.º 2
0
        private void SaveBulkValues()
        {
            int i = 0;

            LastFrequencyMetric = GetData();
            List <Bll.MetricValue.Extend>   NewValues = new List <MetricValue.Extend>();
            List <Bll.MetricValue.Extend>   OldValues = new List <MetricValue.Extend>();
            List <Bll.MetricOrgLocationUoM> MetricOrgLocationUoMList = new List <Bll.MetricOrgLocationUoM>();

            foreach (RepeaterItem ri in rMetric.Items)
            {
                MetricOrgValue mov   = LastFrequencyMetric.Metrics[i];
                DateTime       iTime = DateTime.Now;
                DropDownList   ddlInputUnitOfMeasure = (DropDownList)ri.FindControl("ddlInputUnitOfMeasure");
                HiddenField    hfUoM         = (HiddenField)ri.FindControl("hfUoM");
                HiddenField    hfMetric      = (HiddenField)ri.FindControl("hfMetric");
                HiddenField    hfOrgLocation = (HiddenField)ri.FindControl("hfOrgLocation");
                Repeater       r             = (Repeater)ri.FindControl("rMericValue");

                Guid?ActualUoMID = null;
                if (ddlInputUnitOfMeasure.Visible)
                {
                    if (!String.IsNullOrEmpty(ddlInputUnitOfMeasure.SelectedValue))
                    {
                        ActualUoMID = new Guid(ddlInputUnitOfMeasure.SelectedValue);
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(hfUoM.Value))
                    {
                        ActualUoMID = new Guid(hfUoM.Value);
                    }
                }
                Guid oMetricID      = new Guid(hfMetric.Value);
                Guid oOrgLocationID = new Guid(hfOrgLocation.Value);

                Bll.MetricOrgLocationUoM muom = new Bll.MetricOrgLocationUoM();
                muom.MetricID             = oMetricID;
                muom.OrgLocationID        = oOrgLocationID;
                muom.InputUnitOfMeasureID = ActualUoMID;
                MetricOrgLocationUoMList.Add(muom);

                int j = 0;
                foreach (RepeaterItem rri in r.Items)
                {
                    DateTime    jTime  = DateTime.Now;
                    HiddenField hfDate = (HiddenField)rri.FindControl("hfDate");
                    DateTime    oDate  = DateTime.Parse(hfDate.Value);
                    Telerik.Web.UI.RadNumericTextBox       rntValue          = (Telerik.Web.UI.RadNumericTextBox)rri.FindControl("rntValue");
                    System.Web.UI.WebControls.TextBox      tbValue           = (System.Web.UI.WebControls.TextBox)rri.FindControl("tbValue");
                    System.Web.UI.WebControls.CheckBox     chbValue          = (System.Web.UI.WebControls.CheckBox)rri.FindControl("chbValue");
                    Telerik.Web.UI.RadDatePicker           rdpDateValue      = (Telerik.Web.UI.RadDatePicker)rri.FindControl("rdpDateValue");
                    System.Web.UI.WebControls.DropDownList ddlApprovalStatus = (System.Web.UI.WebControls.DropDownList)rri.FindControl("ddlApprovalStatus");

                    Bll.MetricValue.Extend OldMetricValue = mov.MetricValues[j];
                    string Value = String.Empty;
                    if (rntValue.Visible)
                    {
                        Value = rntValue.Value.ToString();
                    }
                    else
                    if (tbValue.Visible)
                    {
                        Value = tbValue.Text;
                    }
                    else
                    if (chbValue.Visible)
                    {
                        Value = chbValue.Checked ? bool.TrueString : bool.FalseString;
                    }
                    else
                    if (rdpDateValue.Visible)
                    {
                        Value = rdpDateValue.SelectedDate.ToString();
                    }

                    bool?Approved = OldMetricValue.Approved;
                    if (DataMode == Mode.Approve)
                    {
                        switch (ddlApprovalStatus.SelectedValue)
                        {
                        case "":
                            Approved = null;
                            break;

                        case "True":
                            Approved = true;
                            break;

                        case "False":
                        default:
                            Approved = false;
                            break;
                        }
                    }

                    if (
                        (
                            (
                                !String.IsNullOrEmpty(Value)
                                ||
                                (OldMetricValue.MetricValueID != Guid.Empty && String.IsNullOrEmpty(Value))
                            ) &&
                            Value != OldMetricValue.Value
                        )
                        ||
                        (DataMode == Mode.Approve && Approved != OldMetricValue.Approved))
                    {
                        MetricValue.Extend nv = new MetricValue.Extend();
                        nv.MetricID             = oMetricID;
                        nv.Date                 = oDate;
                        nv.OrgLocationID        = oOrgLocationID;
                        nv.InputUnitOfMeasureID = ActualUoMID;
                        nv.Value                = Value;
                        nv.Approved             = Approved;
                        // additional fields
                        nv.Period              = Frequency.GetPeriodName(oDate, FrequencyID);
                        nv.MetricName          = mov.Name;
                        nv.OrgLocationFullName = mov.OrgLocationFullName;
                        nv.Notes = OldMetricValue.Notes;
                        nv.ValueInputUnitOfMeasureName = mov.OrgLocationUnitOfMeasureName;
                        NewValues.Add(nv);

                        OldValues.Add(OldMetricValue);
                    }
                    LogTime += "    value " + j.ToString() + " time  " + ((TimeSpan)(DateTime.Now - jTime)).TotalMilliseconds;
                    j++;
                }
                LogTime += "Row " + i.ToString() + " time  " + ((TimeSpan)(DateTime.Now - iTime)).TotalMilliseconds + "<br />";
                i++;
            }
            Bll.MetricValue.SaveBulkValues(MetricOrgLocationUoMList, NewValues, OldValues, Micajah.Common.Security.UserContext.Current, DataMode == Mode.Input);
        }
Ejemplo n.º 3
0
        protected void rpMetricValue_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType < ListItemType.Item || e.Item.ItemType > ListItemType.EditItem)
            {
                return;
            }
            MetricTrac.Bll.MetricValue.Extend      MVS               = (MetricTrac.Bll.MetricValue.Extend)e.Item.DataItem;
            Telerik.Web.UI.RadNumericTextBox       rntValue          = (Telerik.Web.UI.RadNumericTextBox)e.Item.FindControl("rntValue");
            System.Web.UI.WebControls.TextBox      tbValue           = (System.Web.UI.WebControls.TextBox)e.Item.FindControl("tbValue");
            System.Web.UI.WebControls.CheckBox     chbValue          = (System.Web.UI.WebControls.CheckBox)e.Item.FindControl("chbValue");
            Telerik.Web.UI.RadDatePicker           rdpDateValue      = (Telerik.Web.UI.RadDatePicker)e.Item.FindControl("rdpDateValue");
            System.Web.UI.WebControls.DropDownList ddlApprovalStatus = (System.Web.UI.WebControls.DropDownList)e.Item.FindControl("ddlApprovalStatus");
            ddlApprovalStatus.Attributes.Add("onchange", "valueChanged();return false;");
            if ((DataMode == Mode.Approve) && (MVS.Value != null))
            {
                ListsStringArray += ddlApprovalStatus.ClientID + "|";
            }
            bool IsDataTypeChanged = false;
            bool IsNewRecord       = false;

            if (MVS.MetricValueID == Guid.Empty)
            {
                IsNewRecord = true;
            }
            else
            if (MVS.MetricDataTypeID != MVS.ActualMetricDataTypeID)
            {
                IsDataTypeChanged = true;
            }
            switch (LastMetricMetricValue.MetricDataTypeID)
            {
            case 2:    //Text
                tbValue.Visible  = true;
                rntValue.Visible = chbValue.Visible = rdpDateValue.Visible = false;
                tbValue.Text     = String.Empty;
                if (!IsDataTypeChanged)
                {
                    tbValue.Text = MVS.Value;
                }
                break;

            case 3:    //Bool - checkbox
                chbValue.Visible = true;
                rntValue.Visible = tbValue.Visible = rdpDateValue.Visible = false;
                chbValue.Checked = false;
                if (!IsDataTypeChanged)
                {
                    chbValue.Checked = MVS.Value == bool.TrueString;
                }
                break;

            case 4:    //Date
                rdpDateValue.Visible      = true;
                rntValue.Visible          = tbValue.Visible = chbValue.Visible = false;
                rdpDateValue.SelectedDate = DateTime.Now;
                DateTime _dt = DateTime.Now;
                if (!IsDataTypeChanged)
                {
                    if (DateTime.TryParse(MVS.Value, out _dt))
                    {
                        rdpDateValue.SelectedDate = _dt;
                    }
                }
                break;

            case 1:    //Numeric
            default:
                rntValue.Visible  = true;
                rntValue.ReadOnly = LastMetricMetricValue.MetricTypeID > 1;
                tbValue.Visible   = chbValue.Visible = rdpDateValue.Visible = false;
                rntValue.Text     = String.Empty;
                if ((!IsDataTypeChanged) && ((MVS.UnitOfMeasureID == MVS.MetricUnitOfMeasureID) || IsNewRecord))
                {
                    double _Value = double.NaN;
                    if (double.TryParse(MVS.Value, out _Value))
                    {
                        rntValue.Value = _Value;
                    }
                }

                // Range label
                if ((MVS.NOMinValue != null) || (MVS.NOMaxValue != null) || (MVS.NODecPlaces != null))
                {
                    int defPlaces = 2;
                    if (MVS.NODecPlaces != null)
                    {
                        rntValue.NumberFormat.DecimalDigits = (int)MVS.NODecPlaces;
                        defPlaces = (int)MVS.NODecPlaces;
                    }
                    if (MVS.NOMinValue != null)
                    {
                        rntValue.MinValue = decimal.ToDouble((decimal)MVS.NOMinValue);
                    }
                    if (MVS.NOMaxValue != null)
                    {
                        rntValue.MaxValue = decimal.ToDouble((decimal)MVS.NOMaxValue);
                    }
                }
                break;
            }
        }
Ejemplo n.º 4
0
    private void DisableControl(Control objC)
    {
        try
        {
            if (objC is Telerik.Web.UI.RadTextBox)
            {
                Telerik.Web.UI.RadTextBox obj = (Telerik.Web.UI.RadTextBox)objC;
                obj.ReadOnly = true;
            }

            if (objC is Telerik.Web.UI.RadComboBox)
            {
                Telerik.Web.UI.RadComboBox obj = (Telerik.Web.UI.RadComboBox)objC;
                obj.Enabled   = false;
                obj.BackColor = Color.White;
                obj.ForeColor = Color.Black;
            }

            if (objC is Telerik.Web.UI.RadNumericTextBox)
            {
                Telerik.Web.UI.RadNumericTextBox obj = (Telerik.Web.UI.RadNumericTextBox)objC;
                obj.ReadOnly = true;
            }

            if (objC is Telerik.Web.UI.RadDatePicker)
            {
                Telerik.Web.UI.RadDatePicker obj = (Telerik.Web.UI.RadDatePicker)objC;
                obj.Enabled = false;
            }

            if (objC is Telerik.Web.UI.DatePickingCalendar)
            {
                Telerik.Web.UI.DatePickingCalendar obj = (Telerik.Web.UI.DatePickingCalendar)objC;
                obj.Enabled = false;
            }

            if (objC is System.Web.UI.WebControls.RadioButtonList)
            {
                System.Web.UI.WebControls.RadioButtonList obj = (System.Web.UI.WebControls.RadioButtonList)objC;
                obj.Enabled = false;
            }

            if (objC is System.Web.UI.WebControls.TextBox)
            {
                System.Web.UI.WebControls.TextBox obj = (System.Web.UI.WebControls.TextBox)objC;
                obj.ReadOnly = true;
            }

            if (objC is Telerik.Web.UI.RadUpload)
            {
                Telerik.Web.UI.RadUpload obj = (Telerik.Web.UI.RadUpload)objC;
                obj.Enabled = false;
            }

            if (objC is Telerik.Web.UI.RadButton)
            {
                Telerik.Web.UI.RadButton obj = (Telerik.Web.UI.RadButton)objC;
                obj.ReadOnly = true;
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
Ejemplo n.º 5
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 btnapprove_Click(object sender, EventArgs e)
    {
        try
        {
            int count = 0;
            _OBJ_BONUS_TRANS = new smhr_Bonus_trans();
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ID       = Convert.ToInt32(rtxt_period.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_BU_ID           = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
            _OBJ_BONUS_TRANS.ORGANISATION_ID       = Convert.ToInt32(Session["ORG_ID"]);
            _OBJ_BONUS_TRANS.MODIFIED_BY           = Convert.ToInt32(Session["USER_ID"]);
            _OBJ_BONUS_TRANS.MODIFIED_DATE         = DateTime.Now;
            for (int k = 0; k < rg_bonusapprove.Items.Count; k++)
            {
                CheckBox          chk                  = rg_bonusapprove.Items[k].FindControl("chckbtn_Select") as CheckBox;
                Label             lbl_bonus_id         = rg_bonusapprove.Items[k].FindControl("lbl_bonus_id") as Label;
                RadNumericTextBox rnt                  = new Telerik.Web.UI.RadNumericTextBox();
                RadNumericTextBox rnt_bonus_value      = new Telerik.Web.UI.RadNumericTextBox();
                RadNumericTextBox rnt_bonus_totalvalue = new Telerik.Web.UI.RadNumericTextBox();
                RadNumericTextBox rnt_bonus_exgratia   = new Telerik.Web.UI.RadNumericTextBox();
                rnt                             = rg_bonusapprove.Items[k].FindControl("rtxt_bonuspercentage") as RadNumericTextBox;
                rnt_bonus_value                 = rg_bonusapprove.Items[k].FindControl("rtxt_bonusvalue") as RadNumericTextBox;
                rnt_bonus_totalvalue            = rg_bonusapprove.Items[k].FindControl("rtxt_bonus") as RadNumericTextBox;
                rnt_bonus_exgratia              = rg_bonusapprove.Items[k].FindControl("rtxt_exgratia") as RadNumericTextBox;
                _OBJ_BONUS_TRANS.Bonus_trans_ID = Convert.ToInt32(lbl_bonus_id.Text);
                if (rnt.Text != string.Empty)
                {
                    _OBJ_BONUS_TRANS.Bonus_Percentage = Convert.ToDecimal(rnt.Text);
                }
                else
                {
                    DataTable Dt_balance = new DataTable();
                    Dt_balance = ViewState["MINMAX"] as DataTable;
                    _OBJ_BONUS_TRANS.Bonus_Percentage = Convert.ToDecimal(Dt_balance.Rows[0]["MINIMUM_BONUS_PERCENTAGE"]);
                }
                if (rnt_bonus_value.Text != string.Empty)
                {
                    _OBJ_BONUS_TRANS.BONUS_BONUSVALUE = Convert.ToDecimal(rnt_bonus_value.Text);
                    _OBJ_BONUS_TRANS.BONUS_TOTALVALUE = Convert.ToDecimal(rnt_bonus_totalvalue.Text);
                    _OBJ_BONUS_TRANS.BONUS_EXGRATIA   = Convert.ToDecimal(rnt_bonus_exgratia.Text);
                }
                else
                {
                    //_OBJ_BONUS_TRANS.BONUS_BONUSVALUE = 0;
                    return;
                }

                _OBJ_BONUS_TRANS.Bonus_Trans_checked = Convert.ToBoolean(chk.Checked);
                if (chk.Checked)
                {
                    _OBJ_BONUS_TRANS.OPERATION         = operation.Approve;
                    _OBJ_BONUS_TRANS.BONUS_COMMIT      = 1;
                    _OBJ_BONUS_TRANS.BONUS_FINALCOMMIT = 1;
                    count++;
                }
                else
                {
                    _OBJ_BONUS_TRANS.OPERATION         = operation.Approve;
                    _OBJ_BONUS_TRANS.BONUS_COMMIT      = 1;
                    _OBJ_BONUS_TRANS.BONUS_FINALCOMMIT = 0;
                }
                BLL.bonus_trans_insrt(_OBJ_BONUS_TRANS);
            }

            SMHR_BONUSMASTER1 _obj_bm = new SMHR_BONUSMASTER1();
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ID       = Convert.ToInt32(rtxt_period.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
            _OBJ_BONUS_TRANS.BONUS_BU_ID           = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
            _OBJ_BONUS_TRANS.OPERATION             = operation.Empty1;
            DataTable dt_details_sub = BLL.Get_SMHR_BONUS_TRANS1(_OBJ_BONUS_TRANS);
            ViewState["BONUS_TRANS"] = dt_details_sub;
            if (dt_details_sub.Rows.Count > 0)
            {
                btn_approve.Visible = true;
                btn_reject.Visible  = true;
            }
            else
            {
                btn_approve.Visible = false;
                btn_reject.Visible  = false;
            }
            rg_bonusapprove.DataSource = dt_details_sub;
            rg_bonusapprove.DataBind();
            _obj_smhr_bonusmaster.OPERATION       = operation.Select;
            _obj_smhr_bonusmaster.BUSINESSUNIT    = Convert.ToInt32(rtxt_businessunit.SelectedItem.Value);
            _obj_smhr_bonusmaster.PERIOD          = Convert.ToInt32(rtxt_period.SelectedItem.Value);
            _obj_smhr_bonusmaster.PERIOD_ELEMENTS = Convert.ToInt32(rcmb_periodelements.SelectedItem.Value);
            if (count != 0)
            {
                BLL.ShowMessage(this, "Approved Successfully");
            }
            else
            {
                BLL.ShowMessage(this, "Select Employee To Approve");
            }
            return;
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_bonustransactionApproval", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    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;
        }
    }