Exemplo n.º 1
0
        public long SaveExpRecord(exprecords_tb exp)
        {
            if (exp.RecordID == 0)
            {
                //新添加
                jszxEntity.exprecords_tb.Add(exp);
            }
            else
            {
                //x更新
                exprecords_tb _exp = jszxEntity.exprecords_tb.Where(er => er.RecordID == exp.RecordID).FirstOrDefault();
                _exp.CourseName = exp.CourseName;
                _exp.ExpClasses = exp.ExpClasses;
                _exp.ExpCls = exp.ExpCls;
                _exp.ExpDate = exp.ExpDate;
                _exp.ExpLab = exp.ExpLab;
                _exp.ExpLabID = exp.ExpLabID;
                _exp.ExpName = exp.ExpName;
                _exp.ExpTerm = exp.ExpTerm;
                _exp.ExpWeek = exp.ExpWeek;
                _exp.ExpWeekDay = exp.ExpWeekDay;
                _exp.Groups = exp.Groups;
                _exp.InstrumentStatus = exp.InstrumentStatus;
                _exp.PerGroup = exp.PerGroup;
                _exp.PostTime = exp.PostTime;
                _exp.Problems = exp.Problems;
                _exp.Realizer = exp.Realizer;
                _exp.Shoulder = exp.Shoulder;
                _exp.StudentName = exp.StudentName;
                _exp.StudentStatus = exp.StudentStatus;
                _exp.TeacherName = exp.TeacherName;
                _exp.TeacherNumber = exp.TeacherNumber;

            }

            jszxEntity.SaveChanges();
            return exp.RecordID;
        }
Exemplo n.º 2
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);

                }
            }
        }