Exemple #1
0
        private void SubmitEditBtn_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                pop.PopTime = TimeSpan.Parse(this.PopTimeTextBox.Text.Trim());
            }
            catch(Exception ex)
            {
                MessageBox.Show("时间格式不正确!");
                return;
            }
            using(JszxDataManager jszxM=new JszxDataManager()){
                pop.PopTimeID=jszxM.SavePopTime(pop);
                poptimes_tb _pop= setPopW.popList.Where(p => p.PopTimeID == pop.PopTimeID).FirstOrDefault();
                if (_pop == null)
                {
                    //新增
                    setPopW.popList.Add(pop);
                }
                else
                {
                    //修改
                    setPopW.popList.Where(p => p.PopTimeID == pop.PopTimeID).FirstOrDefault().PopTime = pop.PopTime;
                }

                setPopW.PopTimeDG.Items.Refresh();
                this.Close();
            }
        }
Exemple #2
0
 private void Window_Loaded_1(object sender, RoutedEventArgs e)
 {
     jszxDataManager = new JszxDataManager();
     popList1 = jszxDataManager.GetPopTimes(true);
     popList = new ObservableCollection<poptimes_tb>(popList1);
     PopTimeDG.ItemsSource = popList;
 }
Exemple #3
0
        /// <summary>
        /// 获取当前时间待填写的实验记录
        /// </summary>
        /// <returns>待填写的实验记录 Exprecord</returns>
        public Exprecord GetCurrentExprecord(int labID)
        {
            Exprecord expRecord = new Exprecord();
            using(JszxDataManager jszxDateManage=new JszxDataManager()){
                //当前课节
                ClassTime ct = GetCurrentClassTime();

                 if (ct == null)
                 {
                     //当前不在上课时间,返回空的待填实验记录
                     return null;
                 }
                 else
                 {
                     //在上课时间,判断当前是否有课
                     //当前学期
                     Term tm = GetCurrentTerm();
                     //当前周次
                     int wk = GetCurrentWeeks();
                     //当前工作日
                     int weekDay = GetCurrentWeekDay();

                     schedule_tb scd_tb = jszxDateManage.GetScheduleByCls(labID,tm.TermID,wk,weekDay,ct.ClsTmIndex);

                     if (scd_tb == null)
                     {
                         //没课
                         return null;
                     }
                     else
                     {
                         //有课
                         //构建实验记录信息
                         expRecord.CourseName = scd_tb.courses_tb.CrsName;
                         expRecord.ExpClasses = scd_tb.courses_tb.CrsClasses;
                         expRecord.ExpCls = (sbyte?)scd_tb.ScdClass;
                         expRecord.ExpDate = DateTime.Now;
                         expRecord.ExpLab = scd_tb.labs_tb.LabName;
                         expRecord.ExpLabID = scd_tb.ScdLab;
                         expRecord.ExpName = "";
                         expRecord.ExpTerm = scd_tb.ScdTerm;
                         expRecord.ExpWeek = scd_tb.ScdWeek;
                         expRecord.ExpWeekDay = scd_tb.ScdWeekDay;
                         expRecord.Groups = scd_tb.courses_tb.CrsNum;
                         expRecord.InstrumentStatus = "正常";
                         expRecord.PerGroup = 1;
                         expRecord.Problems = "无";
                         expRecord.Realizer = scd_tb.courses_tb.CrsNum;
                         expRecord.Shoulder = scd_tb.courses_tb.CrsNum;
                         expRecord.StudentStatus = "良好";
                         expRecord.TeacherName = scd_tb.courses_tb.CrsTeacher;
                     }

                 }
             }

            return expRecord;
        }
Exemple #4
0
        public EditTerm()
        {
            InitializeComponent();

            //查询当前学期
            jdm = new JszxDataManager();
            tm = jdm.GetCurrentTerm();
            SetTermContent();
        }
