public void LicenseAdd(UserInfoModel model)
        {
            try
            {
                string name    = Request["Six"];
                string License = Request["ID"] + name;

                HttpCookie http = Request.Cookies["Cooke"];
                //Cooke解码
                string str = HttpUtility.UrlDecode(http.Value, Encoding.GetEncoding("UTF-8"));
                //反序列化
                List <ViewModel> models = JsonConvert.DeserializeObject <List <ViewModel> >(str);
                foreach (var m in models)
                {
                    model.UIDa = m.UIDa;
                    ViewBag.ID = m.UIDa;
                }

                model.Uplate = License;
                url         += "Login/LicenseAdd";
                string mm = JsonConvert.SerializeObject(model);
                string i  = HttpClientHeper.Post(url, mm);
                if (Convert.ToInt32(i) > 0)
                {
                    Response.Write("<script>alert('录入车牌号成功,请重新登录!');location.href='/UserInfo/UserInfoLogon'</script>");
                }
            }
            catch (Exception)
            {
                Response.Write("<script>alert('请去登入再做以下操作谢谢!');location.href='/UserInfo/UserInfoLogon'</script>");
            }
        }
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <returns></returns>
        public ActionResult Add(int id)
        {
            try
            {
                ////Cooke获取值
                //HttpCookie cookie = Request.Cookies["User"];
                ////Cooke获取Value值
                //ViewBag.Name = cookie.Value;

                HttpCookie http = Request.Cookies["Cooke"];
                //Cooke解码
                string str = HttpUtility.UrlDecode(http.Value, Encoding.GetEncoding("UTF-8"));
                //反序列化
                List <ViewModel> models = JsonConvert.DeserializeObject <List <ViewModel> >(str);
                foreach (var m in models)
                {
                    ViewBag.Id       = m.UIDa;
                    ViewBag.Name     = m.Uname;
                    ViewBag.Plate    = m.Uplate;
                    Session["Plate"] = m.Uplate;
                }

                url += "CarType/Upt?id=" + id;
                string           model = HttpClientHeper.Get(url);
                List <ViewModel> list  = JsonConvert.DeserializeObject <List <ViewModel> >(model);
                return(View(list.First()));
            }
            catch (Exception)
            {
                Response.Write("<script>alert('请去登入再做以下操作谢谢!');location.href='/UserInfo/UserInfoLogon'</script>");
                return(null);
            }
        }
Exemple #3
0
        public ActionResult Show(int Fid = 0)
        {
            try
            {
                HttpCookie http = Request.Cookies["Cooke"];
                //Cooke解码
                string str = HttpUtility.UrlDecode(http.Value, Encoding.GetEncoding("UTF-8"));
                //反序列化
                List <ViewModel> models = JsonConvert.DeserializeObject <List <ViewModel> >(str);
                foreach (var m in models)
                {
                    Fid = m.UIDa;
                }

                url += "Recode/SelectOne?id=" + Fid;
                string        model   = HttpClientHeper.Get(url);
                List <Recode> recodes = JsonConvert.DeserializeObject <List <Recode> >(model);
                return(View(recodes));
            }
            catch (Exception)
            {
                Response.Write("<script>alert('请去登入再做以下操作谢谢!');location.href='/UserInfo/UserInfoLogon'</script>");
                return(null);
            }
        }
Exemple #4
0
        // GET: CarTypes
        /// <summary>
        /// 显示方法
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            url += "CarType/Select";
            string model = HttpClientHeper.Get(url);
            List <CarTypesInfoModel> list = JsonConvert.DeserializeObject <List <CarTypesInfoModel> >(model);

            return(View(list));
        }
        public ActionResult NewIndex()
        {
            url += "/News/NewShow";
            string           model = HttpClientHeper.Get(url);
            List <NewsModel> news  = JsonConvert.DeserializeObject <List <NewsModel> >(model);

            return(View(news));
        }
        public ActionResult NewSelectOnes(int id = 4)
        {
            url += $"/News/NewSelectOne?id={id}";
            string           model        = HttpClientHeper.Get(url);
            List <NewsModel> NewSelectOne = JsonConvert.DeserializeObject <List <NewsModel> >(model);

            return(View(NewSelectOne));
        }
