/// <summary> /// Create a sale date. There are many rules for sale dates. One to be aware of is that if /// the sale type is an online auction, the sale should only have one sale date with a start /// and end date that spans multiple days. If it is any other type of sale, each sale date /// should be for the same day but different times. /// </summary> public SaleDate CreateSaleDate(SaleDate saleDate) { RestRequest request = this.CreateRestRequest("/api/sale-dates/", Method.POST, saleDate); IRestResponse <SaleDate> response = this.restClient.Post <SaleDate>(request); response.VaildateResponse(); return(response.Data); }
public bool Equals(TempSaleDTO other) { return(other != null ? CustomerName.Equals(other.CustomerName) && ManagerName.Equals(other.ManagerName) && ProductName.Equals(other.ProductName) && SaleDate.Equals(other.SaleDate) && SessionId.Equals(other.SessionId) && Total.Equals(other.Total) && Id.Equals(other.Id) : false); }
private static SaleDate GetSaleDate(int saleId, DateTime utcStartDate, DateTime utcEndDate) { SaleDate date = new SaleDate() { SaleId = saleId, UtcStartDate = utcStartDate, UtcEndDate = utcEndDate, ShowEndTime = true }; return(date.ValidateBusinessRules()); }
public override bool Equals(object o) { var obj = o as ProfitAnalysis; if (obj == null) { return(base.Equals(o)); } return (PurchaseDate.Equals(obj.PurchaseDate) && SaleDate.Equals(obj.SaleDate) && Profit.Equals(obj.Profit)); }
public bool Equals(SaleDTO other) { if (other == null) { return(false); } bool res = Customer != null?Customer.Equals(other.Customer) : other.Customer == null; res &= Manager != null?Manager.Equals(other.Manager) : other.Manager == null; res &= Product != null?Product.Equals(other.Product) : other.Product == null; res &= SaleDate.Equals(other.SaleDate) && Total.Equals(other.Total) && Id.Equals(other.Id); return(res); }
public override int GetHashCode() { int code = 0; if (Customer != null) { code ^= Customer.GetHashCode(); } if (Manager != null) { code ^= Manager.GetHashCode(); } if (Product != null) { code ^= Product.GetHashCode(); } code ^= SaleDate.GetHashCode() ^ Total.GetHashCode() ^ Id.GetHashCode(); return(code); }
public void AddPartSaleToDatabase() { MyConnection currentConnection = new MyConnection(); SqlConnection connection = currentConnection.CurrentConnection; SqlCommand command; string query = "INSERT INTO PartSale(PartRef, CustomerRef, SaleDate, Price, Quantity, Notes) VALUES(@PartRef, @CustomerRef, @SaleDate, @Price, @Quantity, @Notes)"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@PartRef", PartRef); command.Parameters.AddWithValue("@CustomerRef", CustomerRef); command.Parameters.AddWithValue("@SaleDate", SaleDate.ToShortDateString()); command.Parameters.AddWithValue("@Price", Price.ToString()); command.Parameters.AddWithValue("@Quantity", Quantity.ToString()); command.Parameters.AddWithValue("@Notes", Notes); connection.Open(); command.ExecuteNonQuery(); connection.Close(); Part.Quantity -= Quantity; Part.UpdatePart(); }
public void UpdatePartSale(PartSale oldPartSale) { MyConnection currentConnection = new MyConnection(); SqlConnection connection = currentConnection.CurrentConnection; SqlCommand command; string query = "UPDATE PartSale SET SaleDate = @SaleDate, Price = @Price, Quantity = @Quantity, Notes = @Notes WHERE PartSaleID = @PartSaleID"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@PartRef", PartRef); command.Parameters.AddWithValue("@CustomerRef", CustomerRef); command.Parameters.AddWithValue("@SaleDate", SaleDate.ToShortDateString()); command.Parameters.AddWithValue("@Price", Price.ToString()); command.Parameters.AddWithValue("@Quantity", Quantity.ToString()); command.Parameters.AddWithValue("@Notes", Notes); command.Parameters.AddWithValue("@PartSaleID", PartSaleID); connection.Open(); command.ExecuteNonQuery(); connection.Close(); Part.Quantity = Part.Quantity - (Quantity - oldPartSale.Quantity); }
private void SetProduct() { Product = new Product() { Id = Id, Brand = BrandSelected.ToString(), Name = Name, ProductCode = ProductCode, Color = Color, Size = Size, Box = Box, Source = SourceSelected.ToString(), DateOfPurchase = DateOfPurchase.ToShortDateString(), PurchasePrice = PurchasePrice, SaleDate = SaleDate.ToString(), SellingPrice = SellingPrice, ShippingPrice = ShippingPrice, PriceWithoutShipping = PriceWithoutShipping, Profit = Profit, IsSold = IsSold }; }
public void AssignFormattedDate() { FormattedSaleDate = SaleDate.ToShortDateString(); }
public override string ToString() => $"buy at {BuyAt} on {BuyDate.ToString("MM/dd/yyyy")}, sale at {SaleAt}, {SaleDate.ToString("MM/dd/yyyy")}";
public override string ToString() => $"{Quantity} @ {SalePrice.ToCurrency(2)} on {SaleDate.ToShortDateString()}";
public override string ToString() { return(SaleDate.ToString() + ' ' + SellerTransaction.ToString() + ' ' + GoodsTransaction.ToString() + ' ' + Amount); }