private void addDepratements(int infoPeopleId)
        {
            DataTable dtDaneshkade = new DataTable();
            DataTable dtGroup      = new DataTable();

            dtGroup = FRB.GetGroupByCode(infoPeopleId);
            if (dtGroup.Rows.Count != 0)
            {
                string Resault = "idgroup in (";
                foreach (DataRow dr in dtGroup.Rows)
                {
                    Resault += dr["idgroup"].ToString() + "" + ",";
                }
                Resault += ")";
                string Field = Resault.Replace(",)", ")").Replace("(,", "(");
                dtDaneshkade = FRB.GetDaneshkadeByGroup(Field);

                Session["Field"] = Field;
                chbkDaneshkade.ClearSelection();
                foreach (DataRow item in dtDaneshkade.Rows)
                {
                    if (chbkDaneshkade.Items.FindByValue(item["iddanesh"].ToString()) != null)
                    {
                        chbkDaneshkade.Items.FindByValue(item["iddanesh"].ToString()).Selected = true;
                    }
                }

                if (chbkDaneshkade.SelectedIndex != -1)
                {
                    DataTable dtt = new DataTable();

                    foreach (ListItem itemm in chbkDaneshkade.Items)
                    {
                        if (itemm.Selected)
                        {
                            dtt.Merge(FRB.GetDepartmentList(Convert.ToInt32(itemm.Value)));
                        }
                    }
                    chbkGroup.DataSource      = dtt;
                    chbkGroup.DataTextField   = "namegroup";
                    chbkGroup.DataValueField  = "idgroup";
                    chbkGroup.RepeatColumns   = 4;
                    chbkGroup.RepeatDirection = RepeatDirection.Horizontal;
                    chbkGroup.DataBind();
                    List <string> departmanList = FRB.GetGroupList(infoPeopleId);


                    foreach (ListItem lch in chbkGroup.Items)
                    {
                        if (departmanList.Contains(lch.Value))
                        {
                            lch.Selected = true;
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int code_ostad = Convert.ToInt32(Session[sessionNames.userID_StudentOstad]);

                if (ProfReqBuss.HasPendingRequest(code_ostad, (int)RequestTypeId.EditCooperation))
                {
                    string msg = "شما به دلیل وجود درخواست تایید نشده از این نوع درخواست نمی توانید درخواست جدید ثبت کنید.";
                    showMessage(msg, true);
                    return;
                }
                DataTable dtResult = FRB.GetOstadInfoFromHR(code_ostad);

                if (dtResult.Rows.Count == 0)
                {
                    string msg = "کد استادی شما در هیچ کدام از سامانه ها فعال نیست. لطفا جهت فعال سازی با کارشناس مربوطه تماس حاصل فرمایید";
                    RadWindowManager1.RadAlert(msg, 400, 200, "پیام سیستم", "RedirectToMain");
                    return;
                }
                Session.Add("hrInfoPeopleId", dtResult.Rows[0]["Id"]);

                int cooperation = 0;
                if (dtResult.Rows[0]["cooperation"] != DBNull.Value)
                {
                    cooperation = Convert.ToInt32(dtResult.Rows[0]["cooperation"]);
                }
                ViewState.Add("cooperation", cooperation);

                if (cooperation == 1 || cooperation == 2)
                {
                    chbkCooperation.SelectedValue = cooperation.ToString();
                }
                if (cooperation == 3)
                {
                    chbkCooperation.Items[0].Selected = true;
                    chbkCooperation.Items[1].Selected = true;
                }
                DataTable dtDanesh = CB.SelectAllDaneshkade();
                chbkDaneshkade.DataSource     = dtDanesh;
                chbkDaneshkade.DataValueField = "ID";
                chbkDaneshkade.DataTextField  = "namedanesh";
                chbkDaneshkade.DataBind();

                string field = getSelectedFields();
                if (field != "")
                {
                    DataTable dtDaneshkade = FRB.GetDaneshkadeByGroup(field);
                    chbkDaneshkade.ClearSelection();
                    foreach (DataRow item in dtDaneshkade.Rows)
                    {
                        if (chbkDaneshkade.Items.FindByValue(item["iddanesh"].ToString()) != null)
                        {
                            chbkDaneshkade.Items.FindByValue(item["iddanesh"].ToString()).Selected = true;
                        }
                    }
                    //foreach (DataRow item in dtDaneshkade.Rows)
                    //{
                    //    switch (item["iddanesh"].ToString())
                    //    {
                    //        case "1":
                    //            chbkDaneshkade.Items.FindByValue("1").Selected = true;
                    //            break;

                    //        case "2":
                    //            chbkDaneshkade.Items.FindByValue("2").Selected = true;
                    //            break;

                    //        case "3":
                    //            chbkDaneshkade.Items.FindByValue("3").Selected = true;
                    //            break;

                    //        case "8":
                    //            chbkDaneshkade.Items.FindByValue("8").Selected = true;
                    //            break;
                    //    }
                    //}
                    getGroupByDaneshkadeValue();
                    checkCheckBoxGroup();
                }

                addDepratements(Convert.ToInt32(Session["hrInfoPeopleId"]));
            }
        }