Exemple #5
0
 /// <summary>
 /// 获取课节时间列表
 /// </summary>
 /// <returns>课节时间列表</returns>
 public List<ClassTime> GetClassTimeList()
 {
     List<ClassTime> ClsTimeList = new List<ClassTime>();
     using (JszxDataManager jszxDateManage = new JszxDataManager())
     {
         List<classtimes_tb> ClassTime_tbList = jszxDateManage.GetClassTimes(true);
         foreach(classtimes_tb cltdb in ClassTime_tbList){
             ClassTime clt = new ClassTime();
             clt.ClsTmEnd = cltdb.ClsTmEnd;
             clt.ClsTmIndex = cltdb.ClsTmIndex;
             clt.ClsTmName = cltdb.ClsTmName;
             clt.ClsTmStart = cltdb.ClsTmStart;
             ClsTimeList.Add(clt);
         }
     }
     return ClsTimeList;
 }
Exemple #6
0
 /// <summary>
 /// 获取当前的课节信息
 /// </summary>
 /// <returns>当前的课节信息</returns>
 public ClassTime GetCurrentClassTime()
 {
     ClassTime clt = new ClassTime();
     using (JszxDataManager jszxDateManage = new JszxDataManager())
     {
         classtimes_tb clt_tb = jszxDateManage.GetClsTimeByTimeSpan(TimeSpan.Parse(DateTime.Now.ToString("HH:mm:ss")));
         if (clt_tb == null)
         {
             return null;
         }
         else
         {
             clt.ClsTmEnd = clt_tb.ClsTmEnd;
             clt.ClsTmIndex = clt_tb.ClsTmIndex;
             clt.ClsTmName = clt_tb.ClsTmName;
             clt.ClsTmStart = clt_tb.ClsTmStart;
             return clt;
         }
     }
 }
