Beispiel #1
0
        public SearchResult GetSeriesCatalogInRectangle(Box extentBox, string[] keywords, double tileWidth, double tileHeight,
            DateTime startDate, DateTime endDate, WebServiceNode[] serviceIDs, BusinessObjects.Models.IProgressHandler bgWorker)
        {
            if (extentBox == null) throw new ArgumentNullException("extentBox");
            if (serviceIDs == null) throw new ArgumentNullException("serviceIDs");
            if (bgWorker == null) throw new ArgumentNullException("bgWorker");

            if (keywords == null || keywords.Length == 0)
            {
                keywords = new[] { String.Empty };
            }

            bgWorker.CheckForCancel();
            var extent = new Extent(extentBox.XMin, extentBox.YMin, extentBox.XMax, extentBox.YMax);
            var fullSeriesList = GetSeriesListForExtent(extent, keywords, tileWidth, tileHeight, startDate, endDate,
                                                        serviceIDs, bgWorker, series => true);
            SearchResult resultFs = null;
            if (fullSeriesList.Count > 0)
            {
                bgWorker.ReportMessage("Calculating Points...");
                resultFs = SearchHelper.ToFeatureSetsByDataSource(fullSeriesList);
            }

            bgWorker.CheckForCancel();
            var message = string.Format("{0} Series found.", totalSeriesCount);
            bgWorker.ReportProgress(100, "Search Finished. " + message);
            return resultFs;
        }
    public static Box Create(Order oOrder)
    {
      Box oBox = new Box();

      oBox.ID = Event.GenerateBoxID.Fire(oOrder.SiteID, oOrder.ClientCode, oOrder);

      oBox.Save();

      oOrder.Boxes.Add(oBox);

      return oBox;
    }
 public override void ShipBox(Order order, Box box)
 {
   MessageBox.Show(string.Format("Shipping box {0} with UPS. Label size {1}", box.ID, LabelSize.ToString()));
   //Event.ShipBox.Fire(Name, Service, order, box);
 }
      public override void ShipBox(BusinessObjects.Order order, Box box)
      {
        if (ShipStatusUpdate != null)
        {
          ShipStatusUpdate("Setting Client API");
        }

        ConfigurationValue oConVal = Configuration.GetValue(new string[] { "EasyPost", "APIKey" });
        if (oConVal != null)
        {
          // Test API: HR89ARS1oymZV0qh3Kdg2g
          Client.apiKey = (string)oConVal.Value;
        }

        if (ShipStatusUpdate != null)
        {
          ShipStatusUpdate("Validating address");
        }

        Address address = Address.CreateAndVerify(new Dictionary<string, object>() {
            {"company", "EasyPost"}, {"street1", "118 2nd Street"}, {"street2", "4th Floor"},
            {"city", "San Francisco"}, {"state", "CA"}, {"country", "US"}, {"zip", "94105"}
        });
        address.Verify();

        if (ShipStatusUpdate != null)
        {
          ShipStatusUpdate("Creating from address");
        }

        Address fromAddress = new Address()
        {
          name = "Andrew Tribone",
          street1 = "480 Fell St",
          street2 = "#3",
          city = "San Francisco",
          state = "CA",
          country = "US",
          zip = "94102"
        };

        if (ShipStatusUpdate != null)
        {
          ShipStatusUpdate("Creating to address");
        }

        Address toAddress = new Address()
        {
          company = "Simpler Postage Inc",
          street1 = "164 Townsend Street",
          street2 = "Unit 1",
          city = "San Francisco",
          state = "CA",
          country = "US",
          zip = "94107"
        };

        if (ShipStatusUpdate != null)
        {
          ShipStatusUpdate("Creating parcel");
        }

        Parcel parcel = new Parcel() { length = 8, width = 6, height = 5, weight = 10 };

        if (ShipStatusUpdate != null)
        {
          ShipStatusUpdate("Shipping parcel");
        }

        Shipment shipment = new Shipment() { to_address = toAddress, from_address = fromAddress, parcel = parcel };
        shipment.Buy(shipment.LowestRate(includeServices: new List<string>() { "Priority" },
                                         excludeCarriers: new List<string>() { "FedEx" }));

        if (ShipStatusUpdate != null)
        {
          ShipStatusUpdate("Generating parcel label");
        }

        string sLabelFormat = "";
        oConVal = Configuration.GetValue(new string[] { "EasyPost", "LabelFormat" });
        if (oConVal != null)
        {
          // Test API: HR89ARS1oymZV0qh3Kdg2g
          sLabelFormat = (string)oConVal.Value;
        }

        shipment.GenerateLabel(sLabelFormat);

        if (sLabelFormat.ToUpper() == "PDF")
        {
          System.Diagnostics.Process.Start(shipment.postage_label.label_pdf_url);
        }
        else if (sLabelFormat.ToUpper() == "ZPL")
        {
          System.Diagnostics.Process.Start(shipment.postage_label.label_url);
        }
      }
    private void btnCreateBox_Click(object sender, EventArgs e)
    {
      Event.BeforeBoxCreating.Fire(_oOrder.SiteID, _oOrder.ClientCode, this, _oOrder);

      _oBox = Box.Create(_oOrder);

      Event.AfterBoxCreated.Fire(_oOrder.SiteID, _oOrder.ClientCode, this, _oOrder, _oBox);

      txtBoxIDLabel.Text = _oBox.ID;
    }
 public static object Fire(string forwarderName, string forwarderService, Order order, Box box)
 {
   return Fire(typeof(ShipBox), new string[] { forwarderName, forwarderService }, new object[] { order, box });
 }
 public static object Fire(int siteID, string clientCode, object sender, Order order, Box box)
 {
   return Fire(typeof(AfterBoxCreated), new string[] { siteID.ToString(), clientCode }, new object[] { sender, order, box });
 }
 public virtual void ShipBox(Order Order, Box Box)
 {
   throw new NotImplementedException();
 }