Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["daneshId"] != null)
                {
                    _daneshId = Convert.ToInt32(Session["daneshId"]);
                }

                if (_daneshId == 0)
                {
                    DaneshkadeHandler dHandler = new DaneshkadeHandler();
                    drpDanshkade.DataSource     = dHandler.GetAllDaneshkade();
                    drpDanshkade.DataTextField  = "NameDanesh";
                    drpDanshkade.DataValueField = "ID";
                    drpDanshkade.DataBind();
                    dvDanshkade.Visible = true;
                    drpDanshkade.Items.Insert(0, "انتخاب کنید");
                }
                else
                {
                    RC_UserHandler userhandler = new RC_UserHandler();
                    drpProfessors.DataSource     = userhandler.GetOstadListByDaneshID(_daneshId);
                    drpProfessors.DataTextField  = "Name";
                    drpProfessors.DataValueField = "ID";
                    drpProfessors.DataBind();
                }
            }
        }
        protected void BindGrid()
        {
            RequestHandler rq = new RequestHandler();

            _reqlist = rq.GetDeletedRequestListOfTermJari();/*.Where(x=>x.Issue_time == pcal1.Text).ToList();*/
            grdDeletedRequest.DataSource = _reqlist;
            grdDeletedRequest.DataBind();
            List <string> issuerNames = new List <string>();

            foreach (var x in _reqlist)
            {
                issuerNames.Add(x.IssuerName);
            }

            //drpIssureName.DataSource = issuerNames;
            //drpIssureName.DataBind();
            //drpIssureName.Items.Insert(0, "انتخاب کنید");

            Daneshkade item = new Daneshkade();

            item.NameDanesh = "--انتخاب کنید--";
            item.ID         = -1;
            DaneshkadeHandler dnsh = new DaneshkadeHandler();

            dnshList = dnsh.GetAllDaneshkade();
            dnshList.Insert(0, item);
            //  drpChooseDanshkade.Items.Clear();
            drpChooseDanshkade.DataSource     = dnshList;
            drpChooseDanshkade.DataTextField  = "NameDanesh";
            drpChooseDanshkade.DataValueField = "ID";
            drpChooseDanshkade.DataBind();

            RC_UserHandler usrH = new RC_UserHandler();

            daneshID = Convert.ToInt32(Session["DaneshId"]);
            List <RC_User> listostad = usrH.GetOstadListByDaneshID(daneshID);//need to get list of ostad of one daneshkade

            if (listostad != null)
            {
                for (int i = 0; i <= listostad.Count - 1; i++)
                {
                    listostad[i].Name = listostad[i].Name.Replace("ي", "ی");
                }
            }

            RadComboBoxField.DataSource     = listostad;
            RadComboBoxField.DataTextField  = "name";
            RadComboBoxField.DataValueField = "ID";
            RadComboBoxField.DataBind();
            RadComboBoxField.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("جستجو و انتخاب کنید"));
        }
        protected void drpCategory_SelectedIndexChanged1(object sender, EventArgs e)
        {
            chkMeeting.Checked = false;
            chkMeeting_CheckedChanged(sender, e);
            if ((drpCategory.SelectedIndex == 1) || (drpCategory.SelectedIndex == 2) || (drpCategory.SelectedIndex == 3))
            {
                if (drpCategory.SelectedIndex == 1)
                {
                    txtCapacity.Text     = 1.ToString();
                    txtCapacity.ReadOnly = true;
                }
                else
                {
                    txtCapacity.ReadOnly = false;
                }
                trOptions.Visible   = true;
                chblOptions.Enabled = true;
                drpLocation.Enabled = true;
                LocationHandler locH = new LocationHandler();
                drpLocation.Items.Clear();
                drpLocation.DataSource     = locH.GetLocationListByCatID(Convert.ToInt32(drpCategory.SelectedValue)).Distinct();
                drpLocation.DataTextField  = "name";
                drpLocation.DataValueField = "ID";
                drpLocation.DataBind();
                drpLocation.Items.Insert(0, "انتخاب کنید");
                OptionHandler opt = new OptionHandler();
                optlist = opt.GetOptionListByCatID(Convert.ToInt32(drpCategory.SelectedValue));
                chblOptions.Items.Clear();
                chblOptions.DataSource     = optlist;
                chblOptions.DataTextField  = "name";
                chblOptions.DataValueField = "ID";
                chblOptions.DataBind();

                trDaneshkadeh.Visible = userID == 1;
                Daneshkade item = new Daneshkade();
                item.NameDanesh = "--انتخاب کنید--";
                item.ID         = -1;
                DaneshkadeHandler dnsh = new DaneshkadeHandler();
                dnshList = dnsh.GetAllDaneshkade();
                dnshList.Insert(0, item);
                drpChooseDanshkade.Items.Clear();
                drpChooseDanshkade.DataSource     = dnshList;
                drpChooseDanshkade.DataTextField  = "NameDanesh";
                drpChooseDanshkade.DataValueField = "ID";
                drpChooseDanshkade.DataBind();


                if (drpCategory.SelectedIndex == 3 || drpCategory.SelectedIndex == 2)
                {
                    chkMeeting.Visible = true;
                    if (drpCategory.SelectedIndex == 2)
                    {
                        chkMeeting.Text = "بدون استاد";
                    }
                    else
                    {
                        chkMeeting.Text = " تخصیص سالن کنفرانس جهت برگزاری جلسات";
                    }
                }
                else
                {
                    chkMeeting.Visible = false;
                }
            }
            else
            {
                trOptions.Visible   = false;
                chblOptions.Enabled = false;
                drpLocation.Enabled = false;
                chkMeeting.Visible  = false;
            }
            ////////////////////////////////////////////
            RadComboBoxField.Enabled = true;
            RC_UserHandler usrH      = new RC_UserHandler();
            List <RC_User> listostad = usrH.GetOstadListByDaneshID(Convert.ToInt32(Session["DaneshId"]));

            if (listostad != null)
            {
                for (int i = 0; i <= listostad.Count - 1; i++)
                {
                    listostad[i].Name = listostad[i].Name.Replace("ي", "ی");
                }
            }
            RadComboBoxField.Items.Clear();
            RadComboBoxField.DataSource     = listostad;
            RadComboBoxField.DataTextField  = "name";
            RadComboBoxField.DataValueField = "ID";
            RadComboBoxField.DataBind();
            RadComboBoxField.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("جستجو و انتخاب کنید"));


            ///////////////////////////////////////////
        }