Beispiel #1
0
        public JsonResult GetPage()
        {
            string        fileStr = "";
            List <string> json    = new List <string>();

            try
            {
                string filePath = AppDomain.CurrentDomain.BaseDirectory;
                if (!System.IO.Directory.Exists(filePath + "BaseFile\\"))
                {
                    System.IO.Directory.CreateDirectory(filePath + "BaseFile\\");
                }
                filePath = filePath + "BaseFile\\";
                //读取文件
                StreamReader sr = new StreamReader(filePath + "provincedata.json", Encoding.UTF8);
                String       line;
                while ((line = sr.ReadLine()) != null)
                {
                    fileStr += (line.ToString());
                }
                sr.Close();

                json = JsonConvert.DeserializeObject <List <string> >(fileStr);
            }
            catch (Exception ex) { }


            List <SelScale> fbs = SelScale.GetSelScale();

            for (int i = 0; i < fbs.Count; i++)
            {
                var newname = json.FirstOrDefault(m => fbs[i].name.Contains(m));
                if (string.IsNullOrWhiteSpace(newname) == false)
                {
                    fbs[i].name = newname;
                }
            }

            return(Json(fbs, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult AntiFakeSel(string ID)
        {
            string          ip      = System.Web.HttpContext.Current.Request.ServerVariables.Get("Remote_Addr").ToString();
            ModelQueryParam queryip = new ModelQueryParam();

            queryip = GetAddress(ip);
            string province = queryip.Province;
            string city     = queryip.City;

            string msg   = "此防伪码不存在,请您检查标签,确认防伪码是否输入正确,然后再请您试一次。";
            Scale  scake = Scale.GetCAntiFake(ID);

            SelScale.GetSelScale();

            int countto = 0;

            //string img = "";
            if (scake != null)
            {
                int count = 0;  // scake.SelCount + 1;
                if (count == 1)
                {
                    DateTime time = DateTime.Now;
                    msg = "此防伪码有效,您购买的是深圳市通程防伪科技有限公司所生产的正牌产品,请放心使用!";
                    //scake.SelectDate = time;

                    SelScale selscale = new SelScale();
                    //查到当前标签的出货记录
                    ScaleOutStoke Stoke = ScaleOutStoke.GetSmallScaleListcode(ID);

                    if (Stoke != null)
                    {
                        C_User user = new C_User();
                        if (Stoke.Consignee == "m2000")
                        {
                            //查到出货人信息
                            user = C_User.GetC_UserByUserName(Stoke.Shipper);
                            if (user.Province != province)
                            {
                                selscale.warning = "窜货";
                            }
                            else
                            {
                                selscale.warning = "正常";
                            }

                            selscale.Address = user.Province + user.City;
                        }
                        else
                        {
                            user = C_User.GetC_UserByUserName(Stoke.Consignee);
                            if (user.Province != province)
                            {
                                selscale.warning = "窜货";
                            }
                            else
                            {
                                selscale.warning = "正常";
                            }

                            selscale.Address = user.Province + user.City;
                        }
                    }

                    selscale.province = province;
                    selscale.city     = city;
                    selscale.IP       = ip;
                    selscale.AntiCode = ID;
                    selscale.InsertAndReturnIdentity();
                }
                else
                {
                    msg = "注意!此防伪码有效,但已被查询" + count + "次";
                }

                scake.UpdateByID();
                countto = count;
                return(Content(countto + "|" + msg + "|" + scake.CreateTime));
            }
            return(Content(countto + "|" + msg));
        }