protected Label newChapterLabel(long userId)
        {
            Label chapter = new Label();

            //值字典
            valueDic.Clear();
            BLL.CCOM.User_subject_value vbll = new BLL.CCOM.User_subject_value();
            try
            {
                List <Model.CCOM.User_subject_value> valueList = vbll.GetModelList("User_id=" + userId);
                foreach (Model.CCOM.User_subject_value value in valueList)
                {
                    if (!valueDic.ContainsKey(value.Subject_id))
                    {
                        valueDic.Add(value.Subject_id, new Dictionary <int, Model.CCOM.User_subject_value>());
                    }
                    if (value.Usv_children == null)
                    {
                        valueDic[value.Subject_id].Add(0, value);
                    }
                    else
                    {
                        valueDic[value.Subject_id].Add((int)value.Usv_children, value);
                    }
                }
            }
            catch (Exception e)
            {
                return(null);
            }
            chapterBuilder = new StringBuilder();
            BindChapter(subjectDic[Convert.ToInt32(ddlSubject.SelectedValue)], 0);
            chapter.Text = chapterBuilder.ToString();
            return(chapter);
        }
Exemplo n.º 2
0
        protected void BindAllSubject()
        {
            userId = GetAdminInfo_CCOM().User_id;
            BLL.CCOM.User_property   pbll   = new BLL.CCOM.User_property();
            Model.CCOM.User_property pmodel = pbll.GetModel("User_id=" + userId);
            int majorId = pmodel.Agency_id;

            //科目字典
            BLL.CCOM.Subject bll = new BLL.CCOM.Subject();
            try
            {
                List <Model.CCOM.Subject> subjectList = bll.GetModelList("Major_Agency_id=" + majorId);
                foreach (Model.CCOM.Subject subject in subjectList)
                {
                    subjectDic.Add(subject.Subject_id, subject);
                }
            }
            catch (Exception e)
            {
                return;
            }
            //旧值字典
            BLL.CCOM.User_subject_value vbll = new BLL.CCOM.User_subject_value();
            try
            {
                List <Model.CCOM.User_subject_value> valueList = vbll.GetModelList("User_id=" + GetAdminInfo_CCOM().User_id);
                foreach (Model.CCOM.User_subject_value value in valueList)
                {
                    if (!oldDic.ContainsKey(value.Subject_id))
                    {
                        oldDic.Add(value.Subject_id, new Dictionary <int, Model.CCOM.User_subject_value>());
                    }
                    if (value.Usv_children == null)
                    {
                        oldDic[value.Subject_id].Add(0, value);
                    }
                    else
                    {
                        oldDic[value.Subject_id].Add((int)value.Usv_children, value);
                    }
                }
            }
            catch (Exception e)
            {
                return;
            }
            root = bll.GetModel("Major_Agency_id=" + majorId + "and Subject_level=0");
            foreach (Model.CCOM.Subject Cmodel in subjectDic.Values)
            {
                if (Cmodel.Fs_id == root.Subject_id)
                {
                    BindTest(Cmodel);
                }
            }
        }