Exemple #1
0
 /// <summary>
 /// 插入课程
 /// </summary>
 /// <param name="model"></param>
 public bool UpdateCo_Course(Co_Course model)
 {
     using (IDbConnection conn = OpenConnection())
     {
         const string sql   = @"Update dbo.Co_Course SET Code=@Code,CourseName=@CourseName,Year=@Year,Month=@Month,YearPlan=@YearPlan,PreCourseTime=@PreCourseTime,Day=@Day,OpenLevel=@OpenLevel,IsCPA=@IsCPA,IsMust=@IsMust,IsSystem=@IsSystem,IsYearPlan=@IsYearPlan,CourseLength=@CourseLength,Way=@Way,Teacher=@Teacher,Publishflag=@Publishflag,LastUpdateTime=@LastUpdateTime,SurveyPaperId=@SurveyPaperId,CourseFrom=@CourseFrom,IsDelete=@IsDelete WHERE Id=@Id";
         var          param = new
         {
             Year           = model.Year,
             Month          = model.Month,
             YearPlan       = model.Year,
             Code           = model.Code,
             CourseName     = model.CourseName,
             PreCourseTime  = model.PreCourseTime,
             Day            = model.Day,
             OpenLevel      = model.OpenLevel,
             IsCPA          = model.IsCPA,
             IsMust         = model.IsMust,
             CourseLength   = model.CourseLength,
             Way            = model.Way,
             Teacher        = model.Teacher,
             SurveyPaperId  = model.SurveyPaperId,
             CourseFrom     = model.CourseFrom,
             Publishflag    = 0,
             LastUpdateTime = model.LastUpdateTime,
             IsDelete       = 0,
             IsSystem       = model.IsSystem,
             IsYearPlan     = model.IsYearPlan,
             Id             = model.Id
         };
         int result = conn.Execute(sql, param);
         return(result > 0);
     }
 }
Exemple #2
0
        public List <Co_CourseShow> GetCourseAvg(out int totalcount, int CourseID, int startIndex = 1, int startLength = int.MaxValue, string order = "tab.UserID asc")
        {
            int       CoexmaID   = 0;
            int       TeexmaID   = 0;
            Co_Course comodel    = courseDb.GetCo_Course(CourseID);
            var       ArrayValue = comodel.SurveyPaperId.Split(';');

            if (!string.IsNullOrEmpty(ArrayValue[0]))
            {
                var ArrValue = ArrayValue[0].Split(',');
                CoexmaID = Convert.ToInt32(ArrValue[1]);
            }
            if (!string.IsNullOrEmpty(ArrayValue[1]))
            {
                var ArrValue = ArrayValue[1].Split(',');
                TeexmaID = Convert.ToInt32(ArrValue[1]);
            }
            List <Co_CourseShow> list = courseDb.GetCourseAvg(CourseID, CoexmaID, TeexmaID, startIndex, startLength, order);

            totalcount = list.Count > 0 ? list[0].totalcount : 0;
            foreach (var item in list)
            {
                item.SurveyPaperId = comodel.SurveyPaperId;
                item.Realname      = item.Realname.HtmlXssEncode();
                item.DeptName      = item.DeptName.HtmlXssEncode();
                item.TeacherName   = comodel.TeacherName.HtmlXssEncode();
                item.CourseId      = CourseID;
                if (item.CoAvg == null)
                {
                    item.CoAvg = 0;
                }
                if (item.TeAvg == null)
                {
                    item.TeAvg = 0;
                }
            }
            return(list);
        }
