/// <summary> /// Convert Zerobased.CountValue to System.Int32 value. /// </summary> /// <param name="topValue">Value to convert.</param> /// <returns> /// Returns <value>Defaul</value> if value less then <value>1</value>. /// Returns <value>NULL</value> if <paramref name="topValue"/> is <value>NoLimit</value>. /// </returns> public static int?ToInt32(this CountValue topValue) { int?value = null; if (topValue != CountValue.NoLimit) { value = (int)(topValue < CountValue.First ? CountValue.Default : topValue); } return(value); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(Unit != null ? Unit.ToStepValue() : "$"); parameters.Add(CountValue != null ? CountValue.ToStepValue() : "$"); parameters.Add(Formula != null ? Formula.ToStepValue() : "$"); return(string.Join(", ", parameters.ToArray())); }
private static void EnsureKeysExists(SyncObject so) { var no = so.NetObj; if (!bitsPerSyncObj.ContainsKey(no)) { bitsPerSyncObj.Add(no, new Dictionary <SyncObject, CountValue>()); bitsPerSyncObj[no][so] = new CountValue(0); byteTotalsPerSyncObj.Add(no, new Dictionary <SyncObject, CountValue>()); byteTotalsPerSyncObj[no][so] = new CountValue(0); byteTotalsPerNetObj.Add(no, new CountValue(0)); } var soDict = bitsPerSyncObj[no]; if (!soDict.ContainsKey(so)) { soDict.Add(so, new CountValue(0)); byteTotalsPerSyncObj[no].Add(so, new CountValue(0)); } }
private string GetName() { switch (Category) { case ItemCategory.Weapon: case ItemCategory.Armor: if (CountValue == 0) { return(Master.Name); } if (CountValue < 0) { return(Master.Name + CountValue.ToString()); } return(Master.Name + "+" + CountValue.ToString()); case ItemCategory.Arrow: case ItemCategory.Rod: return(string.Format("{0}[{1}]", Master.Name, CountValue)); } return(Master.Name); }
protected override string BuildStringSTEP(ReleaseVersion release) { return(base.BuildStringSTEP(release) + "," + (release < ReleaseVersion.IFC4X3 ? ParserSTEP.DoubleToString(CountValueDouble) : CountValue.ToString()) + (release < ReleaseVersion.IFC4 ? "" : (string.IsNullOrEmpty(mFormula) ? ",$" : ",'" + ParserIfc.Encode(mFormula) + "'"))); }
private void OKButton_Click(object sender, EventArgs e) { try { Price = PriceValue; Count = Count - CountValue; Summ = Summ - SummValue; CratesCount = CratesCount - CratesCountBalue; Mass = Mass - MassValue; if (!File.Exists(Application.StartupPath + "//Raw.Residue.Data.xml")) { General.ShowErrorBox("Список продуктов сырья отсутствует!\nВозможно была потеря данных, обратитесь к администрации программы!"); } else { XmlDocument xDoc = new XmlDocument(); xDoc.Load(Application.StartupPath + "//Raw.Residue.Data.xml"); XmlElement xRoot = xDoc.DocumentElement; XmlNode childnode = xRoot.SelectSingleNode(String.Format("RawResidue[Имя='{0}']", titlebox.Text)); if (childnode != null) { XmlNode nameChildNode = childnode.SelectSingleNode("Имя"); string elemNameStr = "NONE"; if (nameChildNode != null) { elemNameStr = nameChildNode.InnerText; XmlNode massElem = childnode.SelectSingleNode("Масса"); XmlNode countElem = childnode.SelectSingleNode("Количество"); XmlNode cratesElem = childnode.SelectSingleNode("КоличествоКаробок"); XmlNode pricesElem = childnode.SelectSingleNode("Цена"); XmlNode summElem = childnode.SelectSingleNode("Сумма"); if (massElem != null && countElem != null && cratesElem != null && pricesElem != null && summElem != null) { massElem.InnerText = Mass.ToString(); countElem.InnerText = Count.ToString(); cratesElem.InnerText = CratesCount.ToString(); pricesElem.InnerText = Price.ToString(); summElem.InnerText = Summ.ToString(); } } } xDoc.Save(Application.StartupPath + "//Raw.Residue.Data.xml"); } /* * General.UpdateCellData("RawMaterialsResidue", "Цена", Price.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "Количество", Count.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "КоличествоКаробок", CratesCount.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "Масса", Mass.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "Сумма", Summ.ToString().Replace(",", "."), Convert.ToInt32(ID)); */ Date = DateControl.Value.ToString(); if (ProviderTextBox.Text != null) { Provider = ProviderTextBox.Text; } if (RecipientTextBox.Text != null) { Recipient = RecipientTextBox.Text; } RemovedRawMaterialsForm RRMF = new RemovedRawMaterialsForm(); RRMF.InsertRecords(titlebox.Text, MassValue.ToString().Replace(",", "."), PriceValue.ToString().Replace(",", "."), CountValue.ToString().Replace(",", "."), CratesCountBalue.ToString().Replace(",", "."), SummValue.ToString().Replace(",", "."), Date, Provider, Recipient); RRMF.ShowDialog(this); this.Close(); } catch (Exception) { } }
internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet <int> processed) { base.SetXML(xml, host, processed); xml.SetAttribute("CountValue", CountValue.ToString()); setAttribute(xml, "Formula", Formula); }