Пример #1
0
        /// <summary>
        /// 增加角色
        /// </summary>
        private string AddRoleMenu(HttpContext context)
        {
            //================必填=====================
            string mid = context.Request.Params["mid"];
            string ids = context.Request.Params["ids"];

            var jr = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "授权失败",
                RedirectUrl = string.Empty
            };

            if (!string.IsNullOrEmpty(mid))
            {
                EccmRoleMenuRelationBLL menu_bll = new EccmRoleMenuRelationBLL();
                if (menu_bll.Add(int.Parse(mid), ids) > 0)
                {
                    jr.IsSucceed = true;
                    jr.Msg       = "授权成功";
                    //jr.Data = int.Parse(mid);
                }
            }
            return(JsonConvert.SerializeObject(jr));
        }
Пример #2
0
        /// <summary>
        /// 删除小区
        /// </summary>
        private string DeleteContent(HttpContext context)
        {
            string tID = context.Request.Params["tID"];
            var    jr  = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "删除小区失败",
                RedirectUrl = string.Empty
            };

            if (!string.IsNullOrEmpty(tID))
            {
                int cid = 0;
                int.TryParse(tID, out cid);

                if (mc_bll.DeleteContent(cid) > 0)
                {
                    jr.IsSucceed = true;
                    jr.Msg       = "删除小区成功";
                    jr.Data      = cid;
                }
            }
            return(JsonConvert.SerializeObject(jr));
        }
Пример #3
0
        //[ProducesResponseType(typeof(UserReply), 200)]
        public IActionResult Signin([FromBody] AuthReq auth)
        {
            try
            {
                if (!ValidateHelper.IsEmailFormat(auth.Email))
                {
                    return(Json(new JsonResultModel(ReturnCode.ParameterError, "Email format is not correct.")));
                }

                var reply = Client.Signin(auth);
                //string token = Guid.NewGuid().ToString("N");
                string loginTime = DateTime.Now.ToString();
                SetSession("Id", reply.Id);
                SetSession("LoginTime", loginTime);

                var accessToken = TokenHelper.SaveUserToken(reply.Id.ToString(), TimeSpan.FromHours(2));
                var jsonModel   = new JsonResultModel(ReturnCode.Success, "User login successful.", reply);
                jsonModel.Token = accessToken;

                return(Json(jsonModel, true));
            }
            catch (RpcException ex)
            {
                return(Json(new JsonResultModel(ReturnCode.SubmitError, ex.Status.Detail)));
            }
        }
Пример #4
0
        /// <summary>
        /// 删除计划
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string DeletePlan(HttpContext context)
        {
            var jr = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "删除失败",
                RedirectUrl = string.Empty
            };

            //获取传递参数
            string planID = context.Request.Params["planID"];

            EccmPlanModel model = new EccmPlanModel();

            model.plan_id   = int.Parse(planID);
            model.is_delete = 1;

            EccmPlanBLL bll = new EccmPlanBLL();

            if (bll.Delete(model))//删除该id计划
            {
                jr.IsSucceed = true;
                jr.Msg       = "删除成功";
            }

            return(JsonConvert.SerializeObject(jr));
        }
            public async Task OnExceptionAsync(ExceptionContext context)
            {
                var exception = context.Exception;

                if (exception == null)
                {
                    return;
                }
                if (exception is ValidException)
                {
                    ValidException validException = exception as ValidException;
                    var            resultModel    = new JsonResultModel();
                    resultModel.Code         = validException.ExceptionCode;
                    resultModel.Message      = validException.Message;
                    resultModel.Timestamp    = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                    resultModel.Data         = null;
                    context.Result           = new JsonResult(resultModel);
                    context.ExceptionHandled = true;
                    context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                }
                else
                {
                    var resultModel = new JsonResultModel();
                    resultModel.Code      = (int)HttpStatusCode.InternalServerError;
                    resultModel.Message   = exception.Message;
                    resultModel.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                    resultModel.Data      = exception.StackTrace;
                    this.logger.LogError(exception, exception.Message);
                    context.Result           = new JsonResult(resultModel);
                    context.ExceptionHandled = true;
                    context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                }
                await Task.CompletedTask;
            }
