Ejemplo n.º 1
0
        private void DoThreadRoutine(object threadpara)
        {
            bool           doWork         = (bool)threadpara;
            SqlDataHandler profileHandler = new SqlDataHandler(_ConnectionString);
            int            iInventoryCostHistoryRowsAffected = 0;

            while (threadParameterList[0])
            {
                profileList = profileHandler.GetAWSLoginProfile();
                //ManualInputData();
                //GetCurrencyExchangeRate();

                foreach (MWSUserProfile profile in profileList)
                {
                    //iInventoryCostHistoryRowsAffected = GetInventoryCost(profile.SSellerId);

                    profile.SServiceURL = MWSServer.Properties.Settings.Default["MWS_ServiceURL"].ToString();
                    //if (DateTime.Now.Hour > 0 && DateTime.Now.Hour < 3)
                    //{
                    //    List<string> tempList = new List<string>();
                    //    tempList = GetTransactionData(profile);
                    //    //tempList.Add("5822760641");
                    //    if (tempList.Count > 0)
                    //    {
                    //        foreach (string sID in tempList)
                    //        {
                    //            List<DateTime> tempPostDateList =
                    //            GetRawSettlementPostedDate(profile.SSellerId, sID);
                    //            foreach (DateTime date in tempPostDateList)
                    //            {
                    //                if(date.Year != 1900)
                    //                    UpdateNetProfitData(profile.SSellerId, date);
                    //            }
                    //        }
                    //    }
                    //}
                    //else
                    //    GetUpdatedInventoryData(profile)
                    GetActiveListing(profile);
                    Thread.Sleep(1000 * 5); //sleep 5 secound
                }



                Thread.Sleep(1000 * 60 * 5); //sleep 5 min
            }
        }
Ejemplo n.º 2
0
        public Main()
        {
            InitializeComponent();
            profileList         = new List <MWSUserProfile>();
            threadParameterList = new List <bool>();
            supplyList          = new SellerInventorySupplyList();
            string sDBFile = "Database1.mdf";
            string sDBpath = Directory.GetCurrentDirectory() + "\\" + sDBFile;

            //use local db file to debug
            //_ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + sDBpath + ";Integrated Security=True;User Instance=True;";
            //use production database
            _ConnectionString = "Data Source=192.168.103.150\\INFLOWSQL;Initial Catalog=MWS;User ID=mws;Password=p@ssw0rd";

            SqlDataHandler profileHandler = new SqlDataHandler(_ConnectionString);

            profileList = profileHandler.GetAWSLoginProfile();
            bool   doWork       = true;
            Thread workerThread = new Thread(new ParameterizedThreadStart(DoThreadRoutine));

            threadParameterList.Add(doWork);
            workerThread.Start(doWork);

            //MWSUserProfile profile = profileList[0];
            //profile.SServiceURL = MWSServer.Properties.Settings.Default["MWS_ServiceURL"].ToString();
            //Thread getOrderDataThread;
            //getOrderDataThread = new Thread(new ParameterizedThreadStart(GetUpdatedOrderData));
            //workerThreadParameter threadPara2 = new workerThreadParameter(profile);
            //threadParameterList.Add(threadPara2);
            //getOrderDataThread.Start(threadPara2);

            //MWSUserProfile profile = profileList[0];
            //profile.SServiceURL = MWSServer.Properties.Settings.Default["MWS_ServiceURL"].ToString();
            //Thread getFBAEstimatedFeeThread;
            //getFBAEstimatedFeeThread = new Thread(new ParameterizedThreadStart(GetFBA_EstimatedFeeData));
            //workerThreadParameter threadPara3 = new workerThreadParameter(profile);
            //threadParameterList.Add(threadPara3);
            //getFBAEstimatedFeeThread.Start(threadPara3);

            //MWSUserProfile profile = profileList[0];
            //Thread getCurrencyRateThread;
            //getCurrencyRateThread = new Thread(new ParameterizedThreadStart(GetCurrencyExchangeRate));
            //workerThreadParameter threadPara4 = new workerThreadParameter(profile);
            //threadParameterList.Add(threadPara4);
            //getCurrencyRateThread.Start(threadPara4);

            //MWSUserProfile profile = profileList[0];
            //Thread getInventoryCostThread;
            //getInventoryCostThread = new Thread(new ParameterizedThreadStart(GetInventoryCost));
            //workerThreadParameter threadPara5 = new workerThreadParameter(profile);
            //threadParameterList.Add(threadPara5);
            //getInventoryCostThread.Start(threadPara5);

            //MWSUserProfile profile = profileList[0];
            //profile.SServiceURL = MWSServer.Properties.Settings.Default["MWS_ServiceURL"].ToString();
            //Thread getFulfilledShipmentsDataThread;
            //getFulfilledShipmentsDataThread = new Thread(new ParameterizedThreadStart(GetUpdatedFulfilledShipmentsData));
            //workerThreadParameter threadPara6 = new workerThreadParameter(profile);
            //threadParameterList.Add(threadPara6);
            //getFulfilledShipmentsDataThread.Start(threadPara6);

            //MWSUserProfile profile = profileList[0];
            //profile.SServiceURL = MWSServer.Properties.Settings.Default["MWS_ServiceURL"].ToString();
            //Thread updateNetProfitDataThread;
            //updateNetProfitDataThread = new Thread(new ParameterizedThreadStart(UpdateNetProfitData));
            //workerThreadParameter threadPara7 = new workerThreadParameter(profile);
            //threadParameterList.Add(threadPara7);
            //updateNetProfitDataThread.Start(threadPara7);
        }