示例#1
0
 /// <summary>
 /// 获取分组id
 /// </summary>
 /// <param name="sorts"></param>
 /// <param name="departName"></param>
 /// <returns></returns>
 private int _getSortsId(Song.Entities.StudentSort[] sorts, string sortName)
 {
     try
     {
         int sortId = 0;
         foreach (Song.Entities.StudentSort s in sorts)
         {
             if (sortName.Trim() == s.Sts_Name)
             {
                 sortId = s.Sts_ID;
                 break;
             }
         }
         if (sortId == 0 && sortName.Trim() != "")
         {
             Song.Entities.StudentSort nwsort = new Song.Entities.StudentSort();
             nwsort.Sts_Name  = sortName;
             nwsort.Sts_IsUse = true;
             nwsort.Org_ID    = org.Org_ID;
             Business.Do <IStudent>().SortAdd(nwsort);
             sortId     = nwsort.Sts_ID;
             this.sorts = this.sorts = Business.Do <IStudent>().SortCount(org.Org_ID, null, 0);
         }
         return(sortId);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            Song.Entities.Organization org = Business.Do<IOrganization>().OrganCurrent();
            if (org == null) throw new WeiSha.Common.ExceptionForAlert("当前机构不存在");
            //
            Song.Entities.StudentSort th = id == 0 ? new Song.Entities.StudentSort() : Business.Do<IStudent>().SortSingle(id);
            th = this.EntityFill(th) as Song.Entities.StudentSort;
            th.Org_ID = org.Org_ID;
            th.Org_Name = org.Org_Name;
            //判断是否重名
            if (Business.Do<IStudent>().SortIsExist(th))
            {
                Master.Alert("当前学生分组已经存在!");
            }
            else
            {
                try
                {
                    if (id == 0)
                    {
                        Business.Do<IStudent>().SortAdd(th);
                    }
                    else
                    {
                        Business.Do<IStudent>().SortSave(th);
                    }

                    Master.AlertCloseAndRefresh("操作成功!");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        /// <summary>
        /// 禁用或启用“视频课程学习时的切换窗体暂停视频播放”功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void sbSwitchPlay_Click(object sender, EventArgs e)
        {
            StateButton ub    = (StateButton)sender;
            int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
            int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());

            Song.Entities.StudentSort entity = Business.Do <IStudent>().SortSingle(id);
            entity.Sts_SwitchPlay = !entity.Sts_SwitchPlay;
            Business.Do <IStudent>().SortSave(entity);
            BindData(null, null);
        }
示例#4
0
        /// <summary>
        /// 导出成绩
        /// </summary>
        /// <param name="hssfworkbook"></param>
        private HSSFWorkbook buildExcelSql_2(Song.Entities.Examination theme, HSSFWorkbook hssfworkbook)
        {
            //当前考试限定的学生分组
            string stsid = "";

            Song.Entities.StudentSort[] sts = Business.Do <IExamination>().GroupForStudentSort(theme.Exam_UID);
            //如果没有设定分组,则取当前参加考试的学员的分组
            if (sts == null || sts.Length < 1)
            {
                sts = Business.Do <IExamination>().StudentSort4Theme(examid);
            }
            foreach (Song.Entities.StudentSort ss in sts)
            {
                stsid += ss.Sts_ID + ",";
            }
            DataTable dt = Business.Do <IExamination>().Result4Theme(examid, stsid);

            dt.TableName = "--所有学员--";
            buildExcelSql_2_fromData(dt, hssfworkbook);

            //每个分组单独创建工作表
            foreach (string s in stsid.Split(','))
            {
                if (string.IsNullOrWhiteSpace(s))
                {
                    continue;
                }
                int sid = 0;
                int.TryParse(s, out sid);
                if (sid <= 0)
                {
                    continue;
                }
                //取每个组的学员的考试成绩
                DataTable dtTm = Business.Do <IExamination>().Result4Theme(examid, sid);
                if (dtTm == null)
                {
                    continue;
                }
                Song.Entities.StudentSort sort = Business.Do <IStudent>().SortSingle(sid);
                dtTm.TableName = sort.Sts_Name;
                buildExcelSql_2_fromData(dtTm, hssfworkbook);
            }
            return(hssfworkbook);
        }
示例#5
0
        /// <summary>
        /// 判断当前课程是否允许切换浏览器时视频暂停
        /// </summary>
        /// <param name="course"></param>
        /// <param name="acc"></param>
        /// <param name="organ"></param>
        /// <returns>true,则允许浏览器失去焦点时,视频仍然播放</returns>
        private bool getSwitchPlay(Song.Entities.Course course, Song.Entities.Accounts acc, Song.Entities.Organization organ)
        {
            if (acc == null)
            {
                return(false);
            }
            //自定义配置项
            WeiSha.Common.CustomConfig config = CustomConfig.Load(organ.Org_Config);
            bool isstop = config["IsSwitchPlay"].Value.Boolean ?? false;

            if (isstop)
            {
                return(true);
            }
            //如果机构设置中为false,继续判断学员组的设置
            Song.Entities.StudentSort sort = Business.Do <IStudent>().SortSingle(acc.Sts_ID);
            if (sort == null || !sort.Sts_IsUse)
            {
                return(isstop);
            }
            return(sort.Sts_SwitchPlay);
        }
 private void fill()
 {
     Song.Entities.StudentSort th = id == 0 ? new Song.Entities.StudentSort() : Business.Do<IStudent>().SortSingle(id);
     if (th == null) return;
     if (id != 0) this.EntityBind(th);
 }