コード例 #1
0
 public async Task <ActionsResult> Save(PromotionApply promotionApply)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@PromotionApplyId", promotionApply.PromotionApplyId);
         parameters.Add("@PromotionId", promotionApply.PromotionId);
         parameters.Add("@RoomTypeId", promotionApply.RoomTypeId);
         return(await SqlMapper.QueryFirstOrDefaultAsync <ActionsResult>(cnn : conn, sql : "PromotionApply_Save", param : parameters, commandType : CommandType.StoredProcedure));
     }
     catch (Exception)
     {
         return(new ActionsResult()
         {
             Id = 0,
             Message = "Có lỗi xảy ra, xin thử lại!"
         });
     }
 }
コード例 #2
0
        public PromotionStage GetPromotionStage(int stageid, int applyId)
        {
            var apply = new PromotionApply {
                ApplyId = 0, PromotionId = 0, UserId = 0
            };

            if (applyId > 0)
            {
                apply = _dataAccess.Get <PromotionApply>(applyId);
            }

            var stage = _dataAccess.Get <PromotionStage>(stageid);
            //加载阶段下的技能
            var sql      = @"SELECT  ar.AbilityId ,
        ResourceId,
        co.CourseName,
        ai.CategoryId ,
        ac.CategoryName,
        pa.PostId,
        AbilityName ,
        AbilityLevel ,
       pec.RecordId as  IsElective
FROM    Ab_AbilityResource ar
        LEFT JOIN Ab_AbilityInfo ai ON ai.AbilityId = ar.AbilityId
        LEFT JOIN Ab_PostAbility pa ON pa.AbilityId = ai.AbilityId
        LEFT JOIN Ab_PromotionStage ps ON ps.PostId = pa.PostId
        LEFT JOIN Ab_AbilityCategory ac ON ac.CategoryId = ai.CategoryId
        LEFT JOIN Res_Course co ON ar.ResourceId=co.CourseId
        LEFT JOIN Ab_PostElectiveCourse pec ON pec.PostId=ps.PostId and pec.AbilityId = ai.AbilityId and pec.CourseId = co.CourseId
WHERE  ar.IsDelete=0 AND ar.ResourceType=0 AND pa.IsDelete = 0 and ai.isdelete = 0 AND ps.StageId=" + stage.StageId;
            var datalist = _dataAccess.FetchListBySql <Models.Views.PromotionStageCourse>(sql);
            //查询学习进度
            var learnProcess = _dataAccess.GetListBySql <Models.LenLearningRecord>(
                @"SELECT lr.CourseId,LearnProcess,StartTime,lr.EndTime,alr.AbilityId FROM Len_LearningRecord lr
LEFT JOIN Ab_LearningRecord alr ON alr.RecordId=lr.SourceId
WHERE lr.LearnPath=3 AND alr.ApplyId=@applyId AND alr.StageId=@stageId --AND alr.AbilityId=@abilityId", new { applyId, stageid });

            foreach (var course in datalist)
            {
                var lp =
                    learnProcess.FirstOrDefault(p => p.AbilityId == course.AbilityId && p.CourseId == course.ResourceId);
                if (lp == null)
                {
                    course.LearnProcess = 0;
                    continue;
                }
                course.LearnProcess = lp.LearnProcess;
            }

            var klsql = @"SELECT ar.ResourceId,/*kl.ResourceName,*/ai.AbilityId,ai.AbilityName,ai.AbilityLevel,ai.CategoryId,
                        ac.CategoryName FROM Ab_AbilityResource ar 
                        --LEFT JOIN KL_Resource kl ON kl.ResourceId = ar.ResourceId
                        LEFT JOIN Ab_PostAbility pa ON pa.AbilityId = ar.AbilityId
                        LEFT JOIN Ab_AbilityInfo ai ON ai.AbilityId = ar.AbilityId
                        LEFT JOIN Ab_AbilityCategory ac ON ac.CategoryId = ai.CategoryId
                        WHERE   ar.IsDelete=0 AND ar.ResourceType=1 AND pa.IsDelete = 0 and ai.isdelete = 0  AND pa.PostId=" + stage.PostId;
            var kls   = _dataAccess.FetchListBySql <Models.Views.PromotionStageKL>(klsql);

            stage.StageCourses.AddRange(datalist);
            stage.StageKLs.AddRange(kls);
            if (stage.ExamId > 0)
            {
                var _exampaperDB = new RetechWing.BusinessCommon.Examination.ExaminationCommonMethod();
                var exampaper    = _exampaperDB.GetSingleById <tbExampaperRedundancy>(stage.ExamId);
                stage.PaperName = exampaper == null ? stage.PaperName : exampaper.ExampaperTitle;

                stage.UserExamPass = -1;
                var record = _dataAccess.GetListBySql <AbPromotionStageLenRecord>(string.Format("select * from Ab_PromotionStageLenRecord where PromotionId = {0} and ApplyId = {1} and StageId = {2} and UserId = {3}", apply.PromotionId, applyId, stageid, apply.UserId)).FirstOrDefault();
                if (record != null)
                {
                    var _examtestDB = new RetechWing.BusinessCommon.Examination.ExaminationCommonMethod();
                    var examuser    = _examtestDB.GetExamUser(new int[] { record.RecordId }, new int[] { apply.UserId }, 2).FirstOrDefault(p => p.ExamPaperID == stage.ExamId);
                    if (examuser != null)
                    {
                        stage.UserExamPass = examuser.IsPass;
                    }
                }
            }
            return(stage);
        }
コード例 #3
0
        public JsonResult ApplyPromotionWay(int promotionId, int stageId, int postId)
        {
            try
            {
                var promotionOneYearApplyTimes = SystemConfigManager.GetConfig(Configs.PromotionOneYearApplyTimes.ToString(), CurrentTenant.TenantId);
                if (!string.IsNullOrWhiteSpace(promotionOneYearApplyTimes))
                {
                    if (int.Parse(promotionOneYearApplyTimes) <= _promotionApplyService.GetApplyPromotionCount(promotionId, CurrentUser.UserId, DateTime.Parse(DateTime.Now.Year + "-01-01 00:00:00"), DateTime.Parse(DateTime.Now.Year + "-12-31 23:59:59")))
                    {
                        return(Json(new { result = 0, content = RetechWing.LanguageResources.TalnetUI.CdeQuestion.ApplicationFailed + RetechWing.LanguageResources.TalnetUI.CdeQuestion.LongStr11 }, JsonRequestBehavior.AllowGet));
                    }
                }


                _promotionApplyService.FailApply(promotionId, CurrentUser.UserId);

                //1:需要审批;0:不需要
                string isNeedApproval = SystemConfigManager.GetConfig(Configs.PromotionApplyNeedApproval.ToString(), CurrentTenant.TenantId);

                var model = new PromotionApply
                {
                    PromotionId     = promotionId,
                    UserId          = CurrentUser.UserId,
                    ApplyTime       = DateTime.Now,
                    ApproveStatus   = isNeedApproval == "1" ? 0 : 2,
                    CurrentStageId  = stageId,
                    StageId         = stageId,
                    OldPostId       = CurrentUser.PostId,
                    PostId          = postId,
                    IsDelete        = 0,
                    Reason          = "",
                    StageStartTime  = null,
                    PromotionStatus = 0
                };
                if (isNeedApproval == "0")
                {
                    model.PassTime = DateTime.Now;
                }
                model.ApplyId = _promotionApplyService.Add(model);

                if (isNeedApproval == "1")
                {
                    int[] messageReceiver;
                    _approveWayManager.BeginApproveRecord(model.ApplyId, 1, CurrentUser.DeptId, CurrentUser.UserId,
                                                          out messageReceiver);

                    try
                    {
                        var    apply       = _promotionApplyService.GetModel(model.ApplyId);
                        string sendtitle   = string.Format(RetechWing.LanguageResources.SendMessage.ApproveInform_ApplyPromotionPost_Title, CurrentUser.Realname, apply.PromotionName, apply.PostName);
                        string sendmessage =
                            string.Format(
                                RetechWing.LanguageResources.SendMessage.ApproveInform_ApplyPromotionPost_Content,
                                CurrentUser.Realname, apply.PromotionName, apply.PostName,
                                Url.RetechAction("ApprovePromotion", "Approve", new { area = "Sys", keep = 1 }));
                        SendMessage(sendtitle, sendmessage, messageReceiver, 99);
                    }
                    catch { }
                    return(Json(new { result = 1, content = RetechWing.LanguageResources.TalnetUI.CdeQuestion.LongStr12 }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { result = 1, content = RetechWing.LanguageResources.TalnetUI.CdeQuestion.ApplicationSuccess }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { result = 0, content = RetechWing.LanguageResources.TalnetUI.CdeQuestion.ApplicationFailed }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
 public async Task <ActionsResult> Save(PromotionApply promotionApply)
 {
     return(await promotionApplyRepository.Save(promotionApply));
 }
コード例 #5
0
 public async Task <ActionsResult> Save(PromotionApply promotionApply)
 {
     return(await promotionApplyService.Save(promotionApply));
 }