Exemple #7
0
        public void UserInfoUpt(UserInfoModel model, HttpPostedFileBase File)
        {
            url += "login/UserInfoUpt";
            if (!System.IO.Directory.Exists(Server.MapPath("/File/")))
            {
                System.IO.Directory.CreateDirectory(Server.MapPath("/File/"));
            }
            File.SaveAs(Server.MapPath("/File/" + File.FileName));
            model.UImage = "/File/" + File.FileName;

            string str = JsonConvert.SerializeObject(model);
            string m   = HttpClientHeper.Post(url, str);

            if (Convert.ToInt32(m) > 0)
            {
                Response.Write("<script>alert('修改个人信息成功!');location.href='/News/NewIndex'</script>");
            }
        }
Exemple #8
0
        public void UserInfoLoginUpdate(UserInfoModel model, int id)
        {
            url += "login/Upt";

            model.UIDa = id;
            string s = JsonConvert.SerializeObject(model);
            string i = HttpClientHeper.Post(url, s);

            // List<UserInfoModel> a = JsonConvert.DeserializeObject<List<UserInfoModel>>(i);
            //if (model.Upwd == model.Upwd2)
            //{
            if (Convert.ToInt32(i) > 0)
            {
                Response.Write("<script>alert('修改成功!请重新登录。');location.href='/UserInfo/UserInfoLogon'</script>");
            }
            else
            {
                Response.Write("<script>alert('修改失败!');location.href='/UserInfo/UserInfoLogon'</script>");
            }
        }
Exemple #9
0
        public void UserInfoLogon(string Name, string Key)
        {
            url += "/Login/Login";
            UserInfoModel m = new UserInfoModel()
            {
                Uname = Name, Upwd = Key
            };

            string s    = JsonConvert.SerializeObject(m);
            string data = HttpClientHeper.Post(url, s);
            List <UserInfoModel> list = JsonConvert.DeserializeObject <List <UserInfoModel> >(data);

            if (list.Count > 0)
            {
                //Cooke事件
                HttpCookie cookie = new HttpCookie("User");
                //给Cooke赋值
                cookie.Value = list.First().Uname;
                //给Cooke设置过期时间
                cookie.Expires = DateTime.Now.AddMinutes(20);
                //添加到服务器
                Response.AppendCookie(cookie);

                HttpCookie http = new HttpCookie("Cooke");
                //Cooke传入并编码
                http.Value   = HttpUtility.UrlEncode(data, Encoding.GetEncoding("UTF-8"));
                http.Expires = DateTime.Now.AddMinutes(20);
                Response.AppendCookie(http);


                Session["ID"] = list.First().UIDa;
                int ids = Convert.ToInt32(Session["ID"]);
                Response.Write("<script>alert('登录成功!');location.href='/News/NewIndex'</script>");
            }
            else
            {
                Response.Write("<script>alert('用户名错误,或密码错误!');location.href='/UserInfo/UserInfoLogon'</script>");
            }
        }
