Exemplo n.º 1
0
 /// <summary>
 /// 获取班组Id
 /// </summary>
 /// <param name="depart"></param>
 /// <param name="sortName"></param>
 /// <returns></returns>
 private int _getTeamId(Song.Entities.Team[] team, string sortName)
 {
     try
     {
         int sortId = 0;
         foreach (Song.Entities.Team s in team)
         {
             if (sortName.Trim() == s.Team_Name)
             {
                 sortId = s.Team_ID;
                 break;
             }
         }
         if (sortId == 0 && sortName.Trim() != "")
         {
             Song.Entities.Team nwsort = new Song.Entities.Team();
             nwsort.Team_Name  = sortName;
             nwsort.Team_IsUse = true;
             sortId            = Business.Do <ITeam>().TeamAdd(nwsort);
             this.teams        = Business.Do <ITeam>().GetTeam(null, 0);
         }
         return(sortId);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
         return(0);
     }
 }
Exemplo n.º 2
0
        //获取当前学科下的所有试卷
        protected void Page_Load(object sender, EventArgs e)
        {
            Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
            EmpAccount currentUser         = Extend.LoginState.Admin.CurrentUser;

            if (currentUser == null)
            {
                Response.Write("");
                Response.End();
                return;
            }
            //当前员所处的学科
            Song.Entities.Team team = Business.Do <ITeam>().TeamSingle((int)currentUser.Team_ID);
            if (team != null)
            {
                sbjid = (int)team.Sbj_ID;
            }
            //员工选择的每日一练的学科范围
            string sel = Business.Do <ISystemPara>()["SubjectForAccout_" + currentUser.Acc_Id].String;

            string[] arr = sel.Split(',');
            if (arr.Length > 0)
            {
                arr[arr.Length - 1] = sbjid.ToString();
            }
            //随机抽取学科
            if (arr.Length > 1)
            {
                Random rand  = new Random();
                int    index = rand.Next(0, arr.Length - 1);
                sbjid = Convert.ToInt32(arr[index]);
            }
            Song.Entities.Questions[] ques = Business.Do <IQuestions>().QuesRandom(org.Org_ID, sbjid, -1, -1, type, diff, diff, true, 1);
            string tm = "";

            if (ques.Length > 0)
            {
                Song.Entities.Questions q = ques[0];
                q  = replaceText(q);
                tm = q.ToJson();
                //如果是单选题,或多选题
                if (q.Qus_Type == 1 || q.Qus_Type == 2 || q.Qus_Type == 5)
                {
                    tm = getAnserJson(q, tm);
                }
            }

            Response.Write(tm);
            Response.End();
        }
Exemplo n.º 3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     Song.Entities.Team mm = null;
     try
     {
         if (id != 0)
         {
             mm = Business.Do <ITeam>().TeamSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.Team();
         }
         //属性
         mm.Team_Name   = tbName.Text.Trim();
         mm.Team_ByName = tbByName.Text.Trim();
         //院系
         mm.Dep_ID = Convert.ToInt32(ddlDepart.SelectedValue);
         //学科
         mm.Sbj_ID   = Convert.ToInt32(ddlSubject.SelectedValue);
         mm.Sbj_Name = ddlSubject.SelectedItem.Text;
         //是否允许
         mm.Team_IsUse = cbIsUse.Checked;
         //说明
         mm.Team_Intro = tbIntro.Text;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
     //确定操作
     try
     {
         if (id == 0)
         {
             Business.Do <ITeam>().TeamAdd(mm);
         }
         else
         {
             Business.Do <ITeam>().TeamSave(mm);
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Master.Alert(ex.Message);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     try
     {
         Song.Entities.Team mm;
         if (id != 0)
         {
             mm = Business.Do <ITeam>().TeamSingle(id);
             //是否显示
             cbIsUse.Checked = mm.Team_IsUse;
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.Team();
         }
         //组名称
         tbName.Text   = mm.Team_Name;
         tbByName.Text = mm.Team_ByName;
         //所在院系
         ListItem liDepart = ddlDepart.Items.FindByValue(mm.Dep_ID.ToString());
         if (liDepart != null)
         {
             ddlDepart.SelectedIndex = -1;
             liDepart.Selected       = true;
         }
         //所属学科
         ListItem liSubj = ddlSubject.Items.FindByValue(mm.Sbj_ID.ToString());
         if (liSubj != null)
         {
             ddlSubject.SelectedIndex = -1;
             liSubj.Selected          = true;
         }
         //说明
         tbIntro.Text = mm.Team_Intro;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }