示例#1
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="basedata"></param>
 /// <returns></returns>
 public int Add(basedata basedata)
 {
     return((int)dbContext.Insert <basedata>(() => new basedata()
     {
         collegeid = basedata.collegeid,
         subclassesid = basedata.subclassesid,
         coursesid = basedata.coursesid
     }));
 }
示例#2
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="users"></param>
        /// <param name="classtime"></param>
        /// <returns></returns>
        /// 修改时间 2018-9-19 22:10:16
        public BaseResult Update(users users, view_classtime_all classtime)
        {
            classtime classtimeTemp = new classtime();

            result.code = 0;
            if (classtime.week == 0 || classtime.week == null)
            {
                result.code = -2;
                result.msg  = "请选择星期";
                return(result);
            }

            if (classtime.lesson == 0 || classtime.lesson == null)
            {
                result.code = -2;
                result.msg  = "请选择课节";
                return(result);
            }
            if (users.collegeid != classtime.collegeid && users.dicvalue != "0")
            {
                result.code = -2;
                result.msg  = "您无权添加其他学院的课表信息!";
                return(result);
            }

            if (classtime.coursesid != null && dalCourses.Single((int)classtime.coursesid).collegeid != classtime.collegeid)
            {
                result.code = -2;
                result.msg  = "该学院无此课程!请检查讲师所属学院!";
                return(result);
            }

            if (classtime.collegeid != null && classtime.subclassesid != null && classtime.coursesid != null)
            {
                int ishave = dalBasedata.IsHave((int)classtime.collegeid, (int)classtime.subclassesid, (int)classtime.coursesid);
                if (ishave == 0)
                {
                    basedata basedata = new basedata();
                    basedata.collegeid    = classtime.collegeid;
                    basedata.subclassesid = classtime.subclassesid;
                    basedata.coursesid    = classtime.coursesid;
                    ishave = dalBasedata.Add(basedata);
                }

                classtimeTemp.basedataid = ishave;
            }

            classtimeTemp.week      = classtime.week;
            classtimeTemp.lesson    = classtime.lesson;
            classtimeTemp.classroom = classtime.classroom;
            if (classtime.id == 0)
            {
                dalClasstimeAll.Add(classtimeTemp);
                return(result);
            }
            else
            {
            }

            classtimeTemp.id = classtime.id;
            dalClasstimeAll.Update(classtimeTemp);
            return(result);
        }