private ArrayList getAllShipments(string query) { ArrayList shipmentsData = new ArrayList(); Shipments shipment = new Shipments(); OleDbConnection dbConnection = dbManager.openDb(); this.comand.Connection = dbConnection; comand.CommandText = query; OleDbDataReader result = comand.ExecuteReader(); while (result.Read()) { shipment.CompanyOrderId = result.GetInt32(0); shipment.CompanyId = result.GetInt32(1); shipment.CompanyName = result.GetString(2); shipment.TotalPrice = (double)result.GetDecimal(3); shipment.PaidAmount = (double)result.GetDecimal(4); shipment.OrderDate = result.GetDateTime(5); shipment.DebtValue = (double)result.GetDecimal(6); shipmentsData.Add(shipment); shipment = new Shipments(); } result.Close(); dbManager.closeDb(); return(shipmentsData); }
/// <summary> /// Get the next page of shipments based on the original parameters used to generate the list /// </summary> /// <param name="client">Easy post client to use</param> /// <returns>A new ShipmentList instance.</returns> public async Task<ShipmentList> Next( IEasyPostClient client) { var options = Options ?? new ShipmentListOptions(); options.BeforeId = Shipments.Last().Id; return await client.ListShipments(options); }
internal bool setCompanyOrder(Shipments shpment) { string query = "UPDATE CompanyOrders set PaidAmount = {0} WHERE CompanyOrderID = {1};"; query = string.Format(query, shpment.TotalPrice, shpment.CompanyOrderId); return(inserUpdatetObj.inserUpdatetData(query)); }
public bool insertShipment(Shipments shipment) { insertMed(shipment.OrderMeds); insertCmedsOrder(shipment, insertOrder(shipment)); updateCompanyDepts(shipment.Company); return(true); }
public List <Shipments> Pending(Customers customer) { var shipments = new List <Shipments>(); var sqlQuery = "select Serie,Numero,Año,IdCliente,Fichero from Facturas where Enviada = 0"; if (customer != null) { sqlQuery = sqlQuery + " and IdCliente = " + customer.GetCode; } var pendingBills = (from DataRow fPendientes in _connectionAccess.ExecuteSqlAdapter(sqlQuery).Rows select new Bills(fPendientes["Serie"].ToString(), fPendientes["Numero"].ToString(), fPendientes["Año"].ToString())).ToList(); var customersWithPendingBills = pendingBills.GroupBy(factura => factura.GetCustomer.GetCode) .Select(grp => grp.First().GetCustomer.GetCode).ToList(); foreach (var customerWithPendingBills in customersWithPendingBills) { var copyCustomerWithPendingBills = customerWithPendingBills; var pendingBillsByCustomer = pendingBills.Where(cus => cus.GetCustomer.GetCode == copyCustomerWithPendingBills); var shipment = new Shipments(new Customers(customerWithPendingBills), pendingBillsByCustomer, DateTime.Now); shipments.Add(shipment); } return(shipments); }
internal static string TrackingUpdate(String token, String filename, string publicDirectory) { String order_id = filename.Replace(".json", ""); String absoluteFileName = publicDirectory + filename; String data = String.Empty; Shipments shipments = new Shipments(); try { // Open the text file using a stream reader. using (StreamReader sr = new StreamReader(absoluteFileName)) { // Read the stream to a string, and write the string to the console. data = sr.ReadToEnd(); } } catch (Exception e) { return("The file could not be read:" + e.Message); } shipments = (Shipments)JsonConvert.DeserializeObject(data, typeof(Shipments)); List <String> order_item_acknowledgement = new List <String>(); StringContent sc = new StringContent(data); using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var response = client.PutAsync("https://merchant-api.jet.com/api/orders/" + order_id + "/shipped", sc).Result; return(response.Content.ReadAsStringAsync().Result); } }
public async Task <IActionResult> Edit(int id, [Bind("ShipmentId,DateStamp")] Shipments shipments) { if (id != shipments.ShipmentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shipments); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShipmentsExists(shipments.ShipmentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(shipments)); }
protected override void DoSaveChanges() { var shipments = new List <Foundation.Orders.Model.Shipment>(); using (var repository = _repositoryFactory.GetRepositoryInstance()) { var newPickList = InnerItem; newPickList.MemberId = _authenticationContext.CurrentUserId; newPickList.FulfillmentCenterId = SelectedFulfillmentCenter.FulfillmentCenterId; repository.Add(newPickList); repository.UnitOfWork.Commit(); } using (var repository = _orderRepositoryFactory.GetRepositoryInstance()) { Shipments.Where(x => x.IsSelected).ToList().ForEach(s => { var shipment = repository.Shipments.Where(o => o.ShipmentId == s.ShipmentId).First(); shipment.PicklistId = InnerItem.PicklistId; shipment.FulfillmentCenterId = SelectedFulfillmentCenter.FulfillmentCenterId; shipment.Status = Foundation.Orders.Model.ShipmentStatus.Packing.ToString(); shipments.Add(shipment); repository.UnitOfWork.Commit(); }); } }
/// <summary> /// Получение всего /// </summary> /// <returns></returns> public List <Shipments> GetShipmentsAll() { Shipments.Clear(); try { using RegistrantCoreContext ef = new RegistrantCoreContext(); var shipments = ef.Shipments.OrderBy(x => x.IdTimeNavigation.DateTimePlanRegist); foreach (var item in shipments) { Shipments shipment = new Shipments(item); Shipments.Add(shipment); } } catch (Exception ex) { MainWindow mainWindow = (MainWindow)Application.Current.MainWindow; if (mainWindow != null) { mainWindow.ContentErrorText.ShowAsync(); mainWindow.text_debuger.Text = ex.ToString(); } } return(Shipments); }
public static Shipments UpdateShipment(Shipments ship, PeopleShippers item) { ship.ExternalId = item.ExternalId; ship.Code = item.Code; ship.Height = item.Height; ship.Length = item.Length; ship.Width = item.Width; ship.TotalGrossWeight = item.TotalGrossWeight; ship.TotalNetWeight = item.TotalNetWeight; ship.TotalCost = item.TotalCost; ship.TotalCustomsValue = item.TotalCustomsValue; ship.InvoiceNumber = item.InvoiceNumber; ship.InvoiceDate = item.InvoiceDate; ship.DispatchDate = item.DispatchDate; ship.CreationDate = item.CreationDate; ship.DeliveryCategoryId = item.DeliveryCategoryId; ship.DispatchPlaceId = item.DispatchPlaceId; ship.RegistryId = item.RegistryId; ship.Description = item.Description; ship.Comment = item.Comment; ship.ShipperCompanyId = item.ShipperCompanyId; ship.ShipperPersonId = item.ShipperPersonId; ship.ReceiverCompanyId = item.ReceiverCompanyId; ship.ReceiverPersonId = item.ReceiverPersonId; ship.StatusId = item.StatusId; ship.Update = item.Update; ship.UserId = Global.currentUser.Id; ship.ParcelType = item.ParcelType; ship.ReceiverType = item.ReceiverType; ship.PackageAmount = item.PackageAmount; ship.ShipperType = item.ShipperType; return(ship); }
public async Task <IHttpActionResult> PutShipments(int id, Shipments shipments) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shipments.Id) { return(BadRequest()); } db.Entry(shipments).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShipmentsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IActionResult IndexPost() { List <int> lstCartItems = HttpContext.Session.Get <List <int> >("ssShoppingCart"); ShoppingCartVM.Shipments.ShipmentDate = ShoppingCartVM.Shipments.ShipmentDate.AddHours(ShoppingCartVM.Shipments.ShipmentTime.Hour).AddMinutes(ShoppingCartVM.Shipments.ShipmentTime.Minute); Shipments shipments = ShoppingCartVM.Shipments; _db.Shipments.Add(shipments); _db.SaveChanges(); int shipmentID = shipments.ID; foreach (int bookID in lstCartItems) { BooksSelectedForShipment booksSelectedForShipment = new BooksSelectedForShipment() { ShipmentID = shipmentID, BookID = bookID }; _db.BooksSelectedForShipment.Add(booksSelectedForShipment); } _db.SaveChanges(); lstCartItems = new List <int>(); HttpContext.Session.Set("ssShoppingCart", lstCartItems); return(RedirectToAction("ShipmentConfirmation", "ShoppingCart", new { ID = shipmentID })); }
/// <summary> /// Покинули /// </summary> /// <param name="date"></param> /// <returns></returns> public List <Shipments> GetShipmentsLeft(DateTime date) { Shipments.Clear(); try { using RegistrantCoreContext ef = new RegistrantCoreContext(); var shipments = ef.Shipments.Where(x => (x.IdTimeNavigation.DateTimePlanRegist.Value.Date == date.Date || x.IdTimeNavigation.DateTimeFactRegist.Value.Date == date.Date) && x.IdTimeNavigation.DateTimeLeft != null && x.Active != "0") .OrderBy(x => x.IdTimeNavigation.DateTimePlanRegist); foreach (var item in shipments) { Shipments shipment = new Shipments(item); Shipments.Add(shipment); } } catch (Exception ex) { MainWindow mainWindow = (MainWindow)Application.Current.MainWindow; if (mainWindow != null) { mainWindow.ContentErrorText.ShowAsync(); mainWindow.text_debuger.Text = ex.ToString(); } } return(Shipments); }
private void ordersData_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int index = ordersData.CurrentCell.RowIndex; Shipments shpment = (Shipments)ordersList[index]; if (shpment.TotalPrice == shpment.PaidAmount) { return; } if (!makeSure("Do you want to set that shipment as Paid?")) { return; } if (sdo.setCompanyOrder(shpment)) { this.companyObj.DebtValue -= shpment.DebtValue; debtValueEditBox.Text = this.companyObj.DebtValue + ""; // operation.updateCompany(companyObj); shpment.PaidAmount = shpment.TotalPrice; shpment.DebtValue = 0; ordersData.Rows.RemoveAt(index); addNewRow(shpment); } }
public async Task Execute() { try { Search = GetInitialSeach(); var results = await ShipmentDAO.Methods.Search(Search); var total = results.Pagination.Total; await SetShipments(); for (; Search.Pagination.Offset < total; IncrementSearch(), await SetShipments()) { Shipments.ForEach(async shipment => { await Update(shipment); await ShipmentUseCases.NotifyUpdates(shipment); }); } } catch (Exception e) { Console.WriteLine(e); //return; } }
public CustomerOrderEntity GetCustomerOrderById(string id, CustomerOrderResponseGroup responseGroup) { var query = CustomerOrders.Where(x => x.Id == id) .Include(x => x.Discounts) .Include(x => x.TaxDetails); if ((responseGroup & CustomerOrderResponseGroup.WithAddresses) == CustomerOrderResponseGroup.WithAddresses) { var addresses = Addresses.Where(x => x.CustomerOrderId == id).ToArray(); } if ((responseGroup & CustomerOrderResponseGroup.WithInPayments) == CustomerOrderResponseGroup.WithInPayments) { var inPayments = InPayments.Where(x => x.CustomerOrderId == id).ToArray(); var paymentsIds = inPayments.Select(x => x.Id).ToArray(); var paymentAddresses = Addresses.Where(x => paymentsIds.Contains(x.PaymentInId)).ToArray(); } if ((responseGroup & CustomerOrderResponseGroup.WithItems) == CustomerOrderResponseGroup.WithItems) { var lineItems = LineItems.Include(x => x.TaxDetails) .Include(x => x.Discounts) .Where(x => x.CustomerOrderId == id).ToArray(); } if ((responseGroup & CustomerOrderResponseGroup.WithShipments) == CustomerOrderResponseGroup.WithShipments) { var shipments = Shipments.Include(x => x.TaxDetails) .Include(x => x.Discounts) .Include(x => x.Items) .Include(x => x.Packages.Select(y => y.Items)) .Where(x => x.CustomerOrderId == id).ToArray(); var shipmentIds = shipments.Select(x => x.Id).ToArray(); var addresses = Addresses.Where(x => shipmentIds.Contains(x.ShipmentId)).ToArray(); } return(query.FirstOrDefault()); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (!Shipments.Any(s => s.IsSelected)) { yield return(new ValidationResult(UploadChoiceViewModelResources.ShipmentRequired, new[] { "Shipments" })); } }
public override OrderOperation ToModel(OrderOperation operation) { var order = operation as CustomerOrder; if (order == null) { throw new ArgumentException(@"operation argument must be of type CustomerOrder", nameof(operation)); } order.CustomerId = CustomerId; order.CustomerName = CustomerName; order.StoreId = StoreId; order.StoreName = StoreName; order.OrganizationId = OrganizationId; order.OrganizationName = OrganizationName; order.EmployeeId = EmployeeId; order.EmployeeName = EmployeeName; order.DiscountAmount = DiscountAmount; order.Total = Total; order.SubTotal = SubTotal; order.SubTotalWithTax = SubTotalWithTax; order.ShippingTotal = ShippingTotal; order.ShippingTotalWithTax = ShippingTotalWithTax; order.PaymentTotal = PaymentTotal; order.PaymentTotalWithTax = PaymentTotalWithTax; order.FeeTotal = HandlingTotal; order.FeeTotalWithTax = HandlingTotalWithTax; order.DiscountTotal = DiscountTotal; order.DiscountTotalWithTax = DiscountTotalWithTax; order.DiscountAmount = DiscountAmount; order.TaxTotal = TaxTotal; order.IsPrototype = IsPrototype; order.SubscriptionNumber = SubscriptionNumber; order.SubscriptionId = SubscriptionId; order.LanguageCode = LanguageCode; order.TaxPercentRate = TaxPercentRate; order.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); order.Items = Items.Select(x => x.ToModel(AbstractTypeFactory <LineItem> .TryCreateInstance())).ToList(); order.Addresses = Addresses.Select(x => x.ToModel(AbstractTypeFactory <Address> .TryCreateInstance())).ToList(); order.Shipments = Shipments.Select(x => x.ToModel(AbstractTypeFactory <Shipment> .TryCreateInstance())).OfType <Shipment>().ToList(); order.InPayments = InPayments.Select(x => x.ToModel(AbstractTypeFactory <PaymentIn> .TryCreateInstance())).OfType <PaymentIn>().ToList(); order.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); order.DynamicProperties = DynamicPropertyObjectValues.GroupBy(g => g.PropertyId).Select(x => { var property = AbstractTypeFactory <DynamicObjectProperty> .TryCreateInstance(); property.Id = x.Key; property.Name = x.FirstOrDefault()?.PropertyName; property.Values = x.Select(v => v.ToModel(AbstractTypeFactory <DynamicPropertyObjectValue> .TryCreateInstance())).ToArray(); return(property); }).ToArray(); base.ToModel(order); Sum = order.Total; return(order); }
/// <summary> /// Marks current instance as new which will cause new record to be created in the database for the specified object. /// This is useful for creating duplicates of existing objects. /// </summary> internal override void MarkNew() { base.MarkNew(); Shipments.MarkNew(); Payments.MarkNew(); LineItems.MarkNew(); Discounts.MarkNew(); }
public void AppendShipment(Shipment shipment) { if (Shipments == null) { Shipments = new List <Shipment>(); } Shipments.Add(shipment); }
private void MoveBillFile(Shipments shipment) { foreach (var bill in shipment.GetBills) { File.Move(_globalConfig.PendingBillPath + "\\" + bill.GetFile, _globalConfig.SentBillPath + "\\" + bill.GetFile); } }
public void CarrierBatch_Success() { var shipments = new List <ShipmentRequest>(); foreach (var transactionNumber in Enumerable.Range(1, 100)) { var shipment = new ShipmentRequest { Sequence = 1, ShipToAddress1 = "123 SAMPLE STREET", ShipToCountry = "US", ShipToName = "JOHN SMITH", ServiceCode = "GRD", TransactionNumber = $"TEST {Guid.NewGuid()} {transactionNumber}", ShipToPostal = "46774", ShipToCity = "NEW HAVEN", ShipToStateProvince = "IN", ShipToPhone = "11111111111", Packages = new Package[] { new Package { Weight = 2, BoxHeight = 1, BoxLength = 12, BoxWidth = 9, Items = new Item[] { new Item { Sku = "TST", LotNumber = "LT1", SerialNumber = "", Description = "TEST", Description2 = "", Quantity = 1, UnitPrice = 1, ExpirationDate = "2099-07-19T17:12:02.731Z", Uom = "Each", Supplier = "", CountryOfOrigin = "US" } } } }, ClientCode = "Test", Terms = "SHIPPER" }; shipments.Add(shipment); } var result = new Shipments(_apiKey, _secretKey).CarrierBatch( duplicateHandling: DuplicateHandling.Overwrite, shipments: shipments.ToArray() ); Assert.IsNotNull(result); }
public virtual ShoppingCart ToModel(ShoppingCart cart) { if (cart == null) { throw new ArgumentNullException(nameof(cart)); } cart.Id = Id; cart.CreatedBy = CreatedBy; cart.CreatedDate = CreatedDate; cart.ModifiedBy = ModifiedBy; cart.ModifiedDate = ModifiedDate; cart.StoreId = StoreId; cart.Fee = Fee; cart.FeeWithTax = FeeWithTax; cart.Status = Status; cart.Currency = Currency; cart.ValidationType = ValidationType; cart.CustomerId = CustomerId; cart.CustomerName = CustomerName; cart.IsAnonymous = IsAnonymous; cart.IsRecuring = IsRecuring; cart.LanguageCode = LanguageCode; cart.Comment = Comment; cart.OrganizationId = OrganizationId; cart.Total = Total; cart.SubTotal = SubTotal; cart.SubTotalWithTax = SubTotalWithTax; cart.ShippingTotal = ShippingTotal; cart.ShippingTotalWithTax = ShippingTotalWithTax; cart.PaymentTotal = PaymentTotal; cart.PaymentTotalWithTax = PaymentTotalWithTax; cart.HandlingTotal = HandlingTotal; cart.HandlingTotalWithTax = HandlingTotalWithTax; cart.DiscountTotal = DiscountTotal; cart.DiscountTotalWithTax = DiscountTotalWithTax; cart.DiscountAmount = DiscountAmount; cart.TaxTotal = TaxTotal; cart.TaxPercentRate = TaxPercentRate; cart.Type = Type; cart.Name = Name; cart.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); cart.Items = Items.Select(x => x.ToModel(AbstractTypeFactory <LineItem> .TryCreateInstance())).ToList(); cart.Addresses = Addresses.Select(x => x.ToModel(AbstractTypeFactory <Address> .TryCreateInstance())).ToList(); cart.Shipments = Shipments.Select(x => x.ToModel(AbstractTypeFactory <Shipment> .TryCreateInstance())).ToList(); cart.Payments = Payments.Select(x => x.ToModel(AbstractTypeFactory <Payment> .TryCreateInstance())).ToList(); cart.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); cart.Coupons = Coupons.Select(x => x.Code).ToList(); // Assigning single coupon to preserve backwards compatibility with previous versions of CartModule cart.Coupon = cart.Coupons.FirstOrDefault(); return(cart); }
public ActionResult EditShipment(Shipments shipment) { Shipments u_shipment = db.Shipments.Where(o => o.shipmentID == shipment.shipmentID).FirstOrDefault(); u_shipment.warehouseID = shipment.warehouseID; u_shipment.shipmentDescription = shipment.shipmentDescription; u_shipment.shipmentDate = shipment.shipmentDate; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddShipment(Shipments shipment) { if (Session["StaffID"] != null) { shipment.staffID = Convert.ToInt32(Session["StaffID"].ToString()); } db.Shipments.Add(shipment); db.SaveChanges(); return(RedirectToAction("AddBill", new { shipmentID = shipment.shipmentID })); }
private void addNewRow(Shipments shipment) { DataRow dataRow = table.NewRow(); dataRow[ORDER_DATE] = shipment.OrderDate.ToString("dd MMM yyyy"); dataRow[TOTAL_COST] = shipment.TotalPrice; dataRow[PAID_AMOUNT] = shipment.PaidAmount; dataRow[REMAINING_AMOUNT] = shipment.DebtValue; table.Rows.Add(dataRow); }
/// <summary> /// Returns true if Request instances are equal /// </summary> /// <param name="input">Instance of Request to be compared</param> /// <returns>Boolean</returns> public bool Equals(Request input) { if (input == null) { return(false); } return (( Vehicles == input.Vehicles || Vehicles != null && Vehicles.SequenceEqual(input.Vehicles) ) && ( VehicleTypes == input.VehicleTypes || VehicleTypes != null && VehicleTypes.SequenceEqual(input.VehicleTypes) ) && ( Services == input.Services || Services != null && Services.SequenceEqual(input.Services) ) && ( Shipments == input.Shipments || Shipments != null && Shipments.SequenceEqual(input.Shipments) ) && ( Relations == input.Relations || Relations != null && Relations.SequenceEqual(input.Relations) ) && ( Algorithm == input.Algorithm || (Algorithm != null && Algorithm.Equals(input.Algorithm)) ) && ( Objectives == input.Objectives || Objectives != null && Objectives.SequenceEqual(input.Objectives) ) && ( CostMatrices == input.CostMatrices || CostMatrices != null && CostMatrices.SequenceEqual(input.CostMatrices) ) && ( Configuration == input.Configuration || (Configuration != null && Configuration.Equals(input.Configuration)) )); }
public async Task <IActionResult> Create([Bind("ShipmentId,DateStamp")] Shipments shipments) { if (ModelState.IsValid) { _context.Add(shipments); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shipments)); }
public async Task <IHttpActionResult> GetShipments(int id) { Shipments shipments = await db.Shipments.FindAsync(id); if (shipments == null) { return(NotFound()); } return(Ok(shipments)); }
private void PrepareDeliveryBtn_Click(object sender, RoutedEventArgs e) { try { Shipments.ShowShipments(); } catch (Exception ex) { Log.This(ex); } }