Exemple #7
0
        private void StartInportBtn_Click_1(object sender, RoutedEventArgs e)
        {
            string table = this.ExcelTable.Text.Trim();
            string sql = string.Format("select * from [{0}]", table);
            SwitchTip.Text = "查询依赖信息";

            //try
            //{
                DataTable dt = SqlExcel.ExcuteSelect(this.ExcleFile.Text.Trim(), sql);
                int rowsCount = dt.Rows.Count;
                SwitchTip.Text = "共"+rowsCount+"条记录";
                SwitchProgressBar.Value = 10;
                JszxDataManager jszxDataManager = new JszxDataManager();
                //获取当前学期id
                SwitchTip.Text = "获取当前学期";
                SwitchProgressBar.Value = 40;
                int termID = jszxDataManager.GetCurrentTerm().TermID;
                //获取实验室列表
                SwitchTip.Text = "获取实验室列表";
                SwitchProgressBar.Value = 70;
                List<labs_tb> labs = jszxDataManager.GetLabs_tbList();
                #region 开始导入
                SwitchProgressBar.Value = 100;
                SwitchTip.Text = "获取实验室列表";
                SwitchProgressBar.Maximum = rowsCount;
                SwitchProgressBar.Value = 0;
                using (TransactionScope scope = new TransactionScope())
                {
                    for (int i = 0; i < rowsCount; i++)
                    {
                        SwitchTip.Text = "导入第" + (i + 1).ToString() + "条记录";
                        #region 保存课程信息
                        courses_tb course = new courses_tb();
                        //格式化第i行
                        DataRow dr = FormatDataRow(dt, i);
                        course.CrsName = dr["课程名称"].ToString();
                        //crsTeacher 教师姓名
                        course.CrsTeacher = dr["任课教师"].ToString();
                        //crsClass 上课班级
                        course.CrsClasses = dr["班级"].ToString();
                        //crsHour上机学时
                        course.CrsHour = Convert.ToInt32(dr["上机学时"]);
                        //crsTimes 上机次数
                        course.CrsTimes = Convert.ToInt32(dr["上机次数"]);
                        //crsNum 上机人数
                        course.CrsNum = Convert.ToInt32(dr["人数"]);
                        //crsConf  实验环境配置要求
                        course.CrsConf = dr["对软硬件环境的要求"].ToString();
                        //备注
                        course.CrsRemark = dr["备注"].ToString();

                        jszxDataManager.jszxEntity.courses_tb.Add(course);
                        jszxDataManager.jszxEntity.SaveChanges();
                        int courseID = course.CrsID;
                        #endregion
                        #region 保存课程安排
                        #region 处理实验室
                        //获取该条记录对应的实验室,根据每条记录的上机地点是否包含该实验室关键字确定是否包含实验室
                        string lab = dr["上机地点"].ToString();
                        List<int> courseLabs = new List<int>();
                        foreach (var drlab in labs)
                        {
                            if (lab.Contains(drlab.LabKeyWord))
                            {
                                courseLabs.Add(drlab.LabID);
                            }
                        }

                        if (courseLabs.Count == 0)
                        {
                            //此条记录没有对应的实验室,继续循环下一条
                            continue;
                        }

                        #endregion
                        #region 处理周次
                        string weekStr = dr["周"].ToString();

                        int isDouble = 0;
                        if (weekStr.Contains("双"))
                        {
                            isDouble = 2;
                        }
                        else if (weekStr.Contains("单"))
                        {
                            isDouble = 1;
                        }
                        List<int> weeks = GetListOfStr(weekStr, isDouble);
                        #endregion

                        #region 处理工作日
                        string weekdayStr = dr["星期"].ToString();
                        List<int> weekdays = GetListOfStr(weekdayStr, 0);
                        #endregion

                        #region 处理节次
                        string classStr = dr["节"].ToString();
                        List<int> classes = GetListOfStr(classStr, 0);
                        #endregion

                        #region 循环导入

                        //schtb.
                        foreach (int wk in weeks)
                        {
                            //周

                            foreach (int wkd in weekdays)
                            {
                                //工作日
                                foreach (int lb in courseLabs)
                                {
                                    //实验室
                                    foreach (int cls in classes)
                                    {
                                        schedule_tb schtb = new schedule_tb();
                                        schtb.ScdCrs = courseID;
                                        schtb.ScdTerm = termID;
                                        schtb.ScdWeek = (sbyte)wk;
                                        schtb.ScdWeekDay = (sbyte)wkd;
                                        schtb.ScdLab = lb;
                                        //节次
                                        schtb.ScdClass = cls;
                                        //保存至数据库
                                        jszxDataManager.jszxEntity.schedule_tb.Add(schtb);
                                        jszxDataManager.jszxEntity.SaveChanges();
                                    }
                                }
                            }
                        }
                        #endregion

                        #endregion
                        SwitchProgressBar.Value = i + 1;
                    }
                    scope.Complete();
                }
                #endregion
                SwitchTip.Text = "导入完成,正在保存数据";
                SwitchProgressBar.IsIndeterminate = true;

            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("出现错误:\n"+ex.Message);
            //}
        }