Пример #6
0
        public JsonResult CheckOriginalCustomer(PhoneModel model)
        {
            if (IsEventClose())
            {
                throw new EventServiceException("400", "이벤트가 종료되었습니다.", null);
            }

            var result = new JsonResultModel {
                Result = false, Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
            };

            try
            {
                string url = financialConsultantSharingService.getUrlToOriginCustomerByPhone(model.phone);

                result = new JsonResultModel
                {
                    Result  = true,
                    Message = "FC코드 인증에 성공하였습니다.",
                    Data    = url
                };
            }
            catch (EventServiceException e)
            {
                result.Result  = false;
                result.Message = e.Message;
            }
            catch (Exception e)
            {
                logger.Info(">>>>>>>> FC SHARING EVENT KAKAOTALK Exception");
                logger.Debug("/////////// message:{0}, data:{1}", e.Message, e.Data);
            }
            return(Json(result));
        }
Пример #7
0
        public ActionResult PostAdd(PurchaseAddModel model)
        {
            JsonResultModel result = new JsonResultModel();

            try
            {
                Validate validate = new Validate();
                validate.CheckObjectArgument <PurchaseAddModel>("model", model);
                if (validate.IsFailed)
                {
                    result.BuilderErrorMessage(validate.ErrorMessages);
                    return(Json(result));
                }
                model.PostValidate(ref validate);
                if (validate.IsFailed)
                {
                    result.BuilderErrorMessage(validate.ErrorMessages);
                    return(Json(result));
                }

                this.purchaseService.Add(model.Date, model.Category, model.Item.Trim(), model.Quantity, model.Unit.Trim(), model.Supplier, model.Remark, model.CostData, this.Session["Mobile"].ToString());
                result.Result = true;
                result.Data   = "/Purchase/Index/" + model.Category;
                return(Json(result));
            }
            catch (Exception ex)
            {
                result.BuilderErrorMessage(ex.Message);
                return(Json(result));
            }
        }
Пример #8
0
        public IHttpActionResult Get(string clientId)
        {
            var result = new JsonResultModel <Client>()
            {
                Success = false
            };;

            var stopWatch = GetStopWatch();

            try
            {
                result.Result  = clientsService.Get(clientId);
                result.Success = true;
                stopWatch.Stop();
                LogManager.AddInfo("ClientsController.GET");
            }
            catch (Exception ex)
            {
                stopWatch.Stop();
                LogManager.AddError("ClientsController", "Get", string.Empty, string.Empty, stopWatch.ElapsedTicks, ex);

                result.Message = ex.Message;
            }

            return(Ok(result));
        }
Пример #9
0
        /// <summary>
        /// 更新禁用时间段状态
        /// </summary>
        /// <param name="periodId">时间段id</param>
        /// <param name="status">状态</param>
        /// <returns></returns>
        public JsonResult UpdatePeriodStatus(Guid periodId, int status)
        {
            var result = new JsonResultModel <bool>();
            var period = BusinessHelper.DisabledPeriodHelper.Fetch(p => p.PeriodId == periodId);

            if (period == null)
            {
                result.Msg    = "时间段不存在,请求参数异常";
                result.Status = JsonResultStatus.RequestError;
                return(Json(result));
            }
            if ((status > 0 && period.IsActive) || (status <= 0 && !period.IsActive))
            {
                result.Msg    = "不需要更新状态";
                result.Data   = true;
                result.Status = JsonResultStatus.Success;
            }
            else
            {
                period.IsActive = status > 0;
                var count = BusinessHelper.DisabledPeriodHelper.Update(period, "IsActive");
                if (count > 0)
                {
                    OperLogHelper.AddOperLog($"{(period.IsActive ? "启用" : "禁用")} 禁止预约时间段 {periodId:N}",
                                             OperLogModule.DisabledPeriod, Username);

                    result.Status = JsonResultStatus.Success;
                    result.Data   = true;
                    result.Msg    = "更新成功";
                }
            }
            return(Json(result));
        }