Exemple #3
0
        public bool UpdateCourse(Co_Course model)
        {
            using (IDbConnection connection = OpenConnection())
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"update [Co_Course] set CourseName=@CourseName,Code=@Code,Year=@Year,Month=@Month,Day=@Day,
            OpenLevel=@OpenLevel,
            IsMust=@IsMust,
            Way=@Way,
            Teacher=@Teacher,
            StartTime=@StartTime,
            EndTime=@EndTime,
            Sort=@Sort,
            CourseLength=@CourseLength,
            RoomId=@RoomId,
            NumberLimited=@NumberLimited,
            IsCPA=@IsCPA,
            AdFlag=@AdFlag,
            IsOrder=@IsOrder,
            IsLeave=@IsLeave,
            IsRT=@IsRT,
            OpenFlag=@OpenFlag,
            OpenGroupObject=@OpenGroupObject,
            OpenDepartObject=@OpenDepartObject,
            IsTest=@IsTest,
            IsPing=@IsPing,
            SurveyPaperId=@SurveyPaperId,
            Memo=@Memo,
            CourseFrom=@CourseFrom,
            StopOrderFlag=@StopOrderFlag,
            StopDucueFlag=@StopDucueFlag,
            ReturnTimes=@ReturnTimes,
            AfterOrderTimes=@AfterOrderTimes,
           PreAdviceConfigTime=@PreAdviceConfigTime,
            AfterEvlutionConfigTime=@AfterEvlutionConfigTime,
            PreCourseTime=@PreCourseTime,
            Publishflag=@Publishflag,
            LastUpdateTime=@LastUpdateTime,
            IsDelete=@IsDelete,
            YearPlan =@YearPlan,
            IsSystem=@IsSystem,
            IsYearPlan=@IsYearPlan,
            CourseLengthDistribute=@CourseLengthDistribute,
            IsOpenSub=@IsOpenSub,
 TrainDays=@TrainDays,CourseAddress=@CourseAddress,CourseObjectMemo=@CourseObjectMemo,OpenPerson=@OpenPerson,CpaTeacher=@CpaTeacher,CourseTimes=@CourseTimes,AttFlag=@AttFlag 
,courseProvide = @courseprovide,studyRequirement = @studyrequirement,remark = @remark
             where Id=@Id ");
                var param = new
                {
                    model.Id,
                    model.CourseName,
                    model.Code,
                    model.Year,
                    model.Month,
                    model.Day,
                    model.OpenLevel,
                    model.IsMust,
                    model.Way,
                    model.Teacher,
                    model.StartTime,
                    model.EndTime,
                    model.Sort,
                    model.CourseLength,
                    model.RoomId,
                    model.NumberLimited,
                    model.IsCPA,
                    model.AdFlag,
                    model.IsOrder,
                    model.IsLeave,
                    model.IsRT,
                    model.OpenFlag,
                    model.OpenGroupObject,
                    model.OpenDepartObject,
                    model.IsTest,
                    model.IsPing,
                    model.SurveyPaperId,
                    model.Memo,
                    model.CourseFrom,
                    model.StopOrderFlag,
                    model.StopDucueFlag,
                    model.ReturnTimes,
                    model.AfterOrderTimes,
                    model.PreAdviceConfigTime,
                    model.AfterEvlutionConfigTime,
                    model.PreCourseTime,
                    model.Publishflag,
                    model.LastUpdateTime,
                    model.IsDelete,
                    model.YearPlan,
                    model.TrainDays,
                    model.CourseAddress,
                    model.CourseObjectMemo,
                    model.OpenPerson,
                    model.CpaTeacher,
                    model.CourseTimes,
                    model.AttFlag,
                    model.IsSystem,
                    model.IsYearPlan,
                    model.CourseLengthDistribute,
                    model.IsOpenSub,
                    model.courseProvide,
                    model.studyRequirement,
                    model.remark
                };
                return(connection.Execute(strSql.ToString(), param) > 0);
            }
        }
