public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (Class == null ? 0 : Class.GetHashCode()); hash = hash * 23 + (Color == null ? 0 : Color.GetHashCode()); hash = hash * 23 + (DaysToManufacture == default(int) ? 0 : DaysToManufacture.GetHashCode()); hash = hash * 23 + (DiscontinuedDate == null ? 0 : DiscontinuedDate.GetHashCode()); hash = hash * 23 + (FinishedGoodsFlag == default(bool) ? 0 : FinishedGoodsFlag.GetHashCode()); hash = hash * 23 + (ListPrice == default(decimal) ? 0 : ListPrice.GetHashCode()); hash = hash * 23 + (MakeFlag == default(bool) ? 0 : MakeFlag.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (Name == null ? 0 : Name.GetHashCode()); hash = hash * 23 + (ProductLine == null ? 0 : ProductLine.GetHashCode()); hash = hash * 23 + (ProductModelId == null ? 0 : ProductModelId.GetHashCode()); hash = hash * 23 + (ProductNumber == null ? 0 : ProductNumber.GetHashCode()); hash = hash * 23 + (ProductSubcategoryId == null ? 0 : ProductSubcategoryId.GetHashCode()); hash = hash * 23 + (ReorderPoint == default(short) ? 0 : ReorderPoint.GetHashCode()); hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode()); hash = hash * 23 + (SafetyStockLevel == default(short) ? 0 : SafetyStockLevel.GetHashCode()); hash = hash * 23 + (SellEndDate == null ? 0 : SellEndDate.GetHashCode()); hash = hash * 23 + (SellStartDate == default(DateTime) ? 0 : SellStartDate.GetHashCode()); hash = hash * 23 + (Size == null ? 0 : Size.GetHashCode()); hash = hash * 23 + (SizeUnitMeasureCode == null ? 0 : SizeUnitMeasureCode.GetHashCode()); hash = hash * 23 + (StandardCost == default(decimal) ? 0 : StandardCost.GetHashCode()); hash = hash * 23 + (Style == null ? 0 : Style.GetHashCode()); hash = hash * 23 + (Weight == null ? 0 : Weight.GetHashCode()); hash = hash * 23 + (WeightUnitMeasureCode == null ? 0 : WeightUnitMeasureCode.GetHashCode()); return(hash); } }
public ProductionQuery AddProduct(ProductNumber product) { ProductionQuery result = (ProductionQuery)this.MemberwiseClone(); result.product = product; return result; }
public virtual bool HasProductNumber() { if (ProductNumber == null) { return(false); } return(!ProductNumber.StartsWith("NOPRODUCTNR")); }
private void starIinputPictureBox_Click(object sender, EventArgs e) { bool checkCompany = false, checkEmployee = false, checkProductNo = false; checkCompany = ToCheck.checkstring(companyTextBox.Text); checkEmployee = ToCheck.checkint(totalEmployeeTextBox.Text, -1, 999999, 1); checkProductNo = ToCheck.checkint(productCatogoriesTextBox.Text, 0, 11, 1); if (checkCompany) { Company = companyTextBox.Text; } else { MessageBox.Show("公司名稱錯誤,請重新輸入"); } if (checkEmployee) { EmployeeNumber = int.Parse(totalEmployeeTextBox.Text); } else { MessageBox.Show("員工人數輸入錯誤,請重新輸入"); totalEmployeeTextBox.Text = string.Empty; } if (checkProductNo) { ProductNumber = int.Parse(productCatogoriesTextBox.Text); } else { MessageBox.Show("手機產品種類輸入錯誤,請重新輸入"); productCatogoriesTextBox.Text = string.Empty; } if (checkCompany && checkEmployee && checkProductNo) { MessageBox.Show("成功,開始輸入資料"); dataInputGroupBox.Visible = true; basicDataGroupBox.Enabled = false; startInputGroupBox.Enabled = false; EmployeeIDs = new string[EmployeeNumber]; LastNames = new string[EmployeeNumber]; FirstNames = new string[EmployeeNumber]; ProductArray = new int[EmployeeNumber]; PriceArray = new int[EmployeeNumber]; SaleArray = new int[EmployeeNumber]; SaleRecord = new SaleRecord(Company, EmployeeNumber.ToString(), ProductNumber.ToString()); ShowTextboxesAndLabels(); OutputResultListBox.Items.Add("ID\t\t名\t姓\t銷售業績"); } }
public List <string> Validate() { var errors = new List <string>(); if (!ProductNumber.HasOnlyNumbers()) { errors.Add("The product Number is invalid, must contain only numbers"); } return(errors); }
static void Main(string[] args) { using (var qsim = new QuantumSimulator()) { HelloFunTest.Run(qsim).Wait(); var tempInt = AddInt.Run(qsim, 3, 3).Result; Console.WriteLine("AddInt" + tempInt); var tempDouble = ProductNumber.Run(qsim, 3, 3).Result; Console.WriteLine("ProductDouble" + tempDouble); Console.ReadLine(); } }
private ProductValidity GetProductValidity(ProductNumber product) { DateTimeOffset startDate = product == ProductNumber.One ? PeriodStartDate1 : PeriodStartDate2; DateTimeOffset endDate = product == ProductNumber.One ? PeriodStartDate2 : PeriodEndDate2; DateTimeOffset now = DateTimeOffset.UtcNow; // If we don't have a validity date for this product, its data on the card is zeroes, and its date is 0, aka the En1545 zero date. if (startDate > ConversionUtil.En1545ZeroDate) { // If start date is valid, but we have no end date if (startDate < now && endDate == ConversionUtil.En1545ZeroDate) { return(ProductValidity.ValidIndefinitelyNow); } // Standard valid else if (startDate < now && endDate > now) { return(ProductValidity.ValidNow); } // Start date in the future else if (startDate > now && endDate > now) { return(ProductValidity.ValidNotStarted); } // Start date in the future, but no end date else if (startDate > now && endDate == ConversionUtil.En1545ZeroDate) { return(ProductValidity.ValidIndefinitelyNotStarted); } else if (endDate < now) { return(ProductValidity.Expired); } // Unknown state, ahhhh else { return(ProductValidity.Unknown); } } // StartDate is zero, so probably no product in this slot else { return(ProductValidity.Unknown); } }
public void CreateProductNumberWithValidation() { ProductNumber.Validation = new ProductNumber.ValidationRule(delegate(string number) { return number.Equals("45343"); }); ProductNumber productNumber = new ProductNumber("45343"); Assert.AreEqual<string>("45343", productNumber.Number); bool exceptionCaught = false; try { productNumber = new ProductNumber("45343A"); } catch (ArgumentException e) { Assert.AreEqual<string>("The product number 45343A is not a valid product number.", e.Message); exceptionCaught = true; } Assert.IsTrue(exceptionCaught); }
public void SetUp() { factory = new RepositoryFactory();; product1 = new ProductNumber("Product A"); product2 = new ProductNumber("Product B"); order1 = new OrderNumber("Order A"); order2 = new OrderNumber("Order B"); team1 = new ProductionTeam("Daghold"); team2 = new ProductionTeam("Nathold"); using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>()) { repository.Save(team1); repository.Save(team2); } }
public void CreateProductNumberWithoutValidation() { ProductNumber productNumber = new ProductNumber("My product number"); Assert.AreEqual<string>("My product number", productNumber.Number); }
// override object.GetHashCode public override int GetHashCode() { return(ProductNumber.GetHashCode() ^ SupplierNumber.GetHashCode()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ProductId != null) { hashCode = hashCode * 59 + ProductId.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (ProductNumber != null) { hashCode = hashCode * 59 + ProductNumber.GetHashCode(); } if (Color != null) { hashCode = hashCode * 59 + Color.GetHashCode(); } if (StandardCost != null) { hashCode = hashCode * 59 + StandardCost.GetHashCode(); } if (ListPrice != null) { hashCode = hashCode * 59 + ListPrice.GetHashCode(); } if (Size != null) { hashCode = hashCode * 59 + Size.GetHashCode(); } if (Weight != null) { hashCode = hashCode * 59 + Weight.GetHashCode(); } if (ProductLine != null) { hashCode = hashCode * 59 + ProductLine.GetHashCode(); } if (Class != null) { hashCode = hashCode * 59 + Class.GetHashCode(); } if (Style != null) { hashCode = hashCode * 59 + Style.GetHashCode(); } if (SubCategory != null) { hashCode = hashCode * 59 + SubCategory.GetHashCode(); } if (Model != null) { hashCode = hashCode * 59 + Model.GetHashCode(); } if (Photo != null) { hashCode = hashCode * 59 + Photo.GetHashCode(); } if (Review != null) { hashCode = hashCode * 59 + Review.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Product instances are equal /// </summary> /// <param name="other">Instance of Product to be compared</param> /// <returns>Boolean</returns> public bool Equals(Product other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ProductId == other.ProductId || ProductId != null && ProductId.Equals(other.ProductId) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( ProductNumber == other.ProductNumber || ProductNumber != null && ProductNumber.Equals(other.ProductNumber) ) && ( Color == other.Color || Color != null && Color.Equals(other.Color) ) && ( StandardCost == other.StandardCost || StandardCost != null && StandardCost.Equals(other.StandardCost) ) && ( ListPrice == other.ListPrice || ListPrice != null && ListPrice.Equals(other.ListPrice) ) && ( Size == other.Size || Size != null && Size.Equals(other.Size) ) && ( Weight == other.Weight || Weight != null && Weight.Equals(other.Weight) ) && ( ProductLine == other.ProductLine || ProductLine != null && ProductLine.Equals(other.ProductLine) ) && ( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( Style == other.Style || Style != null && Style.Equals(other.Style) ) && ( SubCategory == other.SubCategory || SubCategory != null && SubCategory.Equals(other.SubCategory) ) && ( Model == other.Model || Model != null && Model.Equals(other.Model) ) && ( Photo == other.Photo || Photo != null && Photo.Equals(other.Photo) ) && ( Review == other.Review || Review != null && Review.SequenceEqual(other.Review) )); }
private static bool IsProductValid(ProductNumber product) { return product.Number.Length > 0; }
public string ProductId() { return(BatchId.ToString() + "-" + ProductNumber.ToString()); }
private void DisplayProduct(ProductNumber product) { lblProductValue.Text = product.Number; }
public void SetUp() { factory = new RepositoryFactory();; product1 = new ProductNumber("Product A"); product2 = new ProductNumber("Product B"); order1 = new OrderNumber("Order A"); order2 = new OrderNumber("Order B"); production1 = new Production("Machine A", product1, order1, 1000, 100); production2 = new Production("Machine A", product2, order2, 500, 50); using (IEntityRepository<Production> repository = factory.CreateEntityRepository<Production>()) { repository.Save(production1); repository.Save(production2); } team1 = new ProductionTeam("Daghold"); team2 = new ProductionTeam("Nathold"); using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>()) { repository.Save(team1); repository.Save(team2); } productionStop1 = new ProductionStop("Stop A"); productionStop2 = new ProductionStop("Stop B"); using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>()) { repository.Save(productionStop1); repository.Save(productionStop2); } }