Example #1
0
        protected void PopulateStatusList(object sender, string publicationTypeId)
        {
            RadComboBox rcbPublicationStatus = (RadComboBox)sender;

            rcbPublicationStatus.Items.Clear();
            rcbPublicationStatus.Items.Insert(0, new RadComboBoxItem("Выберите значение", Guid.Empty.ToString()));
            Guid gTypeId;

            if (Guid.TryParse(publicationTypeId, out gTypeId))
            {
                var publicationStatuses = DataManager.PublicationStatus.SelectByPublicationTypeID(gTypeId);
                foreach (var publicationStatus in publicationStatuses)
                {
                    rcbPublicationStatus.Items.Add(new RadComboBoxItem(publicationStatus.Title, publicationStatus.ID.ToString()));
                    if (publicationStatus.isFirst != null && (bool)publicationStatus.isFirst)
                    {
                        rcbPublicationStatus.SelectedIndex =
                            rcbPublicationStatus.FindItemIndexByValue(publicationStatus.ID.ToString());
                        rcbPublicationStatus.SelectedValue = publicationStatus.ID.ToString();
                        rcbPublicationStatus.Text          = publicationStatus.Title;
                    }
                }
                rcbPublicationStatus.DataBind();
            }
        }
Example #2
0
        protected void cmbProductos_DataBound(object sender, EventArgs e)
        {
            RadComboBox comboBox = ((RadComboBox)sender);
            string      id       = ((Label)comboBox.Parent.FindControl("lblProductos")).Text;

            if (id != "")
            {
                comboBox.SelectedIndex = comboBox.FindItemIndexByValue(id);
            }
        }
        /// <summary>
        /// 选择变更时执行
        /// </summary>
        void RaiseSelectChange()
        {
            ResetSubList();////

            if (defaultItem == null && (box.SelectedIndex > -1 || box.FindItemIndexByValue(box.SelectedValue) > -1) || defaultItem != null && (box.SelectedIndex > 0 || box.FindItemIndexByValue(box.SelectedValue) > -1))
            {
                //执行选择变更的方法,并且递归到每个子查询
                if (itemRequested != null && subQuery != null && subQuery.box.Visible)
                {
                    itemRequested(subQuery, currentArg);
                    if (!string.IsNullOrEmpty(subQuery.defaultValue))
                    {
                        subQuery.SetValue(subQuery.defaultValue);
                    }
                }
            }
        }
    protected void loadEmployees()
    {
        try
        {
            if (rdtp_AttDtls_AttDt.SelectedDate <= DateTime.Now)
            {
                SMHR_TRAININGREQUEST _obj_Smhr_TrgRqst;
                _obj_Smhr_TrgRqst = new SMHR_TRAININGREQUEST();

                _obj_Smhr_TrgRqst.Mode           = 24;
                _obj_Smhr_TrgRqst.TR_LASTMDFDATE = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);
                _obj_Smhr_TrgRqst.TR_CREATEDDATE = DateTime.Now;
                DataTable dtdiff = BLL.get_TrgRqst(_obj_Smhr_TrgRqst);


                _obj_Smhr_TrgRqst.Mode      = 25;
                _obj_Smhr_TrgRqst.TR_ID     = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);
                _obj_Smhr_TrgRqst.TR_ORG_ID = Convert.ToInt32(Session["org_id"]);
                DataTable dtequal = BLL.get_TrgRqst(_obj_Smhr_TrgRqst);
                if (dtequal.Rows.Count != 0)
                {
                    if ((rdtp_AttDtls_AttDt.SelectedDate == DateTime.Now) || ((Convert.ToInt32(dtdiff.Rows[0]["diffdate"])) <= (Convert.ToInt32(dtequal.Rows[0]["FEEDBACK_BACKDATE"]))))
                    {
                        Telerik.Web.UI.RadComboBox  ddlList = new RadComboBox();
                        SMHR_TRAININGATTENDANCEDTLS _obj_Smhr_TrngAttendanceDtls = new SMHR_TRAININGATTENDANCEDTLS();
                        _obj_Smhr_TrngAttendanceDtls.Mode             = 5;
                        _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_TR_ID = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);

                        _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_DATE = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);
                        DataTable dtfinal = BLL.get_TRgAttandencedtls(_obj_Smhr_TrngAttendanceDtls);
                        if (dtfinal.Rows.Count != 0)
                        {//if attendance  not finalised
                            if (Convert.ToInt32(dtfinal.Rows[0]["ATTENDANCE_ISFINAL"]) == 1)
                            {
                                _obj_Smhr_TrngAttendanceDtls.Mode             = 6;
                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_TR_ID = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);

                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_DATE = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);
                                DataTable dtfinal1 = BLL.get_TRgAttandencedtls(_obj_Smhr_TrngAttendanceDtls);
                                if (dtfinal1.Rows.Count != 0)
                                {
                                    rgd_AttDtls_Emp.DataSource = dtfinal1;

                                    rgd_AttDtls_Emp.DataBind();
                                    btn_AttDtls_Submit.Visible = false;
                                    btn_finalise.Visible       = true;
                                    rgd_AttDtls_Emp.Visible    = true;
                                    for (int j = 0; j <= rgd_AttDtls_Emp.Items.Count - 1; j++)
                                    {
                                        ddlList = rgd_AttDtls_Emp.Items[j].FindControl("rcmb_AttDtls_Status") as RadComboBox;
                                        if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Present")
                                        {
                                            ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("P"));
                                        }
                                        else if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Absent")
                                        {
                                            ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("A"));
                                        }

                                        //ddlList.SelectedItem.Text = Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"]);
                                    }

                                    BLL.ShowMessage(this, "Attendace Details Not Finalised");

                                    return;
                                }
                                else
                                {
                                    DataTable dt1 = new DataTable();
                                    rgd_AttDtls_Emp.DataSource = dt1;

                                    rgd_AttDtls_Emp.DataBind();
                                    btn_AttDtls_Submit.Visible = false;
                                    btn_finalise.Visible       = false;
                                    rgd_AttDtls_Emp.Visible    = true;
                                }
                            }

                            else if (Convert.ToInt32(dtfinal.Rows[0]["ATTENDANCE_ISFINAL"]) == 2)
                            {//if attendance  already finalised
                                _obj_Smhr_TrngAttendanceDtls.Mode             = 7;
                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_TR_ID = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);

                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_DATE = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);
                                DataTable dtfinal1 = BLL.get_TRgAttandencedtls(_obj_Smhr_TrngAttendanceDtls);
                                rgd_AttDtls_Emp.DataSource = dtfinal1;
                                rgd_AttDtls_Emp.DataBind();
                                btn_AttDtls_Submit.Visible = false;
                                btn_finalise.Visible       = false;
                                for (int j = 0; j <= rgd_AttDtls_Emp.Items.Count - 1; j++)
                                {
                                    ddlList = rgd_AttDtls_Emp.Items[j].FindControl("rcmb_AttDtls_Status") as RadComboBox;
                                    if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Present")
                                    {
                                        ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("P"));
                                    }
                                    else if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Absent")
                                    {
                                        ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("A"));
                                    }
                                    //ddlList.SelectedItem.Text = Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"]);
                                }
                                BLL.ShowMessage(this, "Attendace Details  Finalised");
                                rgd_AttDtls_Emp.Visible = true;
                                rgd_AttDtls_Emp.Enabled = false;
                                return;
                            }
                        }
                        else
                        {
                            SMHR_TRAINEE _obj_Smhr_TrnEE = new SMHR_TRAINEE();
                            _obj_Smhr_TrnEE.Mode                    = 6;
                            _obj_Smhr_TrnEE.TRAINEE_TR_ID           = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);
                            _obj_Smhr_TrnEE.TRAINEE_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_Attdtls_BU.SelectedItem.Value);
                            _obj_Smhr_TrnEE.TRAINEE_LASTMDFDATE     = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);

                            DataTable dtemp = BLL.get_TRAINEE(_obj_Smhr_TrnEE);
                            if (dtemp.Rows.Count != 0)
                            {
                                rgd_AttDtls_Emp.DataSource = dtemp;
                                rgd_AttDtls_Emp.DataBind();
                                btn_AttDtls_Submit.Visible = true;
                                btn_finalise.Visible       = true;

                                rgd_AttDtls_Emp.Visible = true;
                                rgd_AttDtls_Emp.Enabled = true;
                                return;
                            }

                            else
                            {
                                DataTable dt1 = new DataTable();
                                rgd_AttDtls_Emp.DataSource = dt1;
                                rgd_AttDtls_Emp.DataBind();
                                btn_AttDtls_Submit.Visible = false;
                                btn_finalise.Visible       = false;

                                rgd_AttDtls_Emp.Visible = true;
                                return;
                            }
                        }
                    }
                    else
                    {
                        SMHR_TRAINEE _obj_Smhr_TrnEE = new SMHR_TRAINEE();
                        _obj_Smhr_TrnEE.Mode                    = 6;
                        _obj_Smhr_TrnEE.TRAINEE_TR_ID           = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);
                        _obj_Smhr_TrnEE.TRAINEE_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_Attdtls_BU.SelectedItem.Value);
                        _obj_Smhr_TrnEE.TRAINEE_LASTMDFDATE     = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);

                        DataTable dtemp = BLL.get_TRAINEE(_obj_Smhr_TrnEE);
                        if (dtemp.Rows.Count != 0)
                        {
                            rgd_AttDtls_Emp.DataSource = dtemp;
                            rgd_AttDtls_Emp.DataBind();
                            btn_AttDtls_Submit.Visible = true;
                            btn_finalise.Visible       = false;
                            for (int j = 0; j <= rgd_AttDtls_Emp.Items.Count - 1; j++)
                            {
                                RadComboBox ddlList = rgd_AttDtls_Emp.Items[j].FindControl("rcmb_AttDtls_Status") as RadComboBox;

                                ddlList.SelectedItem.Text = "Absent";
                            }
                            rgd_AttDtls_Emp.Visible    = true;
                            rgd_AttDtls_Emp.Enabled    = false;
                            btn_AttDtls_Submit.Visible = false;
                            return;
                        }

                        else
                        {
                            DataTable dt1 = new DataTable();
                            rgd_AttDtls_Emp.DataSource = dt1;
                            rgd_AttDtls_Emp.DataBind();
                            btn_AttDtls_Submit.Visible = false;
                            btn_finalise.Visible       = false;
                            rgd_AttDtls_Emp.Enabled    = false;
                            rgd_AttDtls_Emp.Visible    = true;

                            return;
                        }
                    }
                }

                else
                {
                    if ((rdtp_AttDtls_AttDt.SelectedDate == DateTime.Now))
                    {
                        Telerik.Web.UI.RadComboBox  ddlList = new RadComboBox();
                        SMHR_TRAININGATTENDANCEDTLS _obj_Smhr_TrngAttendanceDtls = new SMHR_TRAININGATTENDANCEDTLS();
                        _obj_Smhr_TrngAttendanceDtls.Mode             = 5;
                        _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_TR_ID = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);

                        _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_DATE = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);
                        DataTable dtfinal = BLL.get_TRgAttandencedtls(_obj_Smhr_TrngAttendanceDtls);
                        if (dtfinal.Rows.Count != 0)
                        {//if attendance  not finalised
                            if (Convert.ToInt32(dtfinal.Rows[0]["ATTENDANCE_ISFINAL"]) == 1)
                            {
                                _obj_Smhr_TrngAttendanceDtls.Mode             = 6;
                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_TR_ID = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);

                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_DATE = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);
                                DataTable dtfinal1 = BLL.get_TRgAttandencedtls(_obj_Smhr_TrngAttendanceDtls);
                                if (dtfinal1.Rows.Count != 0)
                                {
                                    rgd_AttDtls_Emp.DataSource = dtfinal1;

                                    rgd_AttDtls_Emp.DataBind();
                                    btn_AttDtls_Submit.Visible = false;
                                    btn_finalise.Visible       = true;
                                    rgd_AttDtls_Emp.Visible    = true;
                                    for (int j = 0; j <= rgd_AttDtls_Emp.Items.Count - 1; j++)
                                    {
                                        ddlList = rgd_AttDtls_Emp.Items[j].FindControl("rcmb_AttDtls_Status") as RadComboBox;
                                        if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Present")
                                        {
                                            ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("P"));
                                        }
                                        else if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Absent")
                                        {
                                            ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("A"));
                                        }

                                        //ddlList.SelectedItem.Text = Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"]);
                                    }

                                    BLL.ShowMessage(this, "Attendace Details Not Finalised");

                                    return;
                                }
                                else
                                {
                                    DataTable dt1 = new DataTable();
                                    rgd_AttDtls_Emp.DataSource = dt1;

                                    rgd_AttDtls_Emp.DataBind();
                                    btn_AttDtls_Submit.Visible = false;
                                    btn_finalise.Visible       = false;
                                    rgd_AttDtls_Emp.Visible    = true;
                                }
                            }

                            else if (Convert.ToInt32(dtfinal.Rows[0]["ATTENDANCE_ISFINAL"]) == 2)
                            {//if attendance  already finalised
                                _obj_Smhr_TrngAttendanceDtls.Mode             = 7;
                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_TR_ID = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);

                                _obj_Smhr_TrngAttendanceDtls.ATTENDANCE_DATE = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);
                                DataTable dtfinal1 = BLL.get_TRgAttandencedtls(_obj_Smhr_TrngAttendanceDtls);
                                rgd_AttDtls_Emp.DataSource = dtfinal1;
                                rgd_AttDtls_Emp.DataBind();
                                btn_AttDtls_Submit.Visible = false;
                                btn_finalise.Visible       = false;
                                for (int j = 0; j <= rgd_AttDtls_Emp.Items.Count - 1; j++)
                                {
                                    ddlList = rgd_AttDtls_Emp.Items[j].FindControl("rcmb_AttDtls_Status") as RadComboBox;
                                    if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Present")
                                    {
                                        ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("P"));
                                    }
                                    else if (Convert.ToString(Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"])) == "Absent")
                                    {
                                        ddlList.SelectedIndex = ddlList.FindItemIndexByValue(Convert.ToString("A"));
                                    }
                                    //ddlList.SelectedItem.Text = Convert.ToString(dtfinal1.Rows[j]["ATTENDANCE_STATUS"]);
                                }
                                BLL.ShowMessage(this, "Attendace Details  Finalised");
                                rgd_AttDtls_Emp.Visible = true;
                                rgd_AttDtls_Emp.Enabled = false;
                                return;
                            }
                        }
                        else
                        {
                            SMHR_TRAINEE _obj_Smhr_TrnEE = new SMHR_TRAINEE();
                            _obj_Smhr_TrnEE.Mode                    = 6;
                            _obj_Smhr_TrnEE.TRAINEE_TR_ID           = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);
                            _obj_Smhr_TrnEE.TRAINEE_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_Attdtls_BU.SelectedItem.Value);
                            _obj_Smhr_TrnEE.TRAINEE_LASTMDFDATE     = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);

                            DataTable dtemp = BLL.get_TRAINEE(_obj_Smhr_TrnEE);
                            if (dtemp.Rows.Count != 0)
                            {
                                rgd_AttDtls_Emp.DataSource = dtemp;
                                rgd_AttDtls_Emp.DataBind();
                                btn_AttDtls_Submit.Visible = true;
                                btn_finalise.Visible       = true;

                                rgd_AttDtls_Emp.Visible = true;
                                rgd_AttDtls_Emp.Enabled = true;
                                return;
                            }

                            else
                            {
                                DataTable dt1 = new DataTable();
                                rgd_AttDtls_Emp.DataSource = dt1;
                                rgd_AttDtls_Emp.DataBind();
                                btn_AttDtls_Submit.Visible = false;
                                btn_finalise.Visible       = false;

                                rgd_AttDtls_Emp.Visible = true;
                                return;
                            }
                        }
                    }
                    else
                    {
                        SMHR_TRAINEE _obj_Smhr_TrnEE = new SMHR_TRAINEE();
                        _obj_Smhr_TrnEE.Mode                    = 6;
                        _obj_Smhr_TrnEE.TRAINEE_TR_ID           = Convert.ToInt32(rcmb_Attdtls_Training.SelectedItem.Value);
                        _obj_Smhr_TrnEE.TRAINEE_BUSINESSUNIT_ID = Convert.ToInt32(rcmb_Attdtls_BU.SelectedItem.Value);
                        _obj_Smhr_TrnEE.TRAINEE_LASTMDFDATE     = Convert.ToDateTime(rdtp_AttDtls_AttDt.SelectedDate);

                        DataTable dtemp = BLL.get_TRAINEE(_obj_Smhr_TrnEE);
                        if (dtemp.Rows.Count != 0)
                        {
                            rgd_AttDtls_Emp.DataSource = dtemp;
                            rgd_AttDtls_Emp.DataBind();
                            btn_AttDtls_Submit.Visible = true;
                            btn_finalise.Visible       = false;
                            for (int j = 0; j <= rgd_AttDtls_Emp.Items.Count - 1; j++)
                            {
                                RadComboBox ddlList = rgd_AttDtls_Emp.Items[j].FindControl("rcmb_AttDtls_Status") as RadComboBox;

                                ddlList.SelectedItem.Text = "Absent";
                            }
                            rgd_AttDtls_Emp.Visible    = true;
                            rgd_AttDtls_Emp.Enabled    = false;
                            btn_AttDtls_Submit.Visible = false;
                            return;
                        }

                        else
                        {
                            DataTable dt1 = new DataTable();
                            rgd_AttDtls_Emp.DataSource = dt1;
                            rgd_AttDtls_Emp.DataBind();
                            btn_AttDtls_Submit.Visible = false;
                            btn_finalise.Visible       = false;
                            rgd_AttDtls_Emp.Enabled    = false;
                            rgd_AttDtls_Emp.Visible    = true;

                            return;
                        }
                    }
                }
            }

            else
            {
                BLL.ShowMessage(this, "Future Attendance Cannot Given");
                rgd_AttDtls_Emp.Visible    = false;
                btn_finalise.Visible       = false;
                btn_AttDtls_Submit.Visible = false;

                return;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_trainingattendancedtls", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }