/// <summary> /// Creates a connection using token. /// </summary> /// <param name="companyId">Company context</param> /// <param name="token">The predefined token from Visma.net</param> /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param> public VismaNet(int companyId, string token, int branchId = 0) { if (string.IsNullOrEmpty(token)) { throw new InvalidArgumentsException("Token is missing"); } Auth = new VismaNetAuthorization { Token = token, CompanyId = companyId, BranchId = branchId }; Customers = new CustomerData(Auth); CustomerInvoices = new CustomerInvoiceData(Auth); Suppliers = new SupplierData(Auth); SupplierInvoices = new SupplierInvoiceData(Auth); CashSales = new CashSaleData(Auth); CustomerDocuments = new CustomerDocumentData(Auth); Dimensions = new DimensionData(Auth); Inventory = new InventoryData(Auth); JournalTransactions = new JournalTransactionData(Auth); Accounts = new FinAccountData(Auth); Employee = new EmployeeData(Auth); CreditNote = new CreditNoteData(Auth); Shipments = new ShipmentData(Auth); Contacts = new ContactData(Auth); Projects = new ProjectData(Auth); SalesOrder = new SalesOrderData(Auth); }
// GET: CustomAggregates public ActionResult CustomAggregate() { var treeData = ShipmentData.GetShipmentData(); ViewBag.datasource = treeData; return(View()); }
// GET: DefaultFunctionalities public ActionResult StackedHeader() { var treeData = ShipmentData.GetShipmentData(); ViewBag.datasource = treeData; return(View()); }
/// <summary> /// Creates a connection using token. /// </summary> /// <param name="companyId">Company context</param> /// <param name="token">The predefined token from Visma.net</param> /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param> public VismaNet(int companyId, string token, int branchId = 0) { if (string.IsNullOrEmpty(token)) { throw new InvalidArgumentsException("Token is missing"); } Auth = new VismaNetAuthorization { Token = token, CompanyId = companyId, BranchId = branchId }; Attribute = new AttributeData(Auth); Customer = new CustomerData(Auth); Currency = new CurrencyData(Auth); CustomerInvoice = new CustomerInvoiceData(Auth); Supplier = new SupplierData(Auth); SupplierInvoice = new SupplierInvoiceData(Auth); CashSale = new CashSaleData(Auth); CustomerDocument = new CustomerDocumentData(Auth); Dimension = new DimensionData(Auth); Discount = new DiscountData(Auth); Inventory = new InventoryData(Auth); JournalTransaction = new JournalTransactionData(Auth); GeneralLedgerTransaction = new GeneralLedgerTransactionData(Auth); GeneralLedgerBalance = new GeneralLedgerBalanceData(Auth); Account = new FinAccountData(Auth); FinancialPeriod = new FinancialPeriodData(Auth); Employee = new EmployeeData(Auth); Shipment = new ShipmentData(Auth); Contact = new ContactData(Auth); Project = new ProjectData(Auth); #pragma warning disable CS0618 // Type or member is obsolete SalesOrder = new SalesOrderData(Auth); #pragma warning restore CS0618 // Type or member is obsolete Branch = new BranchData(Auth); Warehouse = new WarehouseData(Auth); Location = new LocationData(Auth); Subaccount = new SubaccountData(Auth); CustomerPayment = new CustomerPaymentData(Auth); Dynamic = new VismaNetDynamicEndpoint(null, Auth); Resources = new VismaNetDynamicEndpoint(null, Auth, true); SupplierDocument = new SupplierDocumentData(Auth); InventoryIssue = new InventoryIssueData(Auth); InventoryReceipt = new InventoryReceiptData(Auth); PurchaseReceipt = new PurchaseReceiptData(Auth); CustomerSalesPrice = new CustomerSalesPriceData(Auth); CustomerCreditNote = new CustomerCreditNoteData(Auth); PurchaseOrder = new PurchaseOrderData(Auth); CashTransaction = new CashTransactionData(Auth); }
public IHttpActionResult GetPackageDetails(int id, string shopId) { Package package = dbCtx.Packages.Find(id); if (package == null) { return(NotFound()); } else { //get packageDTO PackageDetailsDTO pd = new PackageDetailsDTO() { DeliveryMethod = "Door To Door", DeliveryTime = package.DeliveryTime, PackageId = package.Id, PackageStatus = package.Status, PaymentMethod = dbCtx.Orders.FirstOrDefault(o => o.Id == package.OrderId).PaymentMethod, ShippingFees = 50, TotalCharge = package.Price, }; List <OrderProduct> orderProducts = dbCtx.OrderProducts.Include("Product").Where(op => op.OrderId == package.OrderId).ToList(); List <OrderProduct> packageOrder = orderProducts.Where(p => p.Product.ShopID == shopId).ToList(); Order orderRequested = dbCtx.Orders.FirstOrDefault(o => o.Id == package.OrderId); ShipmentData packageShipmentData = dbCtx.ShipmentDatas.FirstOrDefault(s => s.Id == orderRequested.ShipmentDataId); pd.ShippingData = orderRequested.ShipmentData; List <PackageProductDTO> packageProductList = new List <PackageProductDTO>(); PackageProductDTO singleProduct; foreach (var orderProduct in orderProducts) { singleProduct = new PackageProductDTO() { Id = orderProduct.Product.Id, Name = orderProduct.Product.Name, Images = orderProduct.Product.Images, PackageId = package.Id, Variations = orderProduct.Variations, Discount = orderProduct.Product.Discount == null?0: orderProduct.Product.Discount, Quantity = orderProduct.Quantity, Price = orderProduct.Quantity, }; packageProductList.Add(singleProduct); } pd.ProductList = packageProductList; return(Ok(package)); } }
/// <summary> /// Sends shipping information of an order item asynchronous. /// </summary> /// <param name="orderItemId">The order item identifier.</param> /// <param name="shipmentData">The shipment data.</param> /// <returns></returns> public async Task <StatusResponse> ShipOrderItemAsync(string orderItemId, ShipmentData shipmentData) { return(await GetApiResult <StatusResponse>( HttpMethod.Put, $"{EndPoints.BaseUriApiCalls}{EndPoints.SingleOrder}{orderItemId}/shipment", new { shipmentReference = shipmentData.ShipmentReference, transport = new { transporterCode = shipmentData.Transport.TransporterCode.TransporterCodeValue, trackAndTrace = shipmentData.Transport.TrackAndTrace } } )); }
/// <summary> /// Sends shipping information of an order asynchronous. /// </summary> /// <param name="orderId">The order identifier.</param> /// <param name="shipmentData">The shipment data.</param> /// <returns></returns> /// <exception cref="NoOrderItemsInOrderException">No order items found in order {orderId}.</exception> public async Task <List <StatusResponse> > ShipOrderAsync(string orderId, ShipmentData shipmentData) { var order = await GetOrderAsync(orderId); if (order?.OrderItems?.Any() != true) { throw new NoOrderItemsInOrderException($"No order items found in order {orderId}."); } var result = new List <StatusResponse>(); var taskList = order.OrderItems.Select( oi => Task.Run(async() => { result.Add(await ShipOrderItemAsync(oi.OrderItemId, shipmentData)); }) ); await Task.WhenAll(taskList); return(result); }
/// <summary> /// Creates a connection using token. /// </summary> /// <param name="companyId">Company context</param> /// <param name="token">The predefined token from Visma.net</param> /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param> public VismaNet(int companyId, string token, int branchId = 0) { if (string.IsNullOrEmpty(token)) { throw new InvalidArgumentsException("Token is missing"); } Auth = new VismaNetAuthorization { Token = token, CompanyId = companyId, BranchId = branchId }; Customer = new CustomerData(Auth); CustomerInvoice = new CustomerInvoiceData(Auth); Supplier = new SupplierData(Auth); SupplierInvoice = new SupplierInvoiceData(Auth); CashSale = new CashSaleData(Auth); CustomerDocument = new CustomerDocumentData(Auth); Dimension = new DimensionData(Auth); Inventory = new InventoryData(Auth); JournalTransaction = new JournalTransactionData(Auth); Account = new FinAccountData(Auth); Employee = new EmployeeData(Auth); CreditNote = new CreditNoteData(Auth); Shipment = new ShipmentData(Auth); Contact = new ContactData(Auth); Project = new ProjectData(Auth); SalesOrder = new SalesOrderData(Auth); Payment = new PaymentData(Auth); Branch = new BranchData(Auth); Warehouse = new WarehouseData(Auth); Location = new LocationData(Auth); Subaccount = new SubaccountData(Auth); CustomerPayment = new CustomerPaymentData(Auth); Dynamic = new VismaNetDynamicEndpoint(null, Auth); Resources = new VismaNetDynamicEndpoint(null, Auth, true); }
private List <ShipmentData> getShipmentData() { List <ShipmentData> DataCollection = new List <ShipmentData>(); ShipmentData Parent1 = new ShipmentData() { ID = "1", Name = "Order 1", Units = 1395, UnitPrice = 47, Price = 13366, Children = new List <ShipmentData>() }; ShipmentData Child1 = new ShipmentData() { ID = "1.1", Name = "Mackerel", Category = "Frozen seafood", Units = 235, UnitPrice = 12, Price = 2820 }; ShipmentData Child2 = new ShipmentData() { ID = "1.2", Name = "Yellowfin Tuna", Category = "Frozen seafood", Units = 324, UnitPrice = 8, Price = 2592 }; ShipmentData Child3 = new ShipmentData() { ID = "1.3", Name = "Herrings", Category = "Frozen seafood", Units = 488, UnitPrice = 11, Price = 5268 }; ShipmentData Child4 = new ShipmentData() { ID = "1.4", Name = "Preserved Olives", Category = "Edible", Units = 125, UnitPrice = 9, Price = 1125 }; ShipmentData Child5 = new ShipmentData() { ID = "1.5", Name = " Sweet corn Frozen ", Category = "Edible", Units = 223, UnitPrice = 7, Price = 1561 }; Parent1.Children.Add(Child1); Parent1.Children.Add(Child2); Parent1.Children.Add(Child3); Parent1.Children.Add(Child4); Parent1.Children.Add(Child5); ShipmentData Parent2 = new ShipmentData() { ID = "2", Name = "Order 2", Units = 1944, UnitPrice = 58, Price = 21233, Children = new List <ShipmentData>() }; ShipmentData Child6 = new ShipmentData() { ID = "2.1", Name = "Tilapias", Category = "Frozen seafood", Units = 278, UnitPrice = 15, Price = 4170 }; ShipmentData Child7 = new ShipmentData() { ID = "2.2", Name = "White Shrimp", Category = "Frozen seafood", Units = 560, UnitPrice = 7, Price = 3920 }; ShipmentData Child8 = new ShipmentData() { ID = "2.3", Name = "Fresh Cheese", Category = "Dairy", Units = 323, UnitPrice = 12, Price = 3876 }; ShipmentData Child9 = new ShipmentData() { ID = "2.4", Name = "Blue Veined Cheese", Category = "Dairy", Units = 370, UnitPrice = 15, Price = 5550 }; ShipmentData Child10 = new ShipmentData() { ID = "2.5", Name = "Butter", Category = "Dairy", Units = 413, UnitPrice = 9, Price = 3717 }; Parent2.Children.Add(Child6); Parent2.Children.Add(Child7); Parent2.Children.Add(Child8); Parent2.Children.Add(Child9); Parent2.Children.Add(Child10); ShipmentData Parent3 = new ShipmentData() { ID = "3", Name = "Order 3", Units = 1944, UnitPrice = 58, Price = 21233, Children = new List <ShipmentData>() }; ShipmentData Child11 = new ShipmentData() { ID = "3.1", Name = "Lead glassware", Category = "Solid crystals", Units = 542, UnitPrice = 6, Price = 3252 }; ShipmentData Child12 = new ShipmentData() { ID = "3.2", Name = "Pharmaceutical Glassware", Category = "Solid crystals", Units = 324, UnitPrice = 11, Price = 3564 }; ShipmentData Child13 = new ShipmentData() { ID = "3.3", Name = "Glass beads", Category = "Solid crystals", Units = 254, UnitPrice = 16, Price = 4064 }; Parent3.Children.Add(Child11); Parent3.Children.Add(Child12); Parent3.Children.Add(Child13); DataCollection.Add(Parent1); DataCollection.Add(Parent2); DataCollection.Add(Parent3); return(DataCollection); }
public ShipmentsResponse() { SHP = new ShipmentData(); }
public void Create(ShipmentData shipment) { this.repo.Add(shipment); this.repo.SaveChanges(); }