Beispiel #1
0
        /// <summary>
        /// 处理补预定流程的审批结果
        /// </summary>
        public void DealMakeUpCourseOrder(int times=0)
        {

            var makeupDb = new Cl_MakeUpOrderDB();
            var cpaDB = new Cl_CpaLearnStatusDB();
            //获取未审批的补预定数据
            var corderList = CoDB.GetAllList(string.Format("select CourseId,UserId,GetScore from Cl_CourseOrder where MakeUpApprovalFlag=0 and OrderStatus=3 order by Cl_CourseOrder.courseid,Cl_CourseOrder.approvaldatetime"));
            for (var i = 0; i < corderList.Count; i++)
            {
                var userID = Convert.ToInt32(corderList[i].UserId);
                var courseID = Convert.ToInt32(corderList[i].CourseId);
                var cmake = makeupDb.GetModel(string.Format(" where UserId={0} and CourseId={1}", userID, courseID));
                if (cmake != null)
                {
                    if (cmake.ApprovalFlag == 0 || (cmake.ApprovalFlag != 0 && cmake.ApprovalDateTime > cmake.ApprovalLimitTime))
                    {
                        //进入逾时补预定
                        var ctime = ApprovalDb.GetTimeOutOrder(string.Format(" where UserId={0} and CourseId={1}", userID, courseID));
                        if (ctime != null && ctime.ApprovalFlag != 0)
                        {
                            //判断是否达到补预定的上限
                            var havetime = CoDB.JudgeMakeUpTimes(userID);
                            if (havetime < times)
                            {
                                //正常审批
                                CoDB.ChangeCourseOrderInfor(
                                    string.Format(
                                        "update Cl_CourseOrder set GetScore={0}, MakeUpApprovalFlag={1} where UserId={2} and CourseId={3}",
                                        cmake.ApprovalFlag == 1 ? corderList[i].GetScore : 0M, cmake.ApprovalFlag,
                                        userID, courseID));
                                if (cmake.ApprovalFlag == 2)
                                {
                                    cpaDB.UpdateCPALearnStatus(
                                        string.Format(
                                            " update Cl_CpaLearnStatus set GetLength={0} where CourseID={1} and UserID={2} and CpaFlag=2",
                                            0M, courseID, userID));
                                }
                            }
                            else
                            {
                                //正常审批
                                CoDB.ChangeCourseOrderInfor(
                                    string.Format(
                                        "update Cl_CourseOrder set GetScore={0}, MakeUpApprovalFlag={1} where UserId={2} and CourseId={3}",
                                        0M, cmake.ApprovalFlag, userID, courseID));
                                cpaDB.UpdateCPALearnStatus(
                                    string.Format(
                                        " update Cl_CpaLearnStatus set GetLength={0} where CourseID={1} and UserID={2} and CpaFlag=2",
                                        0M, courseID, userID));

                            }
                        }
                    }
                    else
                    {
                        //判断是否达到补预定的上限
                        var havetime = CoDB.JudgeMakeUpTimes(userID);
                        if (havetime < times)
                        {
                            //正常审批
                            CoDB.ChangeCourseOrderInfor(
                                string.Format(
                                    "update Cl_CourseOrder set GetScore={0}, MakeUpApprovalFlag={1} where UserId={2} and CourseId={3}",
                                    cmake.ApprovalFlag == 1 ? corderList[i].GetScore : 0M, cmake.ApprovalFlag,
                                    userID,
                                    courseID));
                            if (cmake.ApprovalFlag == 2)
                            {
                                cpaDB.UpdateCPALearnStatus(
                                    string.Format(
                                        " update Cl_CpaLearnStatus set GetLength={0} where CourseID={1} and UserID={2} and CpaFlag=2",
                                        0M, courseID, userID));
                            }
                        }
                        else
                        {
                            //正常审批
                            CoDB.ChangeCourseOrderInfor(
                                string.Format(
                                    "update Cl_CourseOrder set GetScore={0}, MakeUpApprovalFlag={1} where UserId={2} and CourseId={3}",
                                    0M, cmake.ApprovalFlag, userID, courseID));
                            cpaDB.UpdateCPALearnStatus(
                                string.Format(
                                    " update Cl_CpaLearnStatus set GetLength={0} where CourseID={1} and UserID={2} and CpaFlag=2",
                                    0M, courseID, userID));

                        }
                    }
                }
            }
        }