예제 #1
0
파일: Main.cs 프로젝트: richwwm/web_mws
        private void GetActiveListing(MWSUserProfile profile)
        {
            List <DataTable>     TableList        = null;
            ReportRequestHandler getReportHandler = new ReportRequestHandler(profile);
            string sReportType = "_GET_MERCHANT_LISTINGS_DATA_";
            string sPeriod     = "_15_MINUTES_";

            getReportHandler.ScheduleReportRequest(sReportType, sPeriod);
            string   sMechantID  = profile.SSellerId;
            DateTime startedDate = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 0, 0);
            DateTime endDate     = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 59, 59);

            try
            {
                TableList = getReportHandler.GetScheduledReport(sReportType, startedDate, endDate);
                foreach (DataTable InventoryTable in TableList)
                {
                    if (InventoryTable != null & InventoryTable.Rows.Count > 0)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                DebugLogHandler.DebugLogHandler.WriteLog(sLogPath, sClass, "GetActiveListing() exception message:" + ex.Message);
            }
        }
예제 #2
0
파일: Main.cs 프로젝트: richwwm/web_mws
        private void GetUpdatedInventoryData(MWSUserProfile profile)
        {
            List <DataTable>     InventoryTableList = null;
            ReportRequestHandler getReportHandler   = new ReportRequestHandler(profile);
            string sReportType = "_GET_FBA_MYI_ALL_INVENTORY_DATA_";
            string sPeriod     = "_15_MINUTES_";

            getReportHandler.ScheduleReportRequest(sReportType, sPeriod);
            string   sMechantID  = profile.SSellerId;
            DateTime startedDate = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 0, 0);
            DateTime endDate     = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, 59, 59);

            try
            {
                InventoryTableList = getReportHandler.GetScheduledReport(sReportType, startedDate, endDate);
                foreach (DataTable InventoryTable in InventoryTableList)
                {
                    if (InventoryTable != null & InventoryTable.Rows.Count > 0)
                    {
                        SqlDataHandler fillDataHandler = new SqlDataHandler(_ConnectionString);
                        DataSet        ds = new DataSet();
                        DataTable      ProductAvailabilityTable = new DataTable();
                        ProductAvailabilityTable.Columns.Add("FNSKU", typeof(String));
                        ProductAvailabilityTable.Columns.Add("SellerSKU", typeof(String));
                        ProductAvailabilityTable.Columns.Add("ASIN", typeof(String));
                        ProductAvailabilityTable.Columns.Add("ProductName", typeof(String));
                        ProductAvailabilityTable.Columns.Add("Inbound", typeof(Int32));
                        ProductAvailabilityTable.Columns.Add("Fulfillable", typeof(Int32));
                        ProductAvailabilityTable.Columns.Add("Unfulfillable", typeof(Int32));
                        ProductAvailabilityTable.Columns.Add("Reserved", typeof(Int32));
                        ProductAvailabilityTable.Columns.Add("MerchantID", typeof(String));
                        foreach (DataRow row in InventoryTable.Rows)
                        {
                            DataRow ProductRow = ProductAvailabilityTable.NewRow();
                            ProductRow["FNSKU"]         = row[1];
                            ProductRow["SellerSKU"]     = row[0];
                            ProductRow["ASIN"]          = row[2];
                            ProductRow["ProductName"]   = row[3];
                            ProductRow["Inbound"]       = Int32.Parse(row[16].ToString());
                            ProductRow["Fulfillable"]   = Int32.Parse(row[10].ToString());
                            ProductRow["Unfulfillable"] = Int32.Parse(row[11].ToString());
                            ProductRow["Reserved"]      = Int32.Parse(row[12].ToString());
                            ProductRow["MerchantID"]    = sMechantID;
                            ProductAvailabilityTable.Rows.Add(ProductRow);
                        }
                        if (ProductAvailabilityTable.Rows.Count > 0)
                        {
                            ds.Tables.Add(ProductAvailabilityTable);
                            fillDataHandler.UpdateProductAvailabilityData("ProductAvailability", ds, profile.SSellerId);
                        }

                        fillDataHandler          = null;
                        ProductAvailabilityTable = null;
                        ds = null;
                    }
                }
            }
            catch (Exception ex)
            {
                DebugLogHandler.DebugLogHandler.WriteLog(sLogPath, sClass, "GetUpdatedInventoryData() exception message:" + ex.Message);
            }
        }