コード例 #1
0
        private void checkCheckBoxGroup()
        {
            List <string> departmanList = FRB.GetGroupList(int.Parse(Session["hrInfoPeopleId"].ToString()));

            foreach (string var in departmanList)
            {
                ListItem l = chbkGroup.Items.FindByValue(var);
                if (l != null)
                {
                    l.Selected = true;
                }
            }
        }
コード例 #2
0
        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;
                        }
                    }
                }
            }
        }