Exemplo n.º 1
0
        /// <summary>
        /// 查询OrderNo
        /// </summary>
        /// <returns></returns>
        public JsonResult GetQuery()
        {
            Stream stream = Request.InputStream;

            int dataLen = Convert.ToInt32(Request.InputStream.Length);

            byte[] bytes = new byte[dataLen];
            Request.InputStream.Read(bytes, 0, dataLen);
            string requestStringData = Encoding.UTF8.GetString(bytes);

            if (!string.IsNullOrEmpty(requestStringData))
            {
                Log.Info($"【AzController/GetQuery】REQ:{requestStringData}");
                var reqs     = JsonConvert.DeserializeObject <Dictionary <string, string> >(requestStringData);
                var _orderId = reqs["order_no"];
                if (Regex.IsMatch(_orderId, @"^\d{3}-\d{7}-\d{7}$"))
                {
                    var _data   = _AZData.SearchByOrderNo(_orderId);
                    var _mcdata = new MCData();
                    _mcdata.buyer_email = reqs["order_email"];
                    if (_data != null)
                    {
                        _mcdata.buyer_orderno = _data.refrence_no_platform;
                        _mcdata.IsQueryOK     = 1;
                        _MCData.Add(_mcdata);

                        string _link = "";
                        if (_data.platform_user_name.Contains("US"))
                        {
                            _link = "https://www.amazon.com/review/review-your-purchases/listing";
                        }
                        if (_data.platform_user_name.Contains("UK"))
                        {
                            _link = "https://www.amazon.co.uk/review/review-your-purchases/listing";
                        }
                        if (_data.platform_user_name.Contains("CA"))
                        {
                            _link = "https://www.amazon.ca/review/review-your-purchases/listing";
                        }
                        if (_data.platform_user_name.Contains("DE"))
                        {
                            _link = "https://www.amazon.de/review/review-your-purchases/listing";
                        }
                        return(Json(new { success = "OK", message = "Got it. Thanks!", link = _link, data = _data }));
                    }
                    else
                    {
                        _mcdata.buyer_orderno = reqs["order_no"];
                        _mcdata.IsQueryOK     = 0;
                        _MCData.Add(_mcdata);
                    }
                    return(Json(new { success = "OK", message = "Got it. Thanks!" }));
                }
                else
                {
                    return(Json(new { success = "NO", message = "Invalid order number!" }));
                }
            }
            return(Json(new { success = "NO", message = "Invalid request!" }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 检查Url地址
        /// </summary>
        /// <returns></returns>
        public JsonResult GetCheckUrl()
        {
            Stream stream = Request.InputStream;

            int dataLen = Convert.ToInt32(Request.InputStream.Length);

            byte[] bytes = new byte[dataLen];
            Request.InputStream.Read(bytes, 0, dataLen);
            string requestStringData = Encoding.UTF8.GetString(bytes);

            if (!string.IsNullOrEmpty(requestStringData))
            {
                Log.Info($"【AzController/GetCheckUrl】REQ:{requestStringData}");
                var reqs = JsonConvert.DeserializeObject <Dictionary <string, string> >(requestStringData);
                var _order_customer_reviews     = reqs["order_customer_reviews"];
                var _order_link                 = reqs["order_link"];
                var _obj_order_customer_reviews = new Uri(_order_customer_reviews);
                var _obj_order_link             = new Uri(_order_link);
                var _target = $"/gp/customer-reviews";
                if (_order_customer_reviews.Contains(_target) && _obj_order_customer_reviews.Host.Equals(_obj_order_link.Host))
                {
                    var _mcdata = new MCData();
                    _mcdata.buyer_orderno          = reqs["order_no"];
                    _mcdata.buyer_email            = reqs["order_email"];
                    _mcdata.buyer_customer_reviews = _order_customer_reviews;
                    _MCData.Update(_mcdata);
                    return(Json(new { success = "OK", result = true }));
                }
            }
            return(Json(new { success = "NO", result = false }));
        }
Exemplo n.º 3
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     MCData.LoadDatabase();
     Application.Run(new Form1());
 }
Exemplo n.º 4
0
        /// <summary>
        /// Get channels from Media Center and set first five as favorites
        /// </summary>
        /// <param name="useMCData"></param>
        private static void GetChannelsFromMediaCenter(MCData useMCData, bool autoSetFaves)
        {
            AllTVChannels = useMCData.GetChannels(Settings.Default.MergeLineUps,
                                                  Settings.Default.ImportInternetTVChannels,
                                                  Settings.Default.ImportHiddenTVChannels,
                                                  Settings.Default.BlockChannelsUserHidden,
                                                  Settings.Default.BlockChannelsUserAdded,
                                                  Settings.Default.BlockChannelsUserMapped,
                                                  Settings.Default.BlockChannelsUnknown,
                                                  Settings.Default.DebugChannels);

            // By default, set the first five channels as favourites
            if (autoSetFaves)
            {
                int fCounter = 5;
                foreach (TVService tvs in AllTVChannels.Values)
                {
                    tvs.IsFavorite = true;
                    if (--fCounter < 0)
                    {
                        break;
                    }
                }
            }

            SaveChannelsToLocal();
        }
Exemplo n.º 5
0
        public int Update(MCData _data)
        {
            var _MCData = Context.BAS_MCData.Where(o => o.buyer_orderno.Equals(_data.buyer_orderno) && o.buyer_email.Equals(_data.buyer_email)).OrderByDescending(o => o.Id).FirstOrDefault();

            _MCData.buyer_customer_reviews = _data.buyer_customer_reviews;
            return(Context.SaveChanges());
        }
Exemplo n.º 6
0
        public static bool Initialise()
        {
            mcData = new MCData();

            // Hook up debugging info
            mcData.DebugReport += new EventHandler <DebugReportEventArgs>(epg_DebugReport);
            mcData.RecordingsDataNeedsRefresh += new EventHandler(mcData_RecordingsDataNeedsRefresh);

            // Initialize MCData
            string key = "Wilkinson";

            isWMCOnline = mcData.Initialize(ref key);
            return(isWMCOnline);
        }
Exemplo n.º 7
0
        // Wrapper around mcdata
        public static bool ExternalPopulateTVChannels(bool skipCache)
        {
            if (AllTVChannels == null)
            {
                AllTVChannels = new Dictionary <string, TVService>();
            }
            if (!Settings.Default.EnableMediaCenterSupport)
            {
                return(true);
            }
            bool result;

            MCData tempMCData = null;

            try
            {
                tempMCData = new MCData();

                // Hook up debugging info
                tempMCData.DebugReport += new EventHandler <DebugReportEventArgs>(tempMCData_DebugReport);

                // Initialize MCData
                string key = "Wilkinson";
                isWMCOnline = tempMCData.Initialize(ref key);
                if (!isWMCOnline)
                {
                    return(false);
                }

                result = PopulateTVChannels(skipCache, tempMCData);
            }
            finally
            {
                if (tempMCData != null)
                {
                    tempMCData.DebugReport -= new EventHandler <DebugReportEventArgs>(tempMCData_DebugReport);

                    tempMCData.FreeResources();
                    tempMCData.Dispose();
                }
            }

            return(result);
        }
Exemplo n.º 8
0
        public List <MCData> LoadData()
        {
            List <MCData>        objList         = new List <MCData>();
            List <CompaniesList> listofCompanies = MCList.GetList();

            foreach (CompaniesList item in listofCompanies)
            {
                MCData           objData = new MCData();
                string           data    = DataContext.BasicData.GetHtmlString(item.MainLink);
                string[]         names   = GetMCAlerts(data);
                List <MCActions> actions = GetMCActions(data);

                objData.Code          = item.Code;
                objData.TimeStamp     = DateTime.Now;
                objData.MCActions     = actions;
                objData.SourceDetails = item;
                if (names != null)
                {
                    foreach (var itemSplit in names)
                    {
                        if (itemSplit.Contains('%'))
                        {
                            if (itemSplit.Contains("BUY"))
                            {
                                objData.BuyValue = Convert.ToDecimal(GetValue(itemSplit));
                            }
                            else if (itemSplit.Contains("SELL"))
                            {
                                objData.SellValue = Convert.ToDecimal(GetValue(itemSplit));
                            }
                            else if (itemSplit.Contains("HOLD"))
                            {
                                objData.HoldValue = Convert.ToDecimal(GetValue(itemSplit));
                            }
                        }
                    }
                }
                objList.Add(objData);
            }

            return(objList);
        }
Exemplo n.º 9
0
        private void button_ConMc_Click(object sender, EventArgs e)
        {
            //WriteLine("请输入MC的公式编辑器的标题句柄,以及目标输出窗口的类名,用于给客户端传送MC公式编辑器输出窗口中的定时数据!", ConsoleColor.Red); //绿色
            //WriteLine("MC公式编辑器的标题(spy++获取):", ConsoleColor.Green); //绿色
            //string strMCEditTitle = Console.ReadLine();
            //WriteLine("目标输出窗口的类名(spy++获取):", ConsoleColor.Green); //绿色
            //string strTargetEditOut = Console.ReadLine();

            try
            {
                m_MCDataServer = new MCData(this.textBox_title.Text, this.textBox_PositionClass.Text);
                m_MCDataServer.Start();

                m_loginWorker                     = new BackgroundWorker();
                m_loginWorker.DoWork             += LoginWorker_DoWork;
                m_loginWorker.RunWorkerCompleted += LoginWorker_RunWorkerCompleted;
                m_loginWorker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 10
0
    public void SaveStage(int stageNumber)
    {
        SaveLoad.Load();
        MCData data = null;

        try{
            data = SaveLoad.savedMCs[stageNumber];
        }catch {
            isCompleted = true;
            SaveLoad.AddMC();
            Debug.Log("here else");
        }

        if (data != null)
        {
            if (!data.isCompleted)
            {
                data.isCompleted = true;
            }
            SaveLoad.SaveMC(stageNumber);
            Debug.Log("here if");
        }
    }
Exemplo n.º 11
0
        private static bool PopulateTVChannels(bool skipCache, MCData useMCData)
        {
            if (!isWMCOnline)
            {
                return(false);
            }
            if (useMCData == null)
            {
                return(false);
            }

            AllTVChannels = null;

            // Get from stored local channels if they exist
            bool getChannelsFromMediaCenter = true;

            if ((SavedChannelsExist) && (!skipCache))
            {
                AllTVChannels = ChannelsFromLocalStore();  // Try to get channels from local storage

                // If no channels were loaded, then get them from Media Center
                getChannelsFromMediaCenter = (AllTVChannels.Count < 1);
            }

            if (getChannelsFromMediaCenter)
            {
                GetChannelsFromMediaCenter(useMCData, true);
            }

            // Fire event
            if (EPGChannelsRepopulated != null)
            {
                EPGChannelsRepopulated(new object(), new EventArgs());
            }

            return(AllTVChannels != null);
        }
Exemplo n.º 12
0
        private PartData ParsePartData(Transform trans, PartUnit partUnit, string customValue)
        {
            PartData partData;

            switch (partUnit.type)
            {
            case PartType.Bone:
            {
                var data = new BoneData();
                for (int i = 0; i < trans.childCount; i++)
                {
                    var t = trans.GetChild(i);
                    if (!t.name.StartsWith(ModelFBXParser.GroupMark))
                    {
                        continue;
                    }

                    var group = t;
                    for (int j = 0; j < @group.childCount; j++)
                    {
                        var child = @group.GetChild(j);
                        data.num = customValue;
                        var childName = ModelFBXParser.ToLegalName(child.name);
                        data.items.Add(childName);
                    }
                    break;
                }
                partData = data;
                break;
            }

            case PartType.MC:
            {
                var data = new MCData();
                data.type = 1;
                partData  = data;
                break;
            }

            case PartType.Wire:
            {
                var data = new WireData();
                data.num = customValue;
                partData = data;
                break;
            }

            case PartType.Servo:
            {
                var data = new ServoData();
                data.id    = int.Parse(customValue);
                data.type  = 1;
                data.angle = 120;
                partData   = data;
                break;
            }

            case PartType.Motor:
            {
                var data = new MotorData();
                data.id  = int.Parse(customValue);
                partData = data;
                break;
            }

            case PartType.Sensor:
            {
                var data = new SensorData();
                data.id  = int.Parse(customValue);
                partData = data;
                break;
            }

            default:
            {
                partData = new PartData();
                break;
            }
            }

            partData.name               = trans.name;
            partData.source             = partUnit.source;
            partData.transform          = new DTransform();
            partData.transform.position = trans.localPosition;
            partData.transform.angle    = trans.localEulerAngles;
            partData.transform.scale    = GetScale(trans, partData.partType);
            partData.parent             = GetParentName(trans);

            return(partData);
        }
Exemplo n.º 13
0
 public int Add(MCData _data)
 {
     Context.BAS_MCData.Add(_data);
     return(Context.SaveChanges());
 }