Exemple #4
0
        /// <summary>
        /// 新增课程
        /// </summary>
        /// <param name="model"></param>
        public void AddCourse(Co_Course model)
        {
            using (IDbConnection connection = OpenConnection())
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into [Co_Course] (");
                strSql.Append(@"CourseName,Code,Year,Month,Day,OpenLevel,IsMust,Way,Teacher,StartTime,EndTime,Sort,CourseLength,RoomId,NumberLimited,IsCPA,AdFlag,IsOrder,IsLeave,IsRT,OpenFlag,OpenGroupObject,OpenDepartObject,IsTest,IsPing,SurveyPaperId,Memo,CourseFrom,StopOrderFlag,StopDucueFlag,ReturnTimes,AfterOrderTimes,AttFlag,PreAdviceConfigTime,AfterEvlutionConfigTime,PreCourseTime,Publishflag,CourseTimes,LastUpdateTime,IsDelete,TrainDays,CourseAddress,CourseObjectMemo,OpenPerson,CpaTeacher,YearPlan,IsSystem,IsYearPlan,CourseLengthDistribute,IsOpenSub,courseProvide,studyRequirement,remark)");
                strSql.Append(" values (");
                strSql.Append(@"@CourseName,@Code,@Year,@Month,@Day,@OpenLevel,@IsMust,@Way,@Teacher,@StartTime,@EndTime,@Sort,@CourseLength,@RoomId,@NumberLimited,@IsCPA,@AdFlag,@IsOrder,@IsLeave,@IsRT,@OpenFlag,@OpenGroupObject,@OpenDepartObject,@IsTest,@IsPing,@SurveyPaperId,@Memo,@CourseFrom,@StopOrderFlag,@StopDucueFlag,@ReturnTimes,@AfterOrderTimes,@AttFlag,@PreAdviceConfigTime,@AfterEvlutionConfigTime,@PreCourseTime,@Publishflag,@CourseTimes,@LastUpdateTime,@IsDelete,@TrainDays,@CourseAddress,@CourseObjectMemo,@OpenPerson,@CpaTeacher,@YearPlan,@IsSystem,@IsYearPlan,@CourseLengthDistribute,@IsOpenSub,@courseProvide,@studyRequirement,@remark)");
                strSql.Append(";select @@IDENTITY");
                var param = new
                {
                    model.CourseName,
                    model.Code,
                    model.Year,
                    model.Month,
                    model.Day,
                    model.OpenLevel,
                    model.IsMust,
                    model.Way,
                    model.Teacher,
                    model.StartTime,
                    model.EndTime,
                    model.Sort,
                    model.CourseLength,
                    model.RoomId,
                    model.NumberLimited,
                    model.IsCPA,
                    model.AdFlag,
                    model.IsOrder,
                    model.IsLeave,
                    model.OpenFlag,
                    model.IsRT,
                    model.OpenGroupObject,
                    model.OpenDepartObject,
                    model.IsTest,
                    model.IsPing,
                    model.SurveyPaperId,
                    model.Memo,
                    model.CourseFrom,
                    model.StopOrderFlag,
                    model.StopDucueFlag,
                    model.ReturnTimes,
                    model.AfterOrderTimes,
                    model.PreAdviceConfigTime,
                    model.AfterEvlutionConfigTime,
                    model.PreCourseTime,
                    model.Publishflag,
                    model.CourseTimes,
                    model.LastUpdateTime,
                    model.IsDelete,
                    model.TrainDays,
                    model.CourseAddress,
                    model.CourseObjectMemo,
                    model.OpenPerson,
                    model.CpaTeacher,
                    model.YearPlan,
                    model.AttFlag,
                    model.IsSystem,
                    model.IsYearPlan,
                    model.CourseLengthDistribute,
                    model.IsOpenSub,
                    model.courseProvide,
                    model.studyRequirement,
                    model.remark
                };

                decimal id =
                    connection.Query <decimal>(strSql.ToString(), param)
                    .FirstOrDefault();
                model.Id = decimal.ToInt32(id);
            }
        }
