Exemplo n.º 1
0
        public JsonResultEntity Create([FromBody] AdEntity adEntity)
        {
            AdBL             adBL     = new AdBL();
            JsonResultEntity response = new JsonResultEntity();

            if (UtilityHelper.ModelBindingValidator(ModelState).Length > 0)
            {
                response.Message = UtilityHelper.ModelBindingValidator(ModelState);
                return(response);
            }

            try
            {
                var result = adBL.Create(adEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 2
0
        public JsonResultEntity Create([FromBody] BrandEntity brandEntity)
        {
            BrandBL          brandBL  = new BrandBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = brandBL.Create(brandEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 3
0
        public JsonResultEntity Create([FromBody] ParkingSpacePriceEntity parkingspacepriceEntity)
        {
            ParkingSpacePriceBL parkingspacepriceBL = new ParkingSpacePriceBL();
            JsonResultEntity    response            = new JsonResultEntity();

            try
            {
                var result = parkingspacepriceBL.Create(parkingspacepriceEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 4
0
        public JsonResultEntity Login(LoginEntity loginentity)
        {
            LoginBL          loginBL  = new LoginBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = loginBL.Get(loginentity);

                if (result.Count == 0)
                {
                    response.Success = false;
                    response.Message = "Username or Password is incorrect";
                    return(response);
                }

                HttpContext.Session.SetString("username", result[0].UserName);
                HttpContext.Session.SetInt32("userid", result[0].UserID);
                HttpContext.Session.SetString("groupname", result[0].GroupName);
                HttpContext.Session.SetInt32("groupid", result[0].GroupID);

                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 5
0
        public JsonResultEntity CheckSession()
        {
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var username = GetUserName();

                if (!string.IsNullOrEmpty(username))
                {
                    response.Success = true;
                }
                else
                {
                    response.Success = false;
                }
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
		public JsonResultEntity Create([FromBody] PlaceSubCategoryEntity placesubcategoryEntity)
        {
            PlaceSubCategoryBL placesubcategoryBL = new PlaceSubCategoryBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = placesubcategoryBL.Create(placesubcategoryEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return response;
                }

                response.Success = true;
                response.Data = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return response;
        }
Exemplo n.º 7
0
        public JsonResultEntity Create([FromBody] GroupAdministratorEntity groupadministratorEntity)
        {
            GroupAdministratorBL groupadministratorBL = new GroupAdministratorBL();
            JsonResultEntity     response             = new JsonResultEntity();

            try
            {
                groupadministratorEntity.CreatedBy   = GetUserID();
                groupadministratorEntity.CreatedDate = DateTime.Now;

                var result = groupadministratorBL.Create(groupadministratorEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
        public JsonResultEntity Create([FromBody] UserFavoriteEntity userfavoriteEntity)
        {
            UserFavoriteBL   userfavoriteBL = new UserFavoriteBL();
            JsonResultEntity response       = new JsonResultEntity();

            try
            {
                var result = userfavoriteBL.Create(userfavoriteEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 9
0
        public JsonResultEntity Delete(int id)
        {
            var groupadministratorBL  = new GroupAdministratorBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                if (id == 1)
                {
                    response.Message = "Cannot delete group admin";
                    response.Success = false;

                    return(response);
                }

                var result = groupadministratorBL.DeleteById(id);
                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
        public JsonResultEntity Create([FromBody] SchedulerSessionEntity schedulersessionEntity)
        {
            SchedulerSessionBL schedulersessionBL = new SchedulerSessionBL();
            JsonResultEntity   response           = new JsonResultEntity();

            try
            {
                var result = schedulersessionBL.Create(schedulersessionEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 11
0
        public JsonResultEntity Update([FromBody] UserAdministratorEntity useradministratorEntity)
        {
            UserAdministratorBL useradministratorBL = new UserAdministratorBL();
            JsonResultEntity    response            = new JsonResultEntity();

            try
            {
                useradministratorEntity.ModifiedBy = GetUserID();

                var result = useradministratorBL.Update(useradministratorEntity);
                if (result.HasWarning() || result.Value == null)
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }
                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
Exemplo n.º 12
0
        public JsonResultEntity GetById(int id)
        {
            FeedsBL          feedsBL  = new FeedsBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = feedsBL.GetById(id);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 13
0
        public JsonResultEntity Create([FromBody] EventPlaceLocationEntity eventplacelocationEntity)
        {
            EventPlaceLocationBL eventplacelocationBL = new EventPlaceLocationBL();
            JsonResultEntity     response             = new JsonResultEntity();

            try
            {
                var result = eventplacelocationBL.Create(eventplacelocationEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 14
0
        public JsonResultEntity Logout()
        {
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                HttpContext.Session.Clear();
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Exemplo n.º 15
0
        public JsonResultEntity GetContentID(string contentSource)
        {
            AdBL             adBL     = new AdBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = new ResultEntity <IEnumerable <ContentEntity> >();

                switch (contentSource)
                {
                case "event":
                    result = adBL.GetContentEvent();
                    break;

                case "seminar":
                    result = adBL.GetContentSeminar();
                    break;

                case "promo":
                    result = adBL.GetContentPromo();
                    break;
                }

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
        public JsonResultEntity Update([FromBody] PlaceUserImageEntity placeuserimageEntity)
        {
            PlaceUserImageBL placeuserimageBL = new PlaceUserImageBL();
            JsonResultEntity response         = new JsonResultEntity();

            try
            {
                var result = placeuserimageBL.Update(placeuserimageEntity);
                if (result.HasWarning() || result.Value == null)
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }
                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
        public JsonResultEntity Update([FromBody] EventOrganizerEntity eventorganizerEntity)
        {
            EventOrganizerBL eventorganizerBL = new EventOrganizerBL();
            JsonResultEntity response         = new JsonResultEntity();

            try
            {
                var result = eventorganizerBL.Update(eventorganizerEntity);
                if (result.HasWarning() || result.Value == null)
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }
                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
        public JsonResultEntity Update([FromBody] UserContentBlockedEntity usercontentblockedEntity)
        {
            UserContentBlockedBL usercontentblockedBL = new UserContentBlockedBL();
            JsonResultEntity     response             = new JsonResultEntity();

            try
            {
                var result = usercontentblockedBL.Update(usercontentblockedEntity);
                if (result.HasWarning() || result.Value == null)
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }
                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
Exemplo n.º 19
0
        public JsonResultEntity Update([FromBody] FeedsEntity feedsEntity)
        {
            FeedsBL          feedsBL  = new FeedsBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = feedsBL.Update(feedsEntity);
                if (result.HasWarning() || result.Value == null)
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }
                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
        public JsonResultEntity Delete(int id)
        {
            var placesubcategoryBL = new PlaceSubCategoryBL();
            JsonResultEntity response = new JsonResultEntity();
            try
            {
                var result = placesubcategoryBL.DeleteById(id);
                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return response;
                }

                response.Success = true;
                response.Data = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return response;
        }
        public JsonResultEntity Delete(int id)
        {
            var userfavoriteBL        = new UserFavoriteBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = userfavoriteBL.DeleteById(id);
                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
Exemplo n.º 22
0
        public override JsonResultEntity Get([FromBody] DBParamEntity dbParamEntity)
        {
            BrandBL          brandBL  = new BrandBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = brandBL.GetAll(dbParamEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                var dataFound  = brandBL.GetTotalRows(dbParamEntity);
                var totalPages = Convert.ToInt32(Math.Ceiling(dataFound.Value / Convert.ToDouble(dbParamEntity.Limit)));

                response.Success  = true;
                response.Data     = result.Value;
                response.MetaInfo = new MetaInfoEntity
                {
                    DataFound   = dataFound.Value,
                    DataPerPage = dbParamEntity.Limit,
                    Page        = dbParamEntity.Page,
                    TotalPages  = totalPages == 0 ? 1 : totalPages
                };
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
        /// <summary>
        /// 获取人员简答题目以及答案
        /// </summary>
        /// <param name="exerciseVguid"></param>
        /// <param name="personVguid"></param>
        /// <returns></returns>
        public JsonResult GetShortAnswerDetail(string exerciseVguid, string personVguid)
        {
            JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information> exerciseAll = new JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information>();

            exerciseAll = _weChatExerciseLogic.GetExerciseDoneAllMsg(exerciseVguid, personVguid);//获取用户答题的所有信息(包括题目信息以及答题信息)
            List <V_Business_ExercisesDetailAndExercisesAnswerDetail_Information> shortAnswerList = new List <V_Business_ExercisesDetailAndExercisesAnswerDetail_Information>();

            foreach (var item in exerciseAll.DetailRow)
            {
                if (item.ExerciseType == 4)
                {
                    shortAnswerList.Add(item);
                }
            }
            return(Json(shortAnswerList, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 查询问卷信息(主信息、详细信息)
        /// </summary>
        /// <param name="Vguid"></param>
        /// <param name="personVguid"></param>
        /// <returns></returns>
        public JsonResult GetQuestionAll(string Vguid, string personVguid)
        {
            //两个地方用到(一个是这里。另一个是阅卷GetShortAnswerDetail方法)
            JsonResultEntity <V_Business_Questionnaire_Answer, V_Business_QuestionnaireDetail_AnswerDetail> exerciseAll = new JsonResultEntity <V_Business_Questionnaire_Answer, V_Business_QuestionnaireDetail_AnswerDetail>();

            exerciseAll = _wl.GetQuestionDoneAllMsg(Vguid, personVguid);
            //exerciseAll.MainRow[0].EffectiveDate
            return(Json(exerciseAll, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 通过问卷主信息Vguid和人员Vguid获取全套问卷信息
        /// </summary>
        /// <param name="Vguid"></param>
        /// <param name="personVguid"></param>
        /// <returns></returns>
        public JsonResultEntity <V_Business_Questionnaire_Answer, V_Business_QuestionnaireDetail_AnswerDetail> GetQuestionDoneAllMsg(string vguid, string personVguid)
        {
            using (SqlSugarClient dbMsSql = SugarDao_MsSql.GetInstance())
            {
                Guid Vguid         = Guid.Parse(vguid);
                Guid personalVguid = Guid.Parse(personVguid);
                JsonResultEntity <V_Business_Questionnaire_Answer, V_Business_QuestionnaireDetail_AnswerDetail> exerciseAll = new JsonResultEntity <V_Business_Questionnaire_Answer, V_Business_QuestionnaireDetail_AnswerDetail>();

                string sql = string.Format("exec usp_UserQuestionInformation '{0}','{1}'", personalVguid, Vguid);

                var query1 = dbMsSql.Queryable <V_Business_Questionnaire_Answer>();
                var query2 = dbMsSql.SqlQuery <V_Business_QuestionnaireDetail_AnswerDetail>(sql).OrderBy(c => c.QuestionnaireType);

                List <V_Business_Questionnaire_Answer> mainRows = query1.Where(i => i.QuestionnaireVguid == Vguid && i.BusinessPersonnelVguid == personalVguid).ToList();
                //如果mainRows为0的话则代表此用户没有答过题
                if (mainRows.Count == 0)
                {
                    mainRows = dbMsSql.Queryable <V_Business_Questionnaire_Answer>().Where(i => i.QuestionnaireVguid == Vguid).ToList();
                    //mainRows[0].PicturePath = "";
                }
                exerciseAll.MainRow = mainRows;

                exerciseAll.DetailRow = query2.ToList();

                return(exerciseAll);
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 查询习题信息(主信息、详细信息)
        /// </summary>
        /// <param name="Vguid"></param>
        /// <param name="personVguid"></param>
        /// <returns></returns>
        public JsonResult GetExerciseAll(string Vguid, string personVguid)
        {
            //两个地方用到(一个是这里。另一个是阅卷GetShortAnswerDetail方法)
            JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information> exerciseAll = new JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information>();

            exerciseAll = _wl.GetExerciseDoneAllMsg(Vguid, personVguid);
            //exerciseAll.MainRow[0].EffectiveDate
            return(Json(exerciseAll, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 通过习题主信息Vguid和人员Vguid获取全套习题信息
        /// </summary>
        /// <param name="Vguid"></param>
        /// <param name="personVguid"></param>
        /// <returns></returns>
        public JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information> GetExerciseDoneAllMsg(string vguid, string personVguid)
        {
            using (SqlSugarClient dbMsSql = SugarDao_MsSql.GetInstance())
            {
                Guid Vguid         = Guid.Parse(vguid);
                Guid personalVguid = Guid.Parse(personVguid);
                JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information> exerciseAll = new JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information>();

                string sql = string.Format("exec usp_UserExercisesInformation '{0}','{1}'", personalVguid, Vguid);

                var query1 = dbMsSql.Queryable <V_Business_ExercisesAndAnswer_Infomation>();
                var query2 = dbMsSql.SqlQuery <V_Business_ExercisesDetailAndExercisesAnswerDetail_Information>(sql);

                List <V_Business_ExercisesAndAnswer_Infomation> mainRows = query1.Where(i => i.BusinessExercisesVGUID == Vguid && i.BusinessPersonnelVguid == personalVguid).ToList();
                //如果mainRows为0的话则代表此用户没有答过题
                if (mainRows.Count == 0)
                {
                    mainRows = dbMsSql.Queryable <V_Business_ExercisesAndAnswer_Infomation>().Where(i => i.BusinessExercisesVGUID == Vguid).ToList();
                    mainRows[0].PicturePath = "";
                }
                exerciseAll.MainRow = mainRows;

                exerciseAll.DetailRow = query2.ToList();

                return(exerciseAll);
            }
        }