Exemple #8
0
        /// <summary>
        /// 保存实验记录
        /// </summary>
        /// <param name="exp">实验记录信息,不包含实验学期,和实验节次</param>
        /// <param name="selectedClass">实验记录节次的列表</param>
        public void SaveExpRecord(Exprecord exp, List<int> selectedClass)
        {
            using(JszxDataManager jszxDataManager=new JszxDataManager()){
                int tm = jszxDataManager.GetCurrentTerm().TermID;
                exp.ExpTerm = tm;
                foreach(int cls in selectedClass){
                    exp.ExpCls =(sbyte)cls;
                    exprecords_tb exptb = null;
                    //判断当前课是否填写过
                    exptb = jszxDataManager.GetExpRecords(tm, (int)exp.ExpLabID, (int)exp.ExpWeek, (int)exp.ExpWeekDay, (int)exp.ExpCls).FirstOrDefault();
                    if (exptb == null)
                    {
                        exptb = new exprecords_tb();
                    }
                    exptb.CourseName = exp.CourseName;
                    exptb.ExpClasses = exp.ExpClasses;
                    exptb.ExpCls = exp.ExpCls;
                    exptb.ExpDate = exp.ExpDate;
                    exptb.ExpLab = exp.ExpLab;
                    exptb.ExpLabID = exp.ExpLabID;
                    exptb.ExpName = exp.ExpName;
                    exptb.ExpTerm = exp.ExpTerm;
                    exptb.ExpWeek = exp.ExpWeek;
                    exptb.ExpWeekDay = exp.ExpWeekDay;
                    exptb.Groups = exp.Groups;
                    exptb.InstrumentStatus = exp.InstrumentStatus;
                    exptb.PerGroup = exp.PerGroup;
                    exptb.PostTime = exp.PostTime;
                    exptb.Problems = exp.Problems;
                    exptb.Realizer = exp.Realizer;
                    exptb.Shoulder = exp.Shoulder;
                    exptb.StudentName = exp.StudentName;
                    exptb.StudentStatus = exp.StudentStatus;
                    exptb.TeacherName = exp.TeacherName;
                    exptb.TeacherNumber = exp.TeacherNumber;

                    jszxDataManager.SaveExpRecord(exptb);

                }
            }
        }
Exemple #9
0
 public List<Term> GetTermList()
 {
     List<Term> terms = new List<Term>();
     using (JszxDataManager jszxDataManager = new JszxDataManager())
     {
         List<terms_tb> termtbs = jszxDataManager.GetTerms();
         foreach(var tmtb in termtbs){
             Term tm = new Term();
             tm.TermID = tmtb.TermID;
             tm.TermIndex = tmtb.TermIndex;
             tm.TermIsUse = tmtb.TermIsUse;
             tm.TermStartDay = tmtb.TermStartDay;
             tm.TermWeeks = tmtb.TermWeeks;
             tm.TermYear = tmtb.TermYear;
             terms.Add(tm);
         }
     }
     return terms;
 }
Exemple #10
0
 /// <summary>
 /// 获取指定学期
 /// </summary>
 /// <returns>指定学期</returns>
 public Term GetPurposeTerm(int id)
 {
     using (JszxDataManager jszxDateManage = new JszxDataManager())
     {
         terms_tb tmtb = jszxDateManage.GetCurrentTerm(id);
         Term tm = new Term();
         if (tmtb != null)
         {
             tm.TermID = tmtb.TermID;
             tm.TermIndex = tmtb.TermIndex;
             tm.TermIsUse = tmtb.TermIsUse;
             tm.TermStartDay = tmtb.TermStartDay;
             tm.TermWeeks = tmtb.TermWeeks;
             tm.TermYear = tmtb.TermYear;
         }
         return tm;
     }
 }
Exemple #11
0
        /// <summary>
        /// 获取弹窗倒计时时间
        /// </summary>
        /// <returns>弹窗倒计时时间</returns> 
        public int GetPopTimeTallies()
        {
            int tallies = 100;
            using (JszxDataManager jszxDateManage = new JszxDataManager())
            {
                List<poptimes_tb> popTimeList= jszxDateManage.GetPopTimes(true);
                //遍历获取当距离当前最近的弹出时间
                TimeSpan latestTime ;
                TimeSpan nowTime = TimeSpan.Parse(DateTime.Now.ToString("HH:mm:ss"));

               latestTime= popTimeList.OrderBy(p => p.PopTime).Where(p => p.PopTime > nowTime).FirstOrDefault().PopTime;
               tallies =(int)( latestTime.TotalSeconds - nowTime.TotalSeconds);
            }
            return tallies;
        }