Exemple #5
0
        /// <summary>
        /// 考勤结束计算学时
        /// </summary>
        /// <param name="CourseId"></param>
        /// <param name="userid"></param>
        public void UpScore(int CourseId, int userid, DateTime starttime, DateTime endtime)
        {
            decimal         GetScore      = 0;
            decimal         AttLessLength = 0;
            decimal         LessLength    = 0;
            Co_Course       coUser        = AttDB.GetCoAndUser(CourseId, userid);
            Cl_Attendce     attmodel      = clAttDB.GetCl_Attendce(CourseId, userid);
            Sys_ParamConfig param         = paramConfigDB.GetSys_ParamConfig(5);
            //Sys_ParamConfig param1 = paramConfigDB.GetSys_ParamConfig(24);
            //违纪学时配置
            var configstr = param.ConfigValue.ToString();
            //课程学时比例配置
            var configstr1 = coUser.CourseLengthDistribute;
            var cstr1      = configstr1.Split(';');
            //违纪学时组装配置集合
            var configList = new List <TempConfig>();

            foreach (var constr in configstr.Split(';'))
            {
                if (constr != "")
                {
                    var str = constr.Split(',');
                    configList.Add(new TempConfig
                    {
                        EndMinite   = Convert.ToInt32(str[2]),
                        Percent     = Convert.ToInt32(str[3]),
                        StartMinite = Convert.ToInt32(str[1]),
                        Type        = Convert.ToInt32(str[0])
                    });
                }
            }
            //计算违纪学时
            if (coUser.AttFlag == 1 && starttime.Year != 2050)
            {
                LessLength = GetLessLength(configList, coUser.AttFlag, coUser.StartTime, coUser.EndTime, starttime, endtime, coUser.CourseLength);
            }
            else if (coUser.AttFlag == 2 && endtime.Year != 2000)
            {
                LessLength = GetLessLength(configList, coUser.AttFlag, coUser.StartTime, coUser.EndTime, starttime, endtime, coUser.CourseLength);
            }
            else if (coUser.AttFlag == 3 && (starttime.Year != 2050 || endtime.Year != 2000))
            {
                LessLength = GetLessLength(configList, coUser.AttFlag, coUser.StartTime, coUser.EndTime, starttime, endtime, coUser.CourseLength);
            }
            string         whereStr = string.Format(" where CourseId={0} and UserId={1}", CourseId, userid);
            Cl_CourseOrder Comodel  = CoDB.Getmodel(whereStr);

            //计算课程总学时,违纪学时
            //根据课程编号判断是否第一次学习
            if (AttDB.ExistAtts(CourseId, userid))
            {
                if (coUser.AttFlag == 1 && starttime.Year == 2050)
                {
                    GetScore      = 0;
                    AttLessLength = 0;
                }
                else if (coUser.AttFlag == 2 && endtime.Year == 2000)
                {
                    GetScore      = 0;
                    AttLessLength = 0;
                }
                else if (coUser.AttFlag == 3 && starttime.Year == 2050 && endtime.Year == 2000)
                {
                    GetScore      = 0;
                    AttLessLength = 0;
                }
                else
                {
                    //判断是否有课后评估
                    if (coUser.IsTest == 0 && coUser.IsPing == 0)
                    {
                        GetScore      = coUser.CourseLength - LessLength;
                        AttLessLength = 0 - LessLength;
                    }
                    else
                    {
                        decimal attLength = coUser.CourseLength * (Convert.ToDecimal(cstr1[0])) / 100;
                        GetScore      = attLength - LessLength;
                        GetScore      = Math.Round(GetScore, 2, MidpointRounding.AwayFromZero);
                        AttLessLength = 0 - LessLength;
                    }
                }
                //折算CPA学时
                if (coUser.Way == 1 && coUser.IsCPA == 1)
                {
                    if (Comodel != null && Comodel.AttFlag == 0)
                    {
                        Cl_CpaLearnStatus CPAmodel = cpastatDB.GetCl_CpaLearnStatusByCourseId(CourseId, userid);

                        if (CPAmodel == null)
                        {
                            CPAmodel            = new Cl_CpaLearnStatus();
                            CPAmodel.CourseID   = CourseId;
                            CPAmodel.UserID     = userid;
                            CPAmodel.IsAttFlag  = 0;
                            CPAmodel.IsPass     = 1;
                            CPAmodel.Progress   = 0;
                            CPAmodel.LearnTimes = 0;
                            if (coUser.IsMust == 1)
                            {
                                CPAmodel.GetLength = Math.Round((GetScore * 50 / 100), 2, MidpointRounding.AwayFromZero);
                            }
                            else
                            {
                                CPAmodel.GetLength = GetScore;
                            }
                            CPAmodel.CpaFlag     = 2;
                            CPAmodel.GradeStatus = 1;
                            cpastatDB.SubscribeCPALearnStatus(CPAmodel);
                        }
                        else
                        {
                            CPAmodel.IsAttFlag  = 0;
                            CPAmodel.IsPass     = 1;
                            CPAmodel.Progress   = 0;
                            CPAmodel.LearnTimes = 0;
                            if (coUser.IsMust == 1)
                            {
                                decimal linshi = Convert.ToDecimal((CPAmodel.GetLength * 2) - Comodel.AttScore + GetScore);
                                CPAmodel.GetLength = Math.Round((linshi * 50 / 100), 2, MidpointRounding.AwayFromZero);
                            }
                            else
                            {
                                CPAmodel.GetLength = (CPAmodel.GetLength - Comodel.AttScore) + GetScore;
                            }

                            CPAmodel.CpaFlag     = 2;
                            CPAmodel.GradeStatus = 1;
                            cpastatDB.UpdateCPALearnStatus(CPAmodel);
                        }
                    }
                }
            }
            else
            {
                GetScore      = 0;
                AttLessLength = 0;
            }

            if (Comodel != null && Comodel.AttFlag == 0)
            {
                Comodel.GetScore = GetScore + (Comodel.GetScore - Comodel.AttScore);
                Comodel.AttScore = GetScore;
                CoDB.Update(Comodel);
            }
            if (attmodel != null)
            {
                if (Comodel != null && Comodel.AttFlag == 0)
                {
                    attmodel.LessLength = AttLessLength;
                    clAttDB.UpdateAttendce(attmodel);
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// 补预订
        /// </summary>
        /// <param name="CourseId">课程ID</param>
        /// <param name="userid">用户ID</param>
        public void MakeUpOrder(int CourseId, int userid)
        {
            Co_Course jobmodel = AttDB.GetJobID(CourseId, userid);
            Sys_User  leamodel = GetLeaderIdByUserId(userid);

            string where = string.Format(" where CourseId={0} and UserId={1}", CourseId, userid);
            Cl_MakeUpOrder  model = clMakeDB.GetModel(where);
            Sys_ParamConfig param = paramConfigDB.GetSys_ParamConfig(23);

            if (model == null)
            {
                model          = new Cl_MakeUpOrder();
                model.CourseId = CourseId;
                model.UserId   = userid;
                if (leamodel == null)
                {
                    model.ApprovalUser = "";
                }
                else
                {
                    model.ApprovalUser = leamodel.JobNum;
                }
                model.ApprovalMemo      = "";
                model.ApprovalFlag      = 0;
                model.ApprovalDateTime  = DateTime.Now;
                model.ApprovalLimitTime = DateTime.Now.AddHours(Convert.ToDouble(param.ConfigValue));
                model.LeaveUserID       = jobmodel.JobNum;
                model.IsTimeOut         = 0;
                model.Name            = jobmodel.TeacherName;
                model.CourseName      = jobmodel.CourseName;
                model.LeaveTime       = DateTime.Now;
                model.CourseStartTime = jobmodel.StartTime;
                model.CourseEndTime   = jobmodel.EndTime;
                model.AttStartTime    = jobmodel.attStartTime;
                model.AttEndTime      = jobmodel.attEndTime;
                clMakeDB.Add(model);
            }
            else
            {
                if (leamodel == null)
                {
                    model.ApprovalUser = "";
                }
                else
                {
                    model.ApprovalUser = leamodel.JobNum;
                }
                model.ApprovalMemo      = "";
                model.ApprovalFlag      = 0;
                model.ApprovalDateTime  = DateTime.Now;
                model.ApprovalLimitTime = DateTime.Now.AddHours(Convert.ToDouble(param.ConfigValue));
                model.IsTimeOut         = 0;
                model.LeaveUserID       = jobmodel.JobNum;
                model.Name            = jobmodel.TeacherName;
                model.CourseName      = jobmodel.CourseName;
                model.LeaveTime       = DateTime.Now;
                model.CourseStartTime = jobmodel.StartTime;
                model.CourseEndTime   = jobmodel.EndTime;
                model.AttStartTime    = jobmodel.attStartTime;
                model.AttEndTime      = jobmodel.attEndTime;
                clMakeDB.Update(model);
            }
        }
Exemple #7
0
        /// <summary>
        /// 添加月度计划,月计划和课程的关联
        /// </summary>
        /// <returns></returns>
        public JsonResult AddMonthPlanAndCourse()
        {
            try
            {
                var     monPlan  = Request.Form["monPlan"];
                dynamic plandata = Newtonsoft.Json.JsonConvert.DeserializeObject(monPlan);

                var plan = new Tr_MonthPlan()
                {
                    Id     = plandata.id,
                    Year   = plandata.year,
                    Month  = plandata.month,
                    UserId = CurrentUser.UserId
                };

                var monthPlanID = plan.Id;
                var dic         = new Dictionary <int, int>();

                //添加新课程之后的ID
                var newAddCourseID = "";
                var publish        = 0;

                if (!Imonth.IsExistMonplan(plan.Year, plan.Month, monthPlanID))
                {
                    if (monthPlanID == 0)
                    {
                        Imonth.InsertTr_MonthPlan(plan);
                        monthPlanID = plan.Id;
                    }
                    else
                    {
                        var Smonth = Imonth.Get(monthPlanID);
                        publish = Smonth == null ? 0 : Smonth.PublishFlag;
                        string courses = plandata.deleteCourse;
                        //如果是修改,需要添加新的课程的话,先把课程全部删了,我厉害吧
                        if (!string.IsNullOrEmpty(courses))
                        {
                            DeleteMonPlanCourse(monthPlanID, courses);
                        }
                    }

                    #region 添加课程 课程与计划的关联
                    if (plandata.newCourse.Count > 0)
                    {
                        for (int i = 0; i < plandata.newCourse.Count; i++)
                        {
                            Co_Course course = new Co_Course()
                            {
                                Code          = plandata.newCourse[i].Code,
                                CourseName    = plandata.newCourse[i].CourseName,
                                PreCourseTime = plandata.newCourse[i].PreCourseTime,
                                OpenLevel     = plandata.newCourse[i].OpenLevel,
                                IsMust        = plandata.newCourse[i].IsMust,
                                Way           = plandata.newCourse[i].Way,
                                Teacher       = plandata.newCourse[i].teacher,
                                SurveyPaperId = plandata.newCourse[i].id,
                                Year          = plandata.year,
                                Month         = plandata.month,
                                Publishflag   = publish,
                                Day           = 0,
                                CourseFrom    = 1,
                                CourseLength  = plandata.newCourse[i].CourseLength,
                                IsCPA         = plandata.newCourse[i].IsCPA,
                                RoomId        = plandata.newCourse[i].roomID,
                                IsSystem      = plandata.newCourse[i].IsSystem,
                                IsYearPlan    = 0
                            };
                            course.CourseName = course.CourseName.HtmlDecode();
                            Imonth.InsertCo_Course(course);

                            if (course.Id > 0 && monthPlanID > 0)
                            {
                                var model = new Tr_MonthPlanCourse()
                                {
                                    MonthId  = monthPlanID,
                                    CourseId = course.Id,
                                    IsSystem = plandata.newCourse[i].IsSystem
                                };
                                Imonth.InsertTr_MonthPlanCourse(model);
                            }
                        }
                    }
                    #endregion

                    return(Json(new
                    {
                        result = 1,
                        monthPlanID = monthPlanID,
                        content = "添加成功"
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        result = 0,
                        content = plan.Year + "年" + plan.Month + ":此月度计划已经存在,请选择其他的时间"
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch
            {
                return(Json(new
                {
                    result = 0,
                    content = "添加失败"
                }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #8
0
 /// <summary>
 /// 插入课程
 /// </summary>
 /// <param name="model"></param>
 public void InsertCo_Course(Co_Course model)
 {
     monthDB.InsertCo_Course(model);
 }
Exemple #9
0
        /// <summary>
        /// 插入课程
        /// </summary>
        /// <param name="model"></param>
        public void InsertCo_Course(Co_Course model)
        {
            using (IDbConnection conn = OpenConnection())
            {
                const string sql   = @"INSERT INTO dbo.Co_Course
	                                (
                                    Code,
	                                CourseName,
                                    Year,
                                    Month,
                                    YearPlan,
	                                PreCourseTime,
                                    Day,
	                                OpenLevel,
                                    CourseLength,
                                    IsCPA,
	                                IsMust,
	                                Way,
	                                Teacher,
	                                Publishflag,
	                                LastUpdateTime,
                                    SurveyPaperId,
                                    CourseFrom,
	                                IsDelete,
                                    RoomId,
                                    IsSystem,
                                    IsYearPlan
	                                )
                                VALUES 
	                                (
                                    @code,
	                                @coursename,
                                    @Year,
                                    @Month,
                                    @YearPlan,
	                                @preCourseTime,
                                    @day,
	                                @openlevel,
                                    @courselength,
                                    @iscpa,
	                                @ismust,
	                                @way,
	                                @teacher,
	                                @publishflag,
	                                getdate(),
                                    @SurveyPaperId,
                                    @courseFrom,
	                                0,
                                    @roomId,
                                    @isSystem,
                                    @isYearPlan
	                                );SELECT @@IDENTITY as ID "    ;
                var          param = new
                {
                    Year          = model.Year,
                    Month         = model.Month,
                    YearPlan      = model.Year,
                    code          = model.Code,
                    coursename    = model.CourseName,
                    preCourseTime = model.PreCourseTime,
                    day           = model.Day,
                    openlevel     = model.OpenLevel,
                    courselength  = model.CourseLength,
                    iscpa         = model.IsCPA,
                    ismust        = model.IsMust,
                    way           = model.Way,
                    teacher       = model.Teacher,
                    SurveyPaperId = model.SurveyPaperId,
                    courseFrom    = model.CourseFrom,
                    publishflag   = model.Publishflag,
                    roomId        = model.RoomId,
                    isSystem      = model.IsSystem,
                    isYearPlan    = model.IsYearPlan
                };
                dynamic list = conn.Query <dynamic>(sql, param).FirstOrDefault();
                model.Id = decimal.ToInt32(list.ID);
            }
        }
Exemple #10
0
 /// <summary>
 /// 新增课程
 /// </summary>
 /// <param name="model"></param>
 public void AddCourse(Co_Course model)
 {
     courseDb.AddCourse(model);
 }
Exemple #11
0
 public bool UpdateCourse(Co_Course model)
 {
     return(courseDb.UpdateCourse(model));
 }
Exemple #12
0
 /// <summary>
 /// 更新课程信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateCo_Course(Co_Course model)
 {
     return(YearCourseDB.UpdateCo_Course(model));
 }
Exemple #13
0
 public JsonResult SubmitYear(int id, int selyear, string courlist, string DelID)
 {
     if (!string.IsNullOrEmpty(DelID) && id > 0)
     {
         DelID = DelID.Remove(DelID.LastIndexOf(","), 1);
         Iyear.DeleteCoursebyYear(id, DelID);
     }
     if (!string.IsNullOrEmpty(courlist))
     {
         courlist = courlist.Remove(courlist.LastIndexOf(","), 1);
         string[] course = Regex.Split(courlist, ",", RegexOptions.IgnoreCase);
         int      yearid = 0;
         try
         {
             if (id > 0)
             {
                 yearid = id;
             }
             else
             {
                 yearid = Iyear.InsertYear(new Tr_YearPlan
                 {
                     LastUpdateTime = DateTime.Now,
                     Year           = selyear,
                     UserID         = CurrentUser == null ? 0 : CurrentUser.UserId,
                     PublishFlag    = 0,
                     IsDelete       = 0
                 });
             }
             if (yearid > 0)
             {
                 for (int i = 0; i < course.Length; i++)
                 {
                     if (!string.IsNullOrEmpty(course[i]))
                     {
                         course[i] = course[i].Replace(" ", "+");
                         course[i] = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(course[i]));
                         course[i] = System.Web.HttpUtility.HtmlDecode(course[i]);
                         string[]  coList = course[i].Split('♣');
                         Co_Course model  = new Co_Course
                         {
                             CourseName     = HttpUtility.UrlDecode(coList[1]),
                             Code           = HttpUtility.UrlDecode(coList[2]),
                             Year           = Convert.ToInt32(coList[3]),
                             Month          = coList[4],
                             PreCourseTime  = DateTime.Now,
                             Day            = Convert.ToInt32(coList[5]),
                             OpenLevel      = coList[6],
                             IsCPA          = Convert.ToInt32(coList[13]),
                             IsMust         = Convert.ToInt32(coList[7]),
                             CourseLength   = Convert.ToDecimal(coList[14]),
                             Way            = Convert.ToInt32(coList[8]),
                             Teacher        = coList[9],
                             SurveyPaperId  = "0",
                             CourseFrom     = 0,
                             IsSystem       = Convert.ToInt32(coList[12]),
                             IsYearPlan     = 1,
                             LastUpdateTime = DateTime.Now
                         };
                         if (Convert.ToInt32(coList[0]) < 1)
                         {
                             Imonth.InsertCo_Course(model);
                             Iyear.InsertYearCourse(new Tr_YearPlanCourse
                             {
                                 YearId   = yearid,
                                 CourseId = model.Id,
                                 IsSystem = Convert.ToInt32(coList[12])
                             });
                         }
                         else
                         {
                             model.Id = Convert.ToInt32(coList[0]);
                             Iyear.UpdateCo_Course(model);
                         }
                     }
                 }
                 return(Json(new
                 {
                     result = 1,
                     content = "保存成功"
                 }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new
                 {
                     result = 0,
                     content = "保存失败"
                 }, JsonRequestBehavior.AllowGet));
             }
         }
         catch
         {
             return(Json(new
             {
                 result = 0,
                 content = "保存失败"
             }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(DelID) && id > 0)
         {
             return(Json(new
             {
                 result = 1,
                 content = "保存成功"
             }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new
             {
                 result = 0,
                 content = "保存失败"
             }, JsonRequestBehavior.AllowGet));
         }
     }
 }