Пример #10
0
        public IHttpActionResult Post([FromBody] Client client)
        {
            LogManager.AddInfo(DateTime.Now + $" BEGIN : ClientsController.Post Nombre:{client.Nombre}, Apellido:{client.Apellido}");
            var result = new JsonResultModel <string>()
            {
                Success = false
            };;

            var stopWatch = GetStopWatch();

            try
            {
                clientsService.Create(client);
                result.Success = true;
                LogManager.AddInfo(DateTime.Now + $" SUCCESS : ClientsController.Post Nombre:{client.Nombre}, Apellido:{client.Apellido}");
                stopWatch.Stop();
            }
            catch (Exception ex)
            {
                stopWatch.Stop();
                LogManager.AddError("ClientsController", "Post", string.Empty, string.Empty, stopWatch.ElapsedTicks, ex);
                //
                result.Message = ex.Message;
            }

            return(Ok(result));
        }
Пример #11
0
        public IHttpActionResult Delete(string clientId)
        {
            LogManager.AddInfo(DateTime.Now + $" BEGIN : ClientsController.delete clientId:{clientId}");
            var result = new JsonResultModel <string>()
            {
                Success = false
            };;

            var stopWatch = GetStopWatch();

            try
            {
                clientsService.Delete(clientId);
                result.Success = true;
                LogManager.AddInfo(DateTime.Now + $" BEGIN : ClientsController.delete clientId:{clientId}");
                stopWatch.Stop();
            }
            catch (Exception ex)
            {
                stopWatch.Stop();
                LogManager.AddError("ClientsController", "delete", string.Empty, string.Empty, stopWatch.ElapsedTicks, ex);
                //
                result.Message = ex.Message;
            }

            return(Ok(result));
        }
        public ActionResult MakeReservation([FromBody] ReservationViewModel model)
        {
            var result = new JsonResultModel();

            try
            {
                if (ModelState.IsValid)
                {
                    string msg;
                    if (!HttpContext.RequestServices.GetService <ReservationHelper>().IsReservationAvailable(model, out msg))
                    {
                        result.ErrorMsg = msg;
                        return(Json(result));
                    }

                    var reservation = new Reservation()
                    {
                        ReservationForDate = model.ReservationForDate,
                        ReservationForTime = model.ReservationForTime,
                        ReservationPlaceId = model.ReservationPlaceId,

                        ReservationUnit            = model.ReservationUnit,
                        ReservationActivityContent = model.ReservationActivityContent,
                        ReservationPersonName      = model.ReservationPersonName,
                        ReservationPersonPhone     = model.ReservationPersonPhone,

                        ReservationFromIp = HttpContext.Connection.RemoteIpAddress.ToString(), //记录预约人IP地址

                        UpdateBy      = model.ReservationPersonName,
                        UpdateTime    = DateTime.Now,
                        ReservationId = Guid.NewGuid()
                    };
                    //TODO:验证最大可预约时间段,同一个手机号,同一个IP地址
                    // 需要验证这种预约判断是否可以通用,可能有bug
                    foreach (var item in model.ReservationForTimeIds.Split(',').Select(_ => Convert.ToInt32(_)))
                    {
                        reservation.ReservationPeriod += (1 << item);
                    }
                    var bValue = _reservertionBLL.Insert(reservation);
                    if (bValue > 0)
                    {
                        result.Result = true;
                        result.Status = JsonResultStatus.Success;
                    }
                    else
                    {
                        result.ErrorMsg = "预约失败";
                        result.Status   = JsonResultStatus.ProcessFail;
                    }
                    return(Json(result));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                result.Status   = JsonResultStatus.ProcessFail;
                result.ErrorMsg = ex.Message;
            }
            return(Json(result));
        }
Пример #13
0
        public ApiResponse(int StatusCode, string msg = null)
        {
            code = StatusCode;

            switch (StatusCode)
            {
            case HttpStatusCode.Unauthorized:
            {
                value = "很抱歉,您无权访问该接口,请确保已经登录!";
            }
            break;

            case HttpStatusCode.Forbidden:
            {
                value = "很抱歉,您无权访问该接口,请联系管理员分配权限!";
            }
            break;

            case HttpStatusCode.ServerError:
            {
                value = msg;
            }
            break;
            }

            JsonResultModel = new JsonResultModel <string>()
            {
                status   = false,
                code     = code,
                errorMsg = value
            };
        }
Пример #14
0
        private static ReturnType HttpPush <DataType, ReturnType>(string Url, DataType tData, string httpverb, string authToken = "")
        {
            string          Data  = JsonConvert.SerializeObject(tData);
            JsonResultModel model = new JsonResultModel();
            string          Out   = String.Empty;
            string          Error = String.Empty;
            WebRequest      req   = WebRequest.Create(Url);

            try
            {
                req.Method      = httpverb;
                req.Timeout     = 100000;
                req.ContentType = "application/json";
                byte[] sentData = Encoding.UTF8.GetBytes(Data);
                req.ContentLength = sentData.Length;

                if (!string.IsNullOrWhiteSpace(authToken))
                {
                    req.Headers.Add("authToken", authToken);
                }

                using (Stream sendStream = req.GetRequestStream())
                {
                    sendStream.Write(sentData, 0, sentData.Length);
                    sendStream.Close();
                }

                WebResponse res           = req.GetResponse();
                Stream      ReceiveStream = res.GetResponseStream();
                using (StreamReader sr = new
                                         StreamReader(ReceiveStream, Encoding.UTF8))
                {
                    Out = sr.ReadToEnd();
                }
            }
            catch (ArgumentException ex)
            {
                Error = string.Format("HTTP_ERROR :: The second HttpWebRequest object has raised an Argument Exception as 'Connection' Property is set to 'Close' :: {0}", ex.Message);
            }
            catch (WebException ex)
            {
                Error = ($"{ex.Status}:: WebException raised! :: {ex.Message}");
            }

            catch (Exception ex)
            {
                Error = string.Format("HTTP_ERROR :: Exception raised! :: {0}", ex.Message);
            }

            model.Results      = Out;
            model.ErrorMessage = Error;

            if (!string.IsNullOrWhiteSpace(Error))
            {
                throw new Exception(model.ErrorMessage);
            }

            if (string.IsNullOrWhiteSpace(Out))
            {
                return(default);
Пример #15
0
        public JsonResult YoklamaGuncelle(YoklamaViewModel model)
        {
            JsonResultModel jmodel = new JsonResultModel();

            try
            {
                Yoklamalar y = yoklamarepo.Get(model.YoklamaID);
                y.OgrenciIDListe = null;
                string[] ogridliste = model.OgrenciIDListe;
                if (model.OgrenciIDListe != null)
                {
                    for (int i = 0; i < ogridliste.Length; i++)
                    {
                        y.OgrenciIDListe += ogridliste[i];
                        if (i + 1 < ogridliste.Length)
                        {
                            y.OgrenciIDListe += ",";
                        }
                    }
                }
                yoklamarepo.Update(y);
                jmodel.IsSuccess   = true;
                jmodel.UserMessage = "Güncelleme işlemi başarılı bir şekilde gerçekleşti.";
            }
            catch
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Güncelleme işlemi sırasında bir hata oluştu. Lütfen daha sonra tekrar deneyiniz.";
            }
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Пример #16
0
        /// <summary>
        /// 编辑电梯绑定信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditElevatorInfo(HttpContext context)
        {
            var jr = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "编辑失败",
                RedirectUrl = string.Empty
            };
            string registrationCode = context.Request.Params["registrationCode"];
            string elevatorPosition = context.Request.Params["elevatorPosition"];
            int    eID = string.IsNullOrEmpty(context.Request.Params["eID"]) ? 0 : int.Parse(context.Request.Params["eID"]);

            if (_infoBLL.Exists(registrationCode, eID))
            {
                jr.IsSucceed = false;
                jr.Msg       = "注册码已经存在";
            }
            else
            {
                ElevatorInfoModel model = new ElevatorInfoModel()
                {
                    registrationCode = registrationCode,
                    elevatorPosition = elevatorPosition,
                    eID = eID
                };
                if (_infoBLL.Update(model))
                {
                    jr.IsSucceed = true;
                    jr.Msg       = "编辑成功";
                }
            }
            return(JsonConvert.SerializeObject(jr));
        }
        public JsonResult CarOperation(string OperationType, CarModel Data)
        {
            var resultModel = new JsonResultModel <Car>();

            if (OperationType == "AddOrUpdate")
            {
                try
                {
                    using (DataService db = new DataService())
                    {
                        var item = db.Context.Cars.FirstOrDefault(x => x.ID == Data.ID) ?? new Car();
                        item.Name         = Data.Name;
                        item.CarBrand     = Data.CarBrand;
                        item.HiredDate    = Data.HiredDate;
                        item.ContractDate = Data.ContractDate;
                        item.HiredKm      = Data.HiredKm;
                        item.ContractKm   = Data.ContractKm;
                        item.ActualKm     = Data.ActualKm;

                        if (Data.ID == 0)
                        {
                            db.Context.Cars.Add(item);
                        }

                        db.Context.SaveChanges();

                        resultModel.Status  = JsonResultType.Success;
                        resultModel.Message = "Yeni Araç Kaydedildi";
                    }
                }
                catch (Exception ex)
                {
                    resultModel.Status  = JsonResultType.Error;
                    resultModel.Message = "Kayıt İşlemi Gerçekleştirilemedi";
                }
            }

            if (OperationType == "Remove")
            {
                try
                {
                    using (DataService db = new DataService())
                    {
                        var item = db.Context.Cars.FirstOrDefault(x => x.ID == Data.ID);
                        db.Context.Cars.Remove(item);
                        db.Context.SaveChanges();
                    }

                    resultModel.Status  = JsonResultType.Success;
                    resultModel.Message = "Silme İşlemi Başarılı";
                }
                catch (Exception ex)
                {
                    resultModel.Status  = JsonResultType.Error;
                    resultModel.Message = "Silme İşlemi Gerçekleştirilemedi";
                }
            }

            return(Json(resultModel, JsonRequestBehavior.AllowGet));
        }
Пример #18
0
        /// <summary>
        /// 查询实施图片
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetImplementImg(HttpContext context)
        {
            var jr = new JsonResultModel <DataTable>()
            {
                IsSucceed   = false,
                Data        = null,
                Msg         = "查询失败",
                RedirectUrl = string.Empty
            };

            //获取传递参数
            string implementid      = context.Request.Params["implementid"];
            string type             = context.Request.Params["type"];//1巡检2维保3维修
            EccmImplementImgBLL bll = new EccmImplementImgBLL();
            DataTable           dt  = bll.GetList(int.Parse(implementid), int.Parse(type));

            if (dt.Rows.Count > 0)
            {
                jr.IsSucceed = true;
                jr.Data      = dt;
                jr.Msg       = "查询成功";
            }

            return(JsonConvert.SerializeObject(jr));
        }
Пример #19
0
        /// <summary>
        /// 组织字段添加逻辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult AggregateFieldAddLogic(int id)
        {
            string metaFieldIdsString = Request.Form["metaFieldIds"];
            //get metafield ids
            var metaFieldIdsSplit = !string.IsNullOrEmpty(metaFieldIdsString) ? metaFieldIdsString.Split(',') : Array.Empty <string>();

            int[]             metaFieldIds        = (metaFieldIdsSplit != null && metaFieldIdsSplit.Any()) ? metaFieldIdsSplit.Select(t => Convert.ToInt32(t)).ToArray() : new int[0];
            int[]             fieldAggregationIds = fieldAggregationService.GetByFieldListId(id)?.Select(t => t.MetaFieldId)?.ToArray() ?? new int[0];
            IEnumerable <int> addIds    = metaFieldIds.Except(fieldAggregationIds); //ids will add
            IEnumerable <int> deleteIds = fieldAggregationIds.Except(metaFieldIds); //ids will delete

            IList <FieldListMetaField> fieldAggregations = new List <FieldListMetaField>();

            foreach (var item in addIds)
            {
                fieldAggregations.Add(new FieldListMetaField {
                    FieldListId = id, MetaFieldId = item
                });
            }

            if (fieldAggregations.Any())
            {
                fieldAggregationService.Add(CurrentMetaObjectId, fieldAggregations);
            }

            foreach (var item in deleteIds)
            {
                fieldAggregationService.DeleteByMetaFieldId(item);
            }

            //对当前列表配置的顺序进行重新排序
            fieldAggregationService.SortFields(id, metaFieldIds);

            return(JsonResultModel.Success("保存成功!"));
        }
Пример #20
0
        public JsonResult Login(LoginUserModel loginUser)
        {
            JsonResultModel jsonResult = new JsonResultModel();

            try
            {
                chatService = new WebChatService.ChatServiceClient();
                chatService.Login(new WebChatService.User()
                {
                    UserName = loginUser.UserName
                });
                loginUser.Id = chatService.GetUser().FirstOrDefault(x => x.UserName == loginUser.UserName).Id;

                Session["UserData"]  = loginUser;
                Session["UserName"]  = loginUser.UserName;
                Session["UserID"]    = loginUser.Id;
                jsonResult.IsSuccess = true;
                return(Json(jsonResult, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                jsonResult.IsSuccess = false;
                jsonResult.ExMessage = ex.Message;
                return(Json(jsonResult, JsonRequestBehavior.AllowGet));
            }
        }
Пример #21
0
        /// <summary>
        /// 取得当前省份下的项目
        /// </summary>
        /// <returns></returns>
        public string GetProvinceCommunity(HttpContext context)
        {
            var jr = new JsonResultModel <List <CommunityInfoModel> >()
            {
                IsSucceed   = false,
                Data        = new List <CommunityInfoModel>(),
                Msg         = "获取项目信息失败",
                RedirectUrl = string.Empty
            };

            string province = context.Request.Params["province"];

            if (!string.IsNullOrEmpty(province))
            {
                CommunityInfoBLL community = new CommunityInfoBLL();

                List <CommunityInfoModel> communityList = community.GetCommunityByProvince(province);
                if (communityList != null)
                {
                    jr.IsSucceed = true;
                    jr.Data      = communityList;
                    jr.Msg       = "获取项目信息失败";
                }
            }
            return(JsonConvert.SerializeObject(jr));
        }
Пример #22
0
        public JsonResult OgretmenGuncelleislem(Ogretmenler model)
        {
            JsonResultModel jmodel = new JsonResultModel();

            try
            {
                Ogretmenler o = ogretmenrepo.GetByFilter(a => a.KullaniciAdi == f.Decrypt(model.KullaniciAdi));
                if (o != null)
                {
                    Ogretmenler ogr = ogretmenrepo.Get(model.OgretmenID);
                    ogr.AdSoyad      = model.AdSoyad;
                    ogr.KullaniciAdi = f.Encrypt(model.KullaniciAdi);
                    ogr.Sifre        = f.Encrypt(model.Sifre);
                    ogretmenrepo.Update(ogr);
                    jmodel.IsSuccess   = true;
                    jmodel.UserMessage = "Öğretmen bilgileri başarılı bir şekilde güncellendi.";
                }
                else
                {
                    jmodel.IsSuccess   = false;
                    jmodel.UserMessage = model.KullaniciAdi + " kullanıcı adına sahip başka bir öğretmenimiz zaten var. Lütfen başka bir kullanıcı adı belirleyiniz.";
                }
            }
            catch
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Öğretmen bilgilerini güncelleme işlemi sırasında bir sorunla karşılaştık. Lütfen daha sonra tekrar deneyiniz.";
            }
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Пример #23
0
        /// <summary>
        /// 更改计划状态
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string UpdateStates(HttpContext context)
        {
            var jr = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "更改失败",
                RedirectUrl = string.Empty
            };

            //获取传递参数
            string planID = context.Request.Params["planid"];
            string states = context.Request.Params["planstats"];

            EccmPlanModel model = new EccmPlanModel();

            model.plan_id    = int.Parse(planID);
            model.plan_stats = int.Parse(states);

            EccmPlanBLL bll = new EccmPlanBLL();

            if (bll.UpdataStates(model))//更改计划状态
            {
                jr.IsSucceed = true;
                jr.Msg       = "更改成功";
            }

            return(JsonConvert.SerializeObject(jr));
        }
Пример #24
0
        public JsonResult OgrenciGuncelle(Ogrenciler model)
        {
            JsonResultModel jmodel = new JsonResultModel();

            try
            {
                Ogrenciler varmi = ogrencirepo.GetByFilter(a => a.Sinif == model.Sinif && a.Sube == model.Sube && a.OgrenciNo == model.OgrenciNo);
                if (varmi == null)
                {
                    Ogrenciler ogr = ogrencirepo.Get(model.OgrenciID);
                    ogr.Adi              = model.Adi;
                    ogr.AktifMi          = true;
                    ogr.GuncellemeTarihi = DateTime.Now;
                    ogr.OgrenciNo        = model.OgrenciNo;
                    ogr.Sinif            = model.Sinif;
                    ogr.Soyadi           = model.Soyadi;
                    ogr.Sube             = model.Sube;
                    ogrencirepo.Update(ogr);
                    jmodel.IsSuccess   = true;
                    jmodel.UserMessage = "Öğrenci bilgileri başarılı bir şekilde güncellendi.";
                }
                else
                {
                    jmodel.IsSuccess   = false;
                    jmodel.UserMessage = "Belirtilen sınıf ve şubede " + model.OgrenciNo + " numaralı öğrenci zaten var.";
                }
            }
            catch
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Öğrenci bilgilerini güncelleme işlemi sırasında bir sorunla karşılaştık. Lütfen daha sonra tekrar deneyiniz.";
            }
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Пример #25
0
        /// <summary>
        /// 更新禁用时间段状态
        /// </summary>
        /// <param name="periodId">时间段id</param>
        /// <param name="status">状态</param>
        /// <returns></returns>
        public JsonResult UpdatePeriodStatus(Guid periodId, int status)
        {
            var result = new JsonResultModel <bool>();
            var period = _bllDisabledPeriod.Fetch(p => p.PeriodId == periodId);

            if (period == null)
            {
                result.ErrorMsg = "时间段不存在,请求参数异常";
                result.Status   = JsonResultStatus.RequestError;
                return(Json(result));
            }
            if ((status > 0 && period.IsActive) || (status <= 0 && !period.IsActive))
            {
                result.ErrorMsg = "不需要更新状态";
                result.Result   = true;
                result.Status   = JsonResultStatus.Success;
            }
            else
            {
                period.IsActive    = status > 0;
                period.UpdatedTime = DateTime.UtcNow;
                period.UpdatedBy   = UserName;
                var count = _bllDisabledPeriod.Update(period, p => p.IsActive);
                if (count > 0)
                {
                    OperLogHelper.AddOperLog($"{(period.IsActive ? "启用" : "禁用")} 禁止预约时间段 {periodId:N}:{period.StartDate:yyyy/MM/dd}--{period.EndDate:yyyy/MM/dd}",
                                             OperLogModule.DisabledPeriod, UserName);

                    result.Status = JsonResultStatus.Success;
                    result.Result = true;
                }
            }
            return(Json(result));
        }
Пример #26
0
        public JsonResult OgrenciYeniDonemAktar(int id)
        {
            JsonResultModel jmodel = new JsonResultModel();

            try
            {
                Ogrenciler ogr   = ogrencirepo.Get(id);
                Donemler   donem = donemrepo.GetByFilter(a => a.AktifMi == true);
                if (ogr.DonemID == donem.DonemID)
                {
                    jmodel.IsSuccess   = false;
                    jmodel.UserMessage = "Öğrencimizin, <strong>" + donem.DonemAdi + "</strong> dönemi için durumu zaten aktif.";
                }
                else
                {
                    ogr.DonemID = donem.DonemID;
                    ogr.AktifMi = true;
                    ogrencirepo.Update(ogr);
                    jmodel.IsSuccess   = true;
                    jmodel.UserMessage = "Öğrenci bilgileri aktif döneme aktarıldı.";
                }
            }
            catch
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "İşlem sırasında bir hata ile karşılaştık. Lütfen daha sonra tekrar deneyiniz.";
            }
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Пример #27
0
        /// <summary>
        /// 修改小区信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string Updatecontent(HttpContext context)
        {
            string contentid   = context.Request.Params["contentid"];
            int    devid       = string.IsNullOrEmpty(context.Request.Params["devid"]) ? 0 : Convert.ToInt32(context.Request.Params["devid"]);
            int    systype     = string.IsNullOrEmpty(context.Request.Params["systype"]) ? 0 : Convert.ToInt32(context.Request.Params["systype"]);
            string contentCode = context.Request.Params["code"];
            string contentName = context.Request.Params["codename"];

            int flag = mc_bll.UpdateContent(new ViewMonitorContentModel()
            {
                TID         = int.Parse(contentid),
                DevhouseID  = devid,
                SysType     = systype,
                ContentCode = contentCode,
                ContentName = contentName,
            });
            var jr = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "编辑小区失败",
                RedirectUrl = string.Empty
            };

            if (flag > 0)
            {
                jr.IsSucceed = true;
                jr.Msg       = "编辑小区成功";
            }
            return(JsonConvert.SerializeObject(jr));
        }
Пример #28
0
        public JsonResult OgretmenEkle(Ogretmenler model)
        {
            JsonResultModel jmodel = new JsonResultModel();

            try
            {
                if (f.OgretmenKullaniciAdiVarMi(f.Encrypt(model.KullaniciAdi)) == false)
                {
                    jmodel.IsSuccess   = false;
                    jmodel.UserMessage = "Aynı kullanıcı adına sahip başka bir öğretmen var. Lütfen kullanıcı adınızı değiştiriniz.";
                }
                else
                {
                    model.KayitTarihi  = DateTime.Now;
                    model.AktifMi      = true;
                    model.OkulID       = Convert.ToInt32(Session["OkulID"]);
                    model.KullaniciAdi = f.Encrypt(model.KullaniciAdi);
                    model.Sifre        = f.Encrypt(model.Sifre);
                    model.DonemID      = donemrepo.GetByFilter(a => a.AktifMi == true).DonemID;
                    ogretmenrepo.Add(model);
                    jmodel.IsSuccess   = true;
                    jmodel.UserMessage = model.AdSoyad + " isimli öğretmene ait bilgiler başarılı bir şekilde eklendi.";
                }
            }
            catch
            {
                jmodel.IsSuccess   = false;
                jmodel.UserMessage = "Öğretmen bilgilerini eklerken bir sorunla karşılaştık. Lütfen daha sonra tekrar deneyiniz.";
            }
            return(Json(jmodel, JsonRequestBehavior.AllowGet));
        }
Пример #29
0
        public IActionResult Logout()
        {
            try
            {
                int id = Convert.ToInt32(GetSession("Id"));

                RemoveSession("Id");
                RemoveSession("AccessToken");
                RemoveSession("LastLoginTime");
                var user = new IdReq {
                    Id = id
                };
                var reply = Client.Logout(user);

                string userId      = GetHeader("User-Id");
                string accessToken = GetHeader("Access-Token");
                bool   check       = TokenHelper.DeleteUserToken(userId);

                var resultModel = new JsonResultModel(ReturnCode.Success, "User logout successful.");
                resultModel.Token = null;

                return(Json(resultModel));
            }
            catch (RpcException ex)
            {
                return(Json(new JsonResultModel(ReturnCode.SubmitError, ex.Status.Detail)));
            }
        }
Пример #30
0
        private string UpdateRole(HttpContext context)
        {
            var jr = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "编辑角色失败",
                RedirectUrl = string.Empty
            };
            int    roleid    = string.IsNullOrEmpty(context.Request.Params["roleid"])?0:Convert.ToInt32(context.Request.Params["roleid"]);
            string _rolecode = context.Request.Params["roleCode"];
            string _rolename = context.Request.Params["roleName"];
            string _intro    = context.Request.Params["intro"];
            string _rights   = context.Request.Params["rights"];

            if (role_bll.Update(new RoleInfoModel()
            {
                rid = roleid,
                roleCode = _rolecode,
                roleName = _rolename,
                intro = _intro
            }, _rights))
            {
                jr.IsSucceed = true;
                jr.Data      = 1;
                jr.Msg       = "编辑角色成功";
            }
            return(JsonConvert.SerializeObject(jr));
        }