Exemple #12
0
        public PageRecord GetPageRecords(SearchRecordParam pm)
        {
            PageRecord pageRecord = new PageRecord();
            using (JszxDataManager jszxDataManager = new JszxDataManager())
            {
                PageExpRecord _pageRecord = jszxDataManager.GetPageExpRecords(pm.term,pm.lab,pm.week,pm.weekday,pm.cls,pm.teacherNum,pm.page,pm.pageSize);
                foreach(var red in _pageRecord.ExpRecordList){

                    Exprecord exprd = new Exprecord();
                    exprd.CourseName = red.CourseName;
                    exprd.ExpClasses = red.ExpClasses;
                    exprd.ExpCls = red.ExpCls;
                    exprd.ExpDate = red.ExpDate;
                    exprd.ExpLab = red.ExpLab;
                    exprd.ExpLabID = red.ExpLabID;
                    exprd.ExpName = red.ExpName;
                    exprd.ExpTerm = red.ExpTerm;
                    exprd.ExpWeek = red.ExpWeek;
                    exprd.ExpWeekDay = red.ExpWeekDay;
                    exprd.Groups = red.Groups;
                    exprd.InstrumentStatus = red.InstrumentStatus;
                    exprd.PerGroup = red.PerGroup;
                    exprd.PostTime = red.PostTime;
                    exprd.Problems = red.Problems;
                    exprd.Realizer = red.Realizer;
                    exprd.RecordID = red.RecordID;
                    exprd.Shoulder = red.Shoulder;
                    exprd.StudentName = red.StudentName;
                    exprd.StudentStatus = red.StudentStatus;
                    exprd.TeacherName = red.TeacherName;
                    exprd.TeacherNumber = red.TeacherNumber;

                    pageRecord.ExpRecordList.Add(exprd);
                }

                pageRecord.Page = _pageRecord.Page;
                pageRecord.Pages = _pageRecord.Pages;
                pageRecord.PageSize = _pageRecord.PageSize;
            }
            return pageRecord;
        }
Exemple #13
0
        /// <summary>
        /// 获取实验室列表
        /// </summary>
        /// <returns>实验室列表</returns>
        public List<Lab> GetLabList()
        {
            List<Lab> labs = new List<Lab>();
               using (JszxDataManager jszxDateManage = new JszxDataManager())
               {
               List<labs_tb> lab_tbs = jszxDateManage.GetLabs_tbList();

               foreach (labs_tb lb_tb in lab_tbs)
               {
                   Lab lb = new Lab();
                   lb.LabAddr = lb_tb.LabAddr;
                   lb.LabAdmin = lb_tb.LabAdmin;
                   lb.LabID = lb_tb.LabID;
                   lb.LabIP = lb_tb.LabIP;
                   lb.LabKeyWord = lb_tb.LabKeyWord;
                   lb.LabName = lb_tb.LabName;

                   labs.Add(lb);
               }
               }
               return labs;
        }
