//protected void radCourse_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 //{
 //    if (string.Compare(radCourse.SelectedItem.Text, "Select", true) != 0)
 //    {
 //        BindBatches();
 //        RG_TrainingApproval.Visible = true;
 //    }
 //}
 private void BindBatches()
 {
     try
     {
         SMHR_TRAINING_REQUST _obj_Smhr_TrgRqst = new SMHR_TRAINING_REQUST();
         _obj_Smhr_TrgRqst.OPERATION = operation.Get;
         //_obj_Smhr_TrgRqst.TRAINING_COURSEID = Convert.ToInt32(radCourse.SelectedValue);
         _obj_Smhr_TrgRqst.TRAINING_APPROVEDBY = Convert.ToInt32(Session["EMP_ID"]);
         _obj_Smhr_TrgRqst.ORGANISATION_ID     = Convert.ToInt32(Session["ORG_ID"]);//YYY
         DataTable DT = BLL.get_TrainigRequest(_obj_Smhr_TrgRqst);
         if (DT.Rows.Count != 0)
         {
             RG_TrainingApproval.DataSource = DT;
             RG_TrainingApproval.DataBind();
         }
         else
         {
             DataTable DT1 = new DataTable();
             RG_TrainingApproval.DataSource = DT1;
             RG_TrainingApproval.DataBind();
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TrainingApproval", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
 /// <summary>
 /// loading trgs under login user
 /// </summary>
 private void LoadData()
 {
     try
     {
         SMHR_TRAININGREQUEST _obj_Smhr_TrgRqst = new SMHR_TRAININGREQUEST();
         _obj_Smhr_TrgRqst.Mode        = 8;
         _obj_Smhr_TrgRqst.TR_RAISEDBY = Convert.ToInt32(Session["emp_id"]);
         _obj_Smhr_TrgRqst.TR_ORG_ID   = Convert.ToInt32(Session["org_id"]);//YYY
         DataTable DT = BLL.get_TrgRqst(_obj_Smhr_TrgRqst);
         if (DT.Rows.Count != 0)
         {
             RG_TrainingApproval.DataSource = DT;
             RG_TrainingApproval.DataBind();
         }
         else
         {
             DataTable DT1 = new DataTable();
             RG_TrainingApproval.DataSource = DT1;
             RG_TrainingApproval.DataBind();
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TrainingApproval", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void rc_FinalicalPeriod_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        try
        {
            if (rc_financialPeriod.SelectedIndex > 0)
            {
                RG_TrainingApproval.Visible = true;
                btn_submit.Visible          = true;
                btn_Cancel.Visible          = true;
                SMHR_PAYITEMS _obj_Smhr_PayItems = new SMHR_PAYITEMS();
                _obj_Smhr_PayItems.OPERATION           = operation.Check2;
                _obj_Smhr_PayItems.ORGANISATION_ID     = Convert.ToInt32(Session["ORG_ID"]);
                _obj_Smhr_PayItems.PAYITEM_FINPERIODID = Convert.ToInt32(rc_financialPeriod.SelectedValue);
                DataTable dt = BLL.get_PayItems(_obj_Smhr_PayItems);

                RG_TrainingApproval.DataSource = dt;
                RG_TrainingApproval.DataBind();

                RadComboBox rc_LoanProcessType;

                for (int i = 0; i < RG_TrainingApproval.Items.Count; i++)
                {
                    rc_LoanProcessType = RG_TrainingApproval.Items[i].FindControl("rc_LoanProcessType") as RadComboBox;
                    //rc_LoanProcessType.SelectedValue = Convert.ToString(dt.Rows[i]["LOANSETUP_LOANPROCESSTYPE"]);
                    rc_LoanProcessType.SelectedIndex = rc_LoanProcessType.Items.FindItemIndexByText(Convert.ToString(dt.Rows[i]["LOANSETUP_LOANPROCESSTYPE"]));
                }

                SMHR_PERIOD osmhr_period = new SMHR_PERIOD();
                osmhr_period.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                osmhr_period.PERIOD_ID       = Convert.ToInt32(rc_financialPeriod.SelectedValue);
                DataTable dtCurrentFinPeriod = BLL.IscurrentFinPeriod(osmhr_period);

                if (string.Compare(dtCurrentFinPeriod.Rows[0]["ISEXISTS"].ToString(), "0", true) == 0)
                {
                    RG_TrainingApproval.Enabled = false;
                    btn_submit.Visible          = false;
                    btn_Cancel.Visible          = false;
                }
                else
                {
                    RG_TrainingApproval.Enabled = true;
                    btn_submit.Visible          = true;
                    btn_Cancel.Visible          = true;
                }
            }
            else
            {
                RG_TrainingApproval.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("'", "''"), "frm_LoanSetup", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Exemplo n.º 4
0
 protected void rc_ServiceProvider_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     try
     {
         btn_Cancel.Visible = true;
         btn_submit.Visible = true;
         if (rc_type.SelectedValue == "Service Provider")
         {
             rc_Trainer.Enabled = false;
         }
         else
         {
             rc_Trainer.Enabled = true;
             SMHR_FEEDBACK_RATING _obj_smhr_Trainer = new SMHR_FEEDBACK_RATING();
             //SMHR_TRAINERPROFILE _obj_smhr_Trainer = new SMHR_TRAINERPROFILE();
             _obj_smhr_Trainer.OPERATION              = operation.Select1;
             _obj_smhr_Trainer.RATING_ORGID           = Convert.ToInt32(Session["ORG_ID"]);
             _obj_smhr_Trainer.RATING_SERVICEPROVIDER = Convert.ToInt32(rc_ServiceProvider.SelectedValue);
             DataTable Dt = BLL.get_Rating(_obj_smhr_Trainer);
             rc_Trainer.DataSource     = Dt;
             rc_Trainer.DataValueField = "Trainer_TrainerProfile_id";
             rc_Trainer.DataTextField  = "Trainer_Name";
             rc_Trainer.DataBind();
             rc_Trainer.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1"));
         }
         RG_TrainingApproval.Visible = true;
         SMHR_TRAINING_FEEDBACKQUESTION _obj_FeedBack = new SMHR_TRAINING_FEEDBACKQUESTION();
         _obj_FeedBack.OPERATION = operation.Select1;
         _obj_FeedBack.FEEDBACKQUESTION_ORGID = Convert.ToInt32(Session["ORG_ID"]);
         _obj_FeedBack.FEEDBACKQUESTION_TYPE  = Convert.ToString(rc_type.SelectedValue);
         DataTable DT = BLL.get_FeedbackQuestion(_obj_FeedBack);
         if (DT.Rows.Count != 0)
         {
             RG_TrainingApproval.DataSource = DT;
             RG_TrainingApproval.DataBind();
         }
         else
         {
             RG_TrainingApproval.DataSource = DT;
             RG_TrainingApproval.DataBind();
             btn_submit.Visible = false;
         }
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_RatingFeedbackQuestions", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
    protected void rc_Days_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        try
        {
            Btn_cancel.Visible          = true;
            btn_submit.Visible          = true;
            RG_TrainingApproval.Visible = true;

            try
            {
                SMHR_TRAINING_REQUST _obj_Smhr_TrgRqst = new SMHR_TRAINING_REQUST();
                _obj_Smhr_TrgRqst.OPERATION                = operation.Select2;
                _obj_Smhr_TrgRqst.ORGANISATION_ID          = Convert.ToInt32(Session["ORG_ID"]);
                _obj_Smhr_TrgRqst.TRAINING_BATCHID         = Convert.ToInt32(rc_CourseSchedule.SelectedValue);
                _obj_Smhr_TrgRqst.TRAINING_ATTENDANCE_DAYS = Convert.ToInt32(rc_Days.SelectedValue);
                DataTable DT = BLL.get_TrainigRequest(_obj_Smhr_TrgRqst);
                if (DT.Rows.Count != 0)
                {
                    RG_TrainingApproval.DataSource = DT;
                }

                else
                {
                    DataTable dt1 = new DataTable();
                    RG_TrainingApproval.DataSource = dt1;
                }
                RG_TrainingApproval.DataBind();
            }
            catch (Exception ex)
            {
                SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Course", ex.StackTrace, DateTime.Now);
                Response.Redirect("~/Frm_ErrorPage.aspx");
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_AttendanceDetails", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Approve_Click(object sender, EventArgs e)
    {
        try
        {
            CheckBox chkBox = new CheckBox();
            Label    lblID  = new Label();
            string   str    = "";
            bool     status = false;
            for (int index = 0; index <= RG_TrainingApproval.Items.Count - 1; index++)
            {
                chkBox = RG_TrainingApproval.Items[index].FindControl("chk_Choose") as CheckBox;

                lblID = RG_TrainingApproval.Items[index].FindControl("lbltrgID") as Label;
                if (chkBox.Checked)
                {
                    if (str == "")
                    {
                        str = "" + lblID.Text + "";
                    }
                    else
                    {
                        str = str + "," + lblID.Text + "";
                    }

                    SMHR_TRAININGREQUEST _obj_Smhr_TrgRqst = new SMHR_TRAININGREQUEST();

                    _obj_Smhr_TrgRqst.Mode          = 9;
                    _obj_Smhr_TrgRqst.TR_ID         = Convert.ToInt32(lblID.Text);
                    _obj_Smhr_TrgRqst.TR_APPROVEDBY = Convert.ToInt32(Session["emp_id"]);
                    _obj_Smhr_TrgRqst.TR_STATUS     = "Approved";
                    status = BLL.set_TrgRqst(_obj_Smhr_TrgRqst);
                }
            }

            if (string.IsNullOrEmpty(str))
            {
                BLL.ShowMessage(this, "Please Select Training");
                return;
            }


            if (status == true)
            {
                SMHR_TRAININGREQUEST _obj_Smhr_TrgRqst = new SMHR_TRAININGREQUEST();
                _obj_Smhr_TrgRqst.TR_ID = Convert.ToInt32(lblID.Text);
                _obj_Smhr_TrgRqst.Mode  = 13;
                DataTable dt_ger_tr = BLL.get_TrgRqst(_obj_Smhr_TrgRqst);
                if (dt_ger_tr.Rows.Count != 0)
                {
                    for (int i = 0; i < dt_ger_tr.Rows.Count; i++)
                    {
                        if (dt_ger_tr.Rows[i]["LOGIN_EMAILID"] != System.DBNull.Value)
                        {
                            Dal.ExecuteNonQuery("EXEC USP_SEND_EMAIL_TRAINING @LOGIN_EMAILID='" + Convert.ToString(dt_ger_tr.Rows[i]["LOGIN_EMAILID"]) + "',@RAISEDBY='" + Convert.ToString(dt_ger_tr.Rows[i]["RAISEDBY"]) + "',@APPROVEDBY='" + Convert.ToString(dt_ger_tr.Rows[i]["APPROVEDBY"]) + "',@TR_TITLE='" + Convert.ToString(dt_ger_tr.Rows[i]["TR_TITLE"]) + "'");
                        }
                    }
                }


                SMHR_TRAINER _obj_Smhr_Trner = new SMHR_TRAINER();
                _obj_Smhr_Trner.TRAINERDETAILS_TR_ID = Convert.ToInt32(lblID.Text);
                _obj_Smhr_Trner.Mode = 18;
                _obj_Smhr_Trner.TRAINERDETAILS_ORG_ID = Convert.ToInt32(Session["ORG_ID"]);
                DataTable dttrgexist = BLL.get_TRAINer(_obj_Smhr_Trner);

                if (dttrgexist.Rows.Count != 0)
                {
                    if (Convert.ToInt32(dttrgexist.Rows[0]["TRAINERDETAILS_EMPLOYEEID"]) != 0)
                    {
                        _obj_Smhr_TrgRqst       = new SMHR_TRAININGREQUEST();
                        _obj_Smhr_TrgRqst.TR_ID = Convert.ToInt32(lblID.Text);
                        _obj_Smhr_TrgRqst.Mode  = 14;
                        DataTable dt_ger_tr1 = BLL.get_TrgRqst(_obj_Smhr_TrgRqst);
                        if (dt_ger_tr1.Rows.Count != 0)
                        {
                            for (int i = 0; i < dt_ger_tr1.Rows.Count; i++)
                            {
                                if (dt_ger_tr1.Rows[i]["LOGIN_EMAILID"] != System.DBNull.Value)
                                {
                                    Dal.ExecuteNonQuery(" exec USP_SEND_EMAIL_TRAINEE @LOGIN_EMAILID  = '" + Convert.ToString(dt_ger_tr1.Rows[i]["LOGIN_EMAILID"]) + "',@EMPLOYEE ='" + Convert.ToString(dt_ger_tr1.Rows[i]["EMPLOYEE"]) + "',@TR_TITLE ='" + Convert.ToString(dt_ger_tr1.Rows[i]["TR_TITLE"]) + "',@TS_STARTDATE ='" + Convert.ToString(dt_ger_tr1.Rows[i]["TS_STARTDATE"]) + "',@TS_SESSIONS='" + Convert.ToString(dt_ger_tr1.Rows[i]["TS_SESSIONS"]) + "',@TS_STARTTIME ='" + Convert.ToString(dt_ger_tr1.Rows[i]["TS_STARTTIME"]) + "',@TS_ENDTIME ='" + Convert.ToString(dt_ger_tr1.Rows[i]["TS_ENDTIME"]) + "'");
                                }
                            }
                        }
                    }
                    else
                    {
                        _obj_Smhr_TrgRqst       = new SMHR_TRAININGREQUEST();
                        _obj_Smhr_TrgRqst.TR_ID = Convert.ToInt32(lblID.Text);
                        _obj_Smhr_TrgRqst.Mode  = 22;
                        DataTable dt_ger_tr2 = BLL.get_TrgRqst(_obj_Smhr_TrgRqst);
                        if (dt_ger_tr2.Rows.Count != 0)
                        {
                            for (int i = 0; i < dt_ger_tr2.Rows.Count; i++)
                            {
                                if (dt_ger_tr2.Rows[i]["LOGIN_EMAILID"] != System.DBNull.Value)
                                {
                                    Dal.ExecuteNonQuery(" exec USP_SEND_EMAIL_TRAINEE @LOGIN_EMAILID  = '" + Convert.ToString(dt_ger_tr2.Rows[i]["LOGIN_EMAILID"]) + "',@EMPLOYEE ='" + Convert.ToString(dt_ger_tr2.Rows[i]["EMPLOYEE"]) + "',@TR_TITLE ='" + Convert.ToString(dt_ger_tr2.Rows[i]["TR_TITLE"]) + "',@TS_STARTDATE ='" + Convert.ToString(dt_ger_tr2.Rows[i]["TS_STARTDATE"]) + "',@TS_SESSIONS='" + Convert.ToString(dt_ger_tr2.Rows[i]["TS_SESSIONS"]) + "',@TS_STARTTIME ='" + Convert.ToString(dt_ger_tr2.Rows[i]["TS_STARTTIME"]) + "',@TS_ENDTIME ='" + Convert.ToString(dt_ger_tr2.Rows[i]["TS_ENDTIME"]) + "'");
                                }
                            }
                        }
                    }
                }

                BLL.ShowMessage(this, "Selected Trainings Approved");
                BLL.ShowMessage(this, "Notification Send");
                LoadData();
                RG_TrainingApproval.DataBind();
                //RG_ExpenseApproval.Visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TrainingApproval", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void btn_Reject_Click(object sender, EventArgs e)
    {
        try
        {
            CheckBox chkBox = new CheckBox();
            Label    lblID  = new Label();
            int      index;
            bool     status = false;
            int      i      = 0;
            string   str    = "";
            for (index = 0; index <= RG_TrainingApproval.Items.Count - 1; index++)
            {
                chkBox = RG_TrainingApproval.Items[index].FindControl("chk_Choose") as CheckBox;
                lblID  = RG_TrainingApproval.Items[index].FindControl("lbltrgID") as Label;
                if (chkBox.Checked)
                {
                    if (str == "")
                    {
                        str = "" + lblID.Text + "";
                    }
                    else
                    {
                        str = str + "," + lblID.Text + "";
                    }

                    SMHR_TRAININGREQUEST _obj_Smhr_TrgRqst = new SMHR_TRAININGREQUEST();

                    _obj_Smhr_TrgRqst.Mode          = 9;
                    _obj_Smhr_TrgRqst.TR_ID         = Convert.ToInt32(lblID.Text);
                    _obj_Smhr_TrgRqst.TR_APPROVEDBY = Convert.ToInt32(Session["emp_id"]);
                    _obj_Smhr_TrgRqst.TR_STATUS     = "Rejected";
                    status = BLL.set_TrgRqst(_obj_Smhr_TrgRqst);
                }
                else
                {
                    i = i + 1;
                }
            }

            if (i == RG_TrainingApproval.Items.Count)
            {
                BLL.ShowMessage(this, "Please Select Training");
                return;
            }


            if (status == true)
            {
                BLL.ShowMessage(this, "Selected Trainings Rejected");
                LoadData();
                RG_TrainingApproval.DataBind();
                //RG_ExpenseApproval.Visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_TrainingApproval", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }