Пример #1
0
 public BaseContainer(JsonDTO json)
 {
     Id      = json.Id;
     Headers = json.Headers;
     Model   = json.Model;
     Tag     = json.Tag;
 }
Пример #2
0
        public ActionResult Zhuanjia()
        {
            try
            {
                FansInfo Fans = Session["FansInfo"] as FansInfo;
                Dictionary <string, string> dic = new Dictionary <string, string>();
                logger.Fatal(Fans.Openid);
                dic.Add("openid", Fans.Openid);

                JsonDTO <bool> result = RequestHelp.RequestGet <bool>("Member/ChckBind", dic).Result;
                string         json   = JsonConvert.SerializeObject(Fans);

                ViewBag.FansInfo = false;

                //如果是注册用户
                if (result.Data)
                {
                    ViewBag.FansInfo = true;
                }
                return(View());


                //return Redirect(ConfigurationManager.AppSettings["WebUrl"] + "/hmjmember/tozhuce.do");
            }
            catch (System.Exception)
            {
                return(View());
            }
        }
        public ModelDadorCancelarConsultToBot CheckIfDadorForCancelarConsulta(string docIdentificacao)
        {
            using (var client = new HttpClient())
            {
                // Passing service base url
                client.BaseAddress = new Uri(Baseurl_Consulta);

                client.DefaultRequestHeaders.Clear();

                // Define request data format
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var jsonString = new JsonDTO
                {
                    DocIdentificacao = docIdentificacao
                };

                var jsonT = JsonConvert.SerializeObject(jsonString);

                var Res = client.PostAsync(Baseurl_Consulta, new StringContent(jsonT, Encoding.UTF8, "application/json")).Result;

                // Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    ModelDadorCancelarConsultToBot resJson = Res.Content.ReadAsAsync <ModelDadorCancelarConsultToBot>().Result;

                    return(resJson);
                }
                else // Não encontrou nenhum match
                {
                    return(null);
                }
            }
        }
Пример #4
0
        internal static BaseTextedElement CreateTextElementModel(JsonDTO json)
        {
            var model   = Type.GetType($"SophiApp.Models.{json.Model}");
            var element = Activator.CreateInstance(model, json) as BaseTextedElement;

            element.CurrentStateAction = FindCurrentStateAction(element.Id);
            element.SystemStateAction  = FindSystemStateAction(element.Id);
            return(element);
        }
 public BaseTextedElement(JsonDTO json)
 {
     ContainerId  = json.ContainerId;
     Id           = json.Id;
     Descriptions = json.Descriptions;
     Headers      = json.Headers;
     Model        = json.Model;
     Tag          = json.Tag;
 }
Пример #6
0
        /// <summary>
        /// 显示页面
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> Index()
        {
            JsonDTO <MemberResDTO> result = await RequestHelp.RequestPost <MemberResDTO, MemberUpdateReqDTO>("Test/PostTest",
                                                                                                             new MemberUpdateReqDTO()
            {
                NAME_LAST = "你好"
            });

            //return Json(result);
            return(View());
        }
Пример #7
0
        /// <summary>
        /// 是否注册
        /// </summary>
        /// <returns></returns>
        public ActionResult IsRegister()
        {
            string str = Request["openid"];

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("openid", str);
            JsonDTO <bool> result = RequestHelp.RequestGet <bool>("Member/ChckBind", dic).Result;

            return(Json(result.Data));
        }
Пример #8
0
        internal static IEnumerable <JsonDTO> ParseJson(byte[] json)
        {
            var matchPattern = @"\n    {(.*?)\n    }";

            return(Regex.Matches(Encoding.UTF8.GetString(json), matchPattern, RegexOptions.Compiled | RegexOptions.Singleline)
                   .Cast <Match>()
                   .Select(match =>
            {
                var dto = new JsonDTO();

                using (MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(match.Value)))
                {
                    var jsonSerializer = new DataContractJsonSerializer(typeof(JsonDTO), new DataContractJsonSerializerSettings()
                    {
                        UseSimpleDictionaryFormat = true
                    });
                    dto = (JsonDTO)jsonSerializer.ReadObject(memoryStream);
                }

                return dto;
            }));
        }
Пример #9
0
        internal static RadioButtonGroup CreateRadioButtonGroupModel(JsonDTO json)
        {
            var model = Type.GetType($"SophiApp.Models.{json.Model}");

            return(Activator.CreateInstance(model, json) as RadioButtonGroup);
        }
Пример #10
0
        internal static ExpandingGroup CreateExpandingGroupModel(JsonDTO json)
        {
            var model = Type.GetType($"SophiApp.Models.{json.Model}");

            return(Activator.CreateInstance(model, json) as ExpandingGroup);
        }
Пример #11
0
 public CheckBox(JsonDTO json) : base(json)
 {
 }
Пример #12
0
 public RadioButtonGroup(JsonDTO json) : base(json)
 {
 }
Пример #13
0
 public ExpandingGroup(JsonDTO json) : base(json)
 {
 }
Пример #14
0
 public Switch(JsonDTO json) : base(json)
 {
 }
Пример #15
0
        /// <summary>
        /// 显示页面
        /// </summary>
        /// <returns></returns>

        public async Task <ActionResult> Index()
        {
            JsonDTO <CityResDTO> result = await RequestHelp.RequestGet <CityResDTO>("Test/PostTest", null);

            return(Json(result));
        }
Пример #16
0
 public RadioButton(JsonDTO json) : base(json)
 {
 }