Exemple #10
0
        public void UserInfoLogin(UserInfoModel model, HttpPostedFileBase fileBase)
        {
            if (!System.IO.Directory.Exists(Server.MapPath("/Img/")))
            {
                System.IO.Directory.CreateDirectory(Server.MapPath("/Img/"));
            }
            if (Server.MapPath("/Img/") == null)
            {
                fileBase.SaveAs(Server.MapPath("/Img/") + fileBase.FileName);
                model.UImage = "/Img/" + fileBase.FileName;

                url += "login/Add";
                if (model.Upwd == model.Upwd2)
                {
                    string s = JsonConvert.SerializeObject(model);
                    string i = HttpClientHeper.Post(url, s);

                    if (Convert.ToInt32(i) > 0)
                    {
                        Response.Write("<script>alert('注册成功,请登录!');location.href='/UserInfo/UserInfoLogon'</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('注册失败!');location.href='/UserInfo/UserInfoLogon'</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('密码不一致,请重新输入!');location.href='/UserInfo/UserInfoLogon'</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('文件为空!请重新添加');location.href='/UserInfo/UserInfoLogon'</script>");
            }
        }
        public void Add(ParkInfoModel park, HttpPostedFileBase File)
        {
            try
            {
                if (!System.IO.Directory.Exists(Server.MapPath("/Img/")))
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath("/Img/"));
                }

                park.PImage    = Server.MapPath("/Img/") + File.FileName;
                park.TID       = Convert.ToInt32(Request["TID"]);
                Session["TID"] = park.TID;
                HttpCookie http = Request.Cookies["Cooke"];
                //Cooke解码
                string str = HttpUtility.UrlDecode(http.Value, Encoding.GetEncoding("UTF-8"));
                //反序列化
                List <ViewModel> models = JsonConvert.DeserializeObject <List <ViewModel> >(str);
                foreach (var a in models)
                {
                    park.UIDa = a.UIDa;
                }
                url += "Park/Add";
                string m = JsonConvert.SerializeObject(park);
                string i = HttpClientHeper.Post(url, m);
                if (Convert.ToInt32(i) > 0)
                {
                    #region 语言播报
                    ////获取进入车辆的车牌号
                    //string phrase = Session["Plate"].ToString()+"欢迎进入";
                    ////语言播报的功能
                    //SpeechSynthesizer speech = new SpeechSynthesizer();
                    //CultureInfo keyboardCulture = System.Globalization.CultureInfo.GetCultureInfoByIetfLanguageTag("zh-cn");
                    //InstalledVoice neededVoice = speech.GetInstalledVoices(keyboardCulture).LastOrDefault();
                    //if (neededVoice == null)
                    //{
                    //    phrase = "Unsupported Language";
                    //}
                    //else if (!neededVoice.Enabled)
                    //{
                    //    phrase = "Voice Disabled";
                    //}
                    //else
                    //{
                    //    speech.SelectVoice(neededVoice.VoiceInfo.Name);
                    //}

                    //speech.Speak(phrase);



                    //// using System.Speech.Synthesis;
                    //SpeechSynthesizer synth = new SpeechSynthesizer();
                    //// Configure the audio output.
                    //synth.SetOutputToDefaultAudioDevice();

                    //synth.Speak("请说一句话");
                    //synth.Speak(Session["Plate"].ToString() + "欢迎进入");

                    //// Speak a string.
                    //synth.Speak("This example demonstrates a basic use of Speech Synthesizer");

                    //Console.WriteLine();
                    //Console.WriteLine("Press any key to exit...");
                    //Console.ReadKey();
                    #endregion
                    //MVC
                    SpVoice speech     = new SpVoice();                       //new一个
                    int     speechRate = 1;                                   //语音朗读速度
                    int     volume     = 100;                                 //音量
                    bool    paused     = false;                               //是否暂停

                    string testspeech = Session["Plate"].ToString() + "欢迎进入"; //测试朗读内容

                    if (paused)
                    {
                        speech.Resume();
                        paused = false;
                    }
                    else
                    {
                        speech.Rate   = speechRate;
                        speech.Volume = volume;
                        speech.Speak(testspeech, SpeechVoiceSpeakFlags.SVSFlagsAsync);//开始语音朗读
                    }
                    #region 明细

                    Recode recode = new Recode();
                    string text   = Session["Plate"].ToString() + "驶入汽车";
                    recode.RName = text;
                    List <ViewModel> modelsa = JsonConvert.DeserializeObject <List <ViewModel> >(str);
                    foreach (var t in models)
                    {
                        recode.FId = t.UIDa;
                    }
                    string urll  = "http://localhost:6201/Recode/Add";
                    string y     = JsonConvert.SerializeObject(recode);
                    string model = HttpClientHeper.Post(urll, y);
                    if (Convert.ToInt32(model) > 0)
                    {
                        Response.Redirect("http://localhost:7652/News/NewIndex");
                    }
                    #endregion



                    Response.Write("<script>alert('驶入成功!');location.href='/News/NewIndex'</script>");
                }
            }
            catch (Exception)
            {
                Response.Write("<script>alert('请选择车辆图片!');location.href='/park/Add'</script>");
            }
        }
        public void Away(int id)
        {
            try
            {
                url += "Park/Away";
                DateTime      Leave = System.DateTime.Now;
                ParkInfoModel parks = new ParkInfoModel();
                parks.ExpireDate = Leave;
                parks.PID        = id;
                string model = JsonConvert.SerializeObject(parks);
                string m     = HttpClientHeper.Post(url, model);
                if (Convert.ToInt32(m) > 0)
                {
                    //MVC
                    SpVoice speech     = new SpVoice();                                          //new一个
                    int     speechRate = 1;                                                      //语音朗读速度
                    int     volume     = 100;                                                    //音量
                    bool    paused     = false;                                                  //是否暂停

                    string testspeech = "感谢车牌号为" + Session["Plate"].ToString() + "的客户停车,祝您一路顺风"; //测试朗读内容

                    if (paused)
                    {
                        speech.Resume();
                        paused = false;
                    }
                    else
                    {
                        speech.Rate   = speechRate;
                        speech.Volume = volume;
                        speech.Speak(testspeech, SpeechVoiceSpeakFlags.SVSFlagsAsync);//开始语音朗读
                    }
                    DateTime Puttime = parks.CreateDate;
                    DateTime Gettime = parks.ExpireDate;
                    TimeSpan a       = Gettime - Puttime;
                    double   b       = a.Minutes / 60;
                    int      i       = (int)Math.Ceiling(b);
                    int      ids     = Convert.ToInt32(Session["TID"]);
                    string   urls    = $"http://localhost:6201/CarType/CarSelectOne?id={ids}";
                    string   o       = HttpClientHeper.Get(urls);
                    List <CarTypesInfoModel> list = JsonConvert.DeserializeObject <List <CarTypesInfoModel> >(o);
                    decimal de    = list.First().Tmaney;
                    int     price = Convert.ToInt32(de);
                    int     sum   = i * price;
                    Response.Write("<script>alert('谢谢您的本次停车!')</script>");
                    #region 明细
                    HttpCookie http = Request.Cookies["Cooke"];
                    //Cooke解码
                    string str = HttpUtility.UrlDecode(http.Value, Encoding.GetEncoding("UTF-8"));
                    //反序列化
                    List <ViewModel> models = JsonConvert.DeserializeObject <List <ViewModel> >(str);
                    Recode           recode = new Recode();
                    string           text   = Session["Plate"].ToString() + "驶出汽车!¥" + sum + "元";
                    recode.RName = text;
                    List <ViewModel> modelsa = JsonConvert.DeserializeObject <List <ViewModel> >(str);
                    foreach (var t in modelsa)
                    {
                        recode.FId = t.UIDa;
                    }
                    string urll   = "http://localhost:6201/Recode/Add";
                    string y      = JsonConvert.SerializeObject(recode);
                    string modela = HttpClientHeper.Post(urll, y);
                    if (Convert.ToInt32(modela) > 0)
                    {
                        Response.Redirect("http://localhost:7652/Payment/QRcode?text=" + sum);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            #endregion

            Response.Write("<script>alert('请去登入再做以下操作谢谢!');location.href='/UserInfo/UserInfoLogon'</script>");
        }