public void ConstructorFromItemPrice() { var a = new Accounting() { PriceCode = "abc" }; var p = new UnitPrice(1.21m, 21, CurrencyUnit.EUR, TimeSpanUnit.Hour, PriceBase.Incl); var i = new ItemPrice(p, 2) { Accounting = a, Description = "xyz", Stamp = DateTime.Now }; var p1 = new Price(i); Assert.AreEqual(p1.Value, i.Value); Assert.AreEqual(p1.Accounting, i.Accounting); Assert.AreEqual(p1.Description, i.Description); Assert.AreEqual(p1.Stamp, i.Stamp); }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (CarrierTrackingNumber == null ? 0 : CarrierTrackingNumber.GetHashCode()); hash = hash * 23 + (LineTotal == default(decimal) ? 0 : LineTotal.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (OrderQty == default(short) ? 0 : OrderQty.GetHashCode()); hash = hash * 23 + (ProductId == default(int) ? 0 : ProductId.GetHashCode()); hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode()); hash = hash * 23 + (SalesOrderId == default(int) ? 0 : SalesOrderId.GetHashCode()); hash = hash * 23 + (SpecialOfferId == default(int) ? 0 : SpecialOfferId.GetHashCode()); hash = hash * 23 + (UnitPrice == default(decimal) ? 0 : UnitPrice.GetHashCode()); hash = hash * 23 + (UnitPriceDiscount == default(decimal) ? 0 : UnitPriceDiscount.GetHashCode()); return(hash); } }
public override int GetHashCode() { int hash = 1; if (SKU.Length != 0) { hash ^= SKU.GetHashCode(); } if (UnitPrice != 0) { hash ^= UnitPrice.GetHashCode(); } if (Quantity != 0) { hash ^= Quantity.GetHashCode(); } return(hash); }
public void ToPrice() { var a = new Accounting() { Description = "xyz" }; var unitPrice = new UnitPrice(1, 20, CurrencyUnit.EUR, TimeSpanUnit.Day); var measureItem = new TimeSpanItem(2, TimeSpanUnit.Day); var ip = new ItemPrice(unitPrice, measureItem) { Description = "abc", Accounting = a }; var p = new Price(2, 20, CurrencyUnit.EUR) { Description = "abc", Accounting = a }; Assert.AreEqual(p, ip.AsPrice()); }
private void PrecioOrCantidad_TextChanged(object sender, EventArgs e) { var txtMod = (TextBox)sender; if (!_price_calculing) { _price_calculing = true; if (!string.IsNullOrEmpty(Tcantidad.Text) && !string.IsNullOrEmpty(Tprecio_compra.Text) && txtMod.Name != "TxtPrecioTotal") { decimal Qty, Pr, Res; decimal.TryParse(Tcantidad.Text.Replace(sMil, ""), out Qty); //Q = Val(Strings.Replace(Tcantidad.Text, sepList, "")); decimal.TryParse(Tprecio_compra.Text.Replace(sMil, ""), out Pr); //P = Val(Strings.Replace(Tprecio_compra.Text, sepList, "")); Res = _residuo; //R = Val(residuo.Text); TxtPrecioTotal.Text = (Qty * Pr + Res).ToString("#,##0"); } else if (!string.IsNullOrEmpty(Tcantidad.Text) && !string.IsNullOrEmpty(TxtPrecioTotal.Text) && txtMod.Name == "TxtPrecioTotal") { decimal Qty, Pr, TotalCalc; decimal UnitPrice; //Q = Val(Strings.Replace(Tcantidad.Text, sepList, "")) decimal.TryParse(Tcantidad.Text.Replace(sMil, ""), out Qty); //P = Val(Strings.Replace(TxtPrecioTotal.Text, sepList, "")) decimal.TryParse(TxtPrecioTotal.Text.Replace(sMil, ""), out Pr); //R = Val(residuo.Text) //Res = _residuo; UnitPrice = Pr / Qty; TotalCalc = UnitPrice * Qty; Tprecio_compra.Text = UnitPrice.ToString(FormatPrecioUnit); if (TotalCalc != Pr) { _residuo = (int)Math.Abs(TotalCalc - Pr); } } else { TxtPrecioTotal.Text = string.Empty; } _price_calculing = false; } }
public ActionResult Edit([Bind(Include = "UnitPriceId,UnitPriceValue,UnitPriceDescription")] UnitPrice unitPrice /*,int? id*/) { //if (id == null) //{ // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //} //UnitPrice unitPrice = db.UnitPrices.Find(id); if (unitPrice == null) { return(HttpNotFound()); } if (ModelState.IsValid) { db.Entry(unitPrice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(unitPrice)); }
public void AddingOperation(string Description, string Quantity) { EnterDescription.SendKeys(Keys.Control + "A"); EnterDescription.SendKeys(Keys.Delete); EnterDescription.SendKeys(Description); EnterQuantity.Clear(); EnterQuantity.SendKeys(Quantity); EnterDescription.SendKeys(Keys.Tab); string unitPrice = UnitPrice.GetText(); Console.WriteLine(unitPrice); CustomWait.WaitFortheLoadingIconDisappear2000(); string salesPriceAmount = SalesPriceAmount.GetText(); Console.WriteLine(salesPriceAmount); AddRowInOperation.Click(); CustomWait.WaitFortheLoadingIconDisappear2000(); DeleteRowInOperation.Click(); }
/// <summary> /// Returns values in the collections. /// </summary> /// <returns>IEnumerator object</returns> public IEnumerator PropertyAndValuesCollection() { yield return("Product ID: " + ID.ToString()); yield return("Product Name: " + ProductName); yield return("Supplier ID: " + SupplierID.ToString()); yield return("Category ID: " + CategoryID.ToString()); yield return("Quantity Per Unit: " + QuantityPerUnit); yield return("Unit Price: " + UnitPrice.ToString("c")); yield return("Units in Stock: " + UnitsInStock.ToString()); yield return("Units On Order: " + UnitsOnOrder.ToString()); yield return("ReOrder Level: " + ReOrderLevel.ToString()); }
public void Configure(EntityTypeBuilder <OrderLine> builder) { builder .HasKey(k => k.Id); builder.Property(p => p.Quantity) .HasConversion(p => p.Value, p => Quantity.Create(p).Value) .IsRequired() .HasColumnType("int"); builder.Property(p => p.UnitPrice) .HasConversion(p => p.Value, p => UnitPrice.Create(p).Value) .IsRequired() .HasColumnType("decimal(7,2)"); builder .HasOne <Product>(p => p.Product); }
public void ToPriceWithCurrencyItem() { var a = new Accounting() { Description = "xyz" }; var unitPrice = new UnitPrice(1, 20, CurrencyUnit.EUR, TimeSpanUnit.Day); var measureItem = new TimeSpanItem(2, TimeSpanUnit.Day); var currencyItem = new CurrencyItem(CurrencyUnit.GBP, CurrencyUnit.EUR, 0.9m) { Stamp = DateTime.Now }; var ip = new ItemPrice(unitPrice, measureItem, currencyItem) { Description = "abc", Accounting = a }; var p = new Price(1.8m, 20, CurrencyUnit.GBP) { Description = "abc", Accounting = a }; Assert.AreEqual(p, ip.AsPrice()); }
public void GetTotalOrderBySenarioC() { //Senario C List <UnitPrice> unitPrices = new List <UnitPrice>(); UnitPrice unitPriceA = new UnitPrice(); unitPriceA.STUId = "A"; unitPriceA.Value = 50; unitPriceA.UnitQty = 5; unitPrices.Add(unitPriceA); UnitPrice unitPriceB = new UnitPrice(); unitPriceB.STUId = "B"; unitPriceB.Value = 30; unitPriceB.UnitQty = 5; unitPrices.Add(unitPriceB); UnitPrice unitPriceC = new UnitPrice(); unitPriceC.STUId = "C"; unitPriceC.Value = 20; unitPriceC.UnitQty = 1; unitPrices.Add(unitPriceC); IPromotionRepository promotionRepository = new PromotionRepository(); var controller = new PromotionController(promotionRepository); var result = controller.CalCulateOrderAmount(unitPrices) as ViewResult; var data = result.Model as OrderSummary; Assert.AreEqual(370, data.Total, "Total Order Value not correct"); }
public UnitPrice GetUnitPrice(string userId, string foodId) { string dataBase = ConfigurationManager.AppSettings["UserDataBase"]; DataBase db = new DataBase(); try { SQLiteConnection connection = new SQLiteConnection("Data Source=" + db.GetDataBasePath(userId, dataBase)); connection.Open(); string sql = @"SELECT unitPrice, currency, unit FROM prices WHERE foodId = @foodId"; SQLiteCommand command = new SQLiteCommand(sql, connection); command.Parameters.Add(new SQLiteParameter("foodId", foodId)); UnitPrice x = new UnitPrice(); SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) { x.value = reader.GetValue(0) == DBNull.Value ? 0.0 : Convert.ToDouble(reader.GetString(0)); x.currency = reader.GetValue(1) == DBNull.Value ? "" : reader.GetString(1); x.unit = reader.GetValue(2) == DBNull.Value ? "" : reader.GetString(2); } connection.Close(); return(x); } catch (Exception e) { return(new UnitPrice()); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////// public JsonResult GetGridData() { Guid skuGid = selectedProductSKUGuid; Guid onSkuId = selectedSKUOnsaleGuid; UnitPrice PriceData = new UnitPrice(); PriceData.currentSession = CurrentSession; PriceData.memberOrgCulture = dbEntity.MemberOrgCultures.Include("Currency").Where(p => p.OrgID == organizationGuid && p.Ctype == 1 && p.aCurrency != Guid.Empty).OrderBy(p => p.Sorting).ToList(); PriceData.ProductOnUnitPrice = dbEntity.ProductOnUnitPrices.Where(p => p.Deleted == false && p.OnSkuID == onSkuId).ToList(); PriceData.StdUnit = dbEntity.ProductInfoItems.Include("StandardUnit").Where(p => p.Deleted == false && p.Gid == skuGid).FirstOrDefault().StandardUnit; //return PriceData.ToString(); return Json(PriceData.ToString(), JsonRequestBehavior.AllowGet); }
public void ConstructorNullMeasureItem() { var PricePerHour = new UnitPrice(2, 20, CurrencyUnit.EUR, TimeSpanUnit.Hour); new ItemPrice(PricePerHour, null); }
}//end Method MultiplyShirts // //toString // public override string ToString() { //base ToString string toString = "ItemID:\t" + ItemID().ToString() + "Unit Price:\t\t\n" + UnitPrice.ToString() + "Item Type\t\t\n" + ItemType + "Size:\t\t\n" + SizeItem + "Name OF Item:\t\t\n" + NameOfItem + "Vendor Name:\t\t\n" + VendorName + "\nDescripion/Notes:" + ItemDescription; return(toString); /* decimal unitPrice; * string size; * string itemType; * string nameOfItem; * string vendorName; * string description; */ }
//display item's property values public string Display() { string display = string.Format("{0} ({1} at {2} each)", Name, Quantity.ToString(), UnitPrice.ToString("c")); return display; }//close Display()
// //toString // public override string ToString() { string toString = "\nItem Type:\t\t" + ItemType() + "\nMaterial:\t\t" + Material + "\nName of Item:\t\t" + NameOfItem + "\nVendor Name:\t\t" + VendorName + "\nSize:\t\t" + SizeItem + "\nScreen Number:\t\t" + Screens + "\nUnit Price:\t\t" + UnitPrice.ToString() + "\nSleeve Style/Length:\t\t" + SleeveLength + "\nTag:\t\t" + Tag + "\nCollar:\t\t" + Collar + "\nItem Description/Notes:\t\t" + ItemDescription; return(toString); }
public override string ToString() { var a = new[] { ItemName, Quantity.ToString(), UnitPrice.ToString(), TotalPrice.ToString() }; return(string.Join(":", a)); }
public void Add(UnitPrice unitPrice) { Add(new UnitPriceViewModel(unitPrice)); }
public override int GetHashCode() { return(Type.GetHashCode() ^ Description.GetHashCode() ^ UnitPrice.GetHashCode()); }
protected bool Equals(PurchaseOrderLine other) { return(PurchaseOrderId == other.PurchaseOrderId && RawMaterialId == other.RawMaterialId && SupplierId == other.SupplierId && UnitPrice.Equals(other.UnitPrice) && Quantity.Equals(other.Quantity) && string.Equals(UnitOfMeasure, other.UnitOfMeasure)); }
public void GetMeasureUnitDifferentMeasure() { UnitPrice.GetMeasureUnit(pDay, pHour); }
public void GetMeasureUnitOK() { Assert.AreEqual(UnitPrice.GetMeasureUnit(p11, p22), TimeSpanUnit.Hour); }
public void CompatibleMeasureUnitsOK() { Assert.IsTrue(UnitPrice.CompatibleMeasureUnits(p22, p33)); }
public override string ToString() { return(Name + " - " + UnitPrice.ToString() + "$"); }
private string editTextLine() { // 2018.01 asakawa 数値がマイナスの場合の出力形式の修正のために一部変更 string textLine = ""; // 伝区 textLine += "0"; // 年号 textLine += "1"; // 売上年月日 string date = ReportDate.ToShortDateString(); textLine += util.TruncateByteRight(DHandling.RemoveNoNum(date), 6); // yyyymmdd →yymmdd // 請求年月日 textLine += util.TruncateByteRight(DHandling.RemoveNoNum(date), 6); // yyyymmdd →yymmdd // 伝票番号 6桁、0Padding textLine += util.PaddingInBytes(Convert.ToString(SlipNo), "Number", 6); // 得意先コード(業務No) textLine += TaskCode; // 得意先名 char[] strChar = TaskName.ToCharArray(); for (int i = 0; i < strChar.Length; i++) { if (strChar[i] == ' ') { strChar[i] = ' '; } } TaskName = new string( strChar ); //string taskData = util.FormFixedByteLengthLeft("(" + CostType + ")" + TaskName, 68); string taskData = util.FormFixedByteLengthLeft(TaskName, 68); textLine += util.TruncateByteLeft(taskData, 40); // 先方担当者名 textLine += util.TruncateByteRight(taskData, 28); // 部門コード int dIdx = Array.IndexOf(sdKeyArray, (OfficeCode + util.SubstringByte(TaskCode, 0, 1))); if (dIdx < 0) { dIdx = Array.IndexOf(sdKeyArray, (OfficeCode + " ")); } textLine += sDeptArray[dIdx]; // 担当者コード //string pCode = Conv.ResizeMemberCode(MemberCode.TrimEnd(),2); textLine += Conv.ResizeMemberCode(LeaderMCode.TrimEnd(), 2); // 摘要コード textLine += "00"; // 摘要名 textLine += util.PaddingInBytes(" ", "Char", 30); // 商品コード textLine += util.SubstringByte(ItemCode, 0, 4); // マスター区分 textLine += "0"; // 品名 if (ItemCode.TrimEnd() == "K999") { char checkChar = ' '; if (Item != "") { checkChar = Item[0]; } string kItem = (checkChar == '●') ? Item : kMark + Item; textLine += util.FormFixedByteLengthLeft(kItem, 36); } else { textLine += util.FormFixedByteLengthLeft(Item, 36); } //textLine += util.PaddingInBytes(Item, "Char", 36); //textLine += util.FormFixedByteLengthLeft(Item, 36); // 区 textLine += "0"; // 入数 textLine += "0000"; // 箱数 textLine += "00000"; // 数量 if (Quantity == 0) { Quantity = 1; // 0では商魂汎用データ作成時にエラーになる } // 2018.01 asakawa マイナス値の場合の出力形式の修正のために変更 // textLine += util.PaddingInBytes( Convert.ToString( Quantity ), "Number", 9 ); if (Quantity < 0) { textLine += "-"; decimal qq = Quantity * (-1); textLine += util.PaddingInBytes(Convert.ToString(qq), "Number", 8); } else { textLine += util.PaddingInBytes(Convert.ToString(Quantity), "Number", 9); } // 単位 textLine += util.PaddingInBytes(Unit, "Char", 4); // 単価 // 2018.01 asakawa マイナス値の場合の出力形式の修正のために変更 // textLine += util.PaddingInBytes( UnitPrice.ToString( "0" ), "Number", 10 ); if (UnitPrice < 0) { textLine += "-"; decimal pp = UnitPrice * (-1); // textLine += util.PaddingInBytes(Convert.ToString(pp), "Number", 9); // 小数点以下も出力される textLine += util.PaddingInBytes(pp.ToString("0"), "Number", 9); } else { textLine += util.PaddingInBytes(UnitPrice.ToString("0"), "Number", 10); } // 売上金額 int sales = Convert.ToInt32(Quantity * UnitPrice); // 2018.01 asakawa マイナス値の場合の出力形式の修正のために変更 // textLine += util.PaddingInBytes( Convert.ToString( sales ), "Number", 10 ); if (sales < 0) { textLine += "-"; textLine += util.PaddingInBytes(Convert.ToString(sales * (-1)), "Number", 9); } else { textLine += util.PaddingInBytes(Convert.ToString(sales), "Number", 10); } // 原単価 textLine += util.PaddingInBytes("0", "Number", 9); // 原価額 textLine += util.PaddingInBytes("0", "Number", 10); // 税区分 textLine += "0"; // 税込区分 textLine += "0"; // 備考区分 textLine += "1"; //備考区分が0:備考は数字、1:文字1 // 備考 textLine += util.PaddingInBytes(" ", "Char", 9); // 同時入荷区分 textLine += "0"; return(textLine); }
public Ride(UnitPrice unitPrice, DistanceUnit distanceUnit, decimal distance) { UnitPrice = unitPrice; DistanceUnit = distanceUnit; Distance = distance; }
public override string ToString() { return($"ID: {ProductID} {Category}-{ProductName} {UnitPrice.ToString("C")} {UnitsInStock} in stock."); }