Exemple #14
0
        /// <summary>
        /// 获取当前时间实验是否需要填写
        /// </summary>
        /// <param name="labID">实验室ID</param>
        /// <returns>带填写标识的记录</returns>
        public ExpRecordWithFlag GetExpRecordWithFlag(int labID)
        {
            ExpRecordWithFlag expFlag = new ExpRecordWithFlag();
            int signFlag = 0;
            Exprecord expRecord = new Exprecord();
            using (JszxDataManager jszxDateManage = new JszxDataManager())
            {
                //当前课节
                ClassTime ct = GetCurrentClassTime();

                if (ct == null)
                {
                    //当前不在上课时间,返回空的待填实验记录
                    signFlag = 0;
                }
                else
                {
                    //在上课时间,判断当前是否有课
                    //当前学期
                    Term tm = GetCurrentTerm();
                    //当前周次
                    int wk = GetCurrentWeeks();
                    //当前工作日
                    int weekDay = GetCurrentWeekDay();

                    schedule_tb scd_tb = jszxDateManage.GetScheduleByCls(labID, tm.TermID, wk, weekDay, ct.ClsTmIndex);

                    if (scd_tb == null)
                    {
                        //没课,不需要填写
                        signFlag = 0;
                        expRecord = null;
                    }
                    else
                    {
                        //有课
                        //查询是否填写

                        exprecords_tb exp_tb = jszxDateManage.GetExprecordByCls(labID, tm.TermID, wk, weekDay, ct.ClsTmIndex);
                        if (exp_tb == null)
                        {
                            //未填写
                            signFlag = 3;
                            //未填写,构建实验记录,返回填写
                            expRecord.CourseName = scd_tb.courses_tb.CrsName;
                            expRecord.ExpClasses = scd_tb.courses_tb.CrsClasses;
                            expRecord.ExpCls = (sbyte?)scd_tb.ScdClass;
                            expRecord.ExpDate = DateTime.Now;
                            expRecord.ExpLab = scd_tb.labs_tb.LabName;
                            expRecord.ExpLabID = scd_tb.ScdLab;
                            expRecord.ExpName = "";
                            expRecord.ExpTerm = scd_tb.ScdTerm;
                            expRecord.ExpWeek = scd_tb.ScdWeek;
                            expRecord.ExpWeekDay = scd_tb.ScdWeekDay;
                            expRecord.Groups = scd_tb.courses_tb.CrsNum;
                            expRecord.InstrumentStatus = "正常";
                            expRecord.PerGroup = 1;
                            expRecord.Problems = "无";
                            expRecord.Realizer = scd_tb.courses_tb.CrsNum;
                            expRecord.Shoulder = scd_tb.courses_tb.CrsNum;
                            expRecord.StudentStatus = "良好";
                            expRecord.TeacherName = scd_tb.courses_tb.CrsTeacher;
                            expRecord.StudentName = "";
                            expRecord.TeacherNumber = "";
                            //expRecord.PostTime =

                        }
                        else
                        {
                            //已经填写
                            if (exp_tb.CourseName == scd_tb.courses_tb.CrsName)
                            {
                                //课程名称相同,判断为正确的记录
                                expRecord = null;
                                signFlag = 1;
                            }
                            else
                            {
                                //课程名称不相同,错误的填写记录
                                signFlag = 2;

                                //返回待确认记录
                                //未填写,构建实验记录,返回填写
                                expRecord.CourseName = exp_tb.CourseName;
                                expRecord.ExpClasses = exp_tb.ExpClasses;
                                expRecord.ExpCls = exp_tb.ExpCls;
                                expRecord.ExpDate = exp_tb.ExpDate;
                                expRecord.ExpLab = exp_tb.ExpLab;
                                expRecord.ExpLabID = exp_tb.ExpLabID;
                                expRecord.ExpName = exp_tb.ExpName;
                                expRecord.ExpTerm = exp_tb.ExpTerm;
                                expRecord.ExpWeek = exp_tb.ExpWeek;
                                expRecord.ExpWeekDay = exp_tb.ExpWeekDay;
                                expRecord.Groups = exp_tb.Groups;
                                expRecord.InstrumentStatus = exp_tb.InstrumentStatus;
                                expRecord.PerGroup = exp_tb.PerGroup;
                                expRecord.Problems = exp_tb.Problems;
                                expRecord.Realizer = exp_tb.Realizer;
                                expRecord.Shoulder = exp_tb.Shoulder;
                                expRecord.StudentStatus = exp_tb.StudentStatus;
                                expRecord.TeacherName = exp_tb.TeacherName;
                                expRecord.StudentName = exp_tb.StudentName;
                                expRecord.TeacherNumber = exp_tb.TeacherNumber;
                                expRecord.PostTime = exp_tb.PostTime;
                            }
                        }
                    }
                }
            }
            expFlag.SignFlag = signFlag;
            expFlag.ExpRecord = expRecord;
            return expFlag;
        }