public virtual void SetSubPrice3sProperties(XElement calculator) { //remember that the calculator inheriting from this class must set id and name //this.SetCalculatorProperties(calculator); if (this.SubPrice3s == null) { this.SubPrice3s = new List <SubPrice3>(); } int i = 1; //standard attname used throughout DevTreks string sAttNameExtension = string.Empty; //don't make unnecessary collection members string sHasAttribute = string.Empty; for (i = 1; i < this.MaximumNumberOfSubPrice3s; i++) { sAttNameExtension = i.ToString(); sHasAttribute = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPName, sAttNameExtension)); if (!string.IsNullOrEmpty(sHasAttribute)) { SubPrice3 subP1 = new SubPrice3(); SetSubPrice3Properties(subP1, sAttNameExtension, calculator); this.SubPrice3s.Add(subP1); } sHasAttribute = string.Empty; } }
private void AddSubPrice3ToPTStock(SubPrice3 ind, SubPrice3Stock ptStock) { if (ind.SubPAltType == SubPrice3.ALTERNATIVE_TYPE.one.ToString()) { ptStock.TotalInd1BM = ind.SubPTotal; } else if (ind.SubPAltType == SubPrice3.ALTERNATIVE_TYPE.two.ToString()) { ptStock.TotalInd1FullTarget = ind.SubPTotal; } else if (ind.SubPAltType == SubPrice3.ALTERNATIVE_TYPE.three.ToString()) { //if (ptStock.SubP1PTDate > ind.SubPDate // && ptStock.TotalInd1Label == ind.SubPLabel) //{ // //these must be ordered by date prior to coming in here // ptStock.TotalInd1Total += ind.SubPTotal; // //set ind to zero so it won't accumulate in next ptstock // ind.SubPTotal = 0; // //the date must be correctly entered as before the corresponding partial target date // ptStock.SubP1YTDDate = ind.SubPDate; //} } }
private void CopySubPrice3Properties( SubPrice3 subP, SubPrice3 calculator) { subP.SubPName = calculator.SubPName; subP.SubPDescription = calculator.SubPDescription; subP.SubPLabel = calculator.SubPLabel; subP.SubPType = calculator.SubPType; subP.SubPAltType = calculator.SubPAltType; subP.SubPFactor = calculator.SubPFactor; subP.SubPYears = calculator.SubPYears; subP.SubPAmount = calculator.SubPAmount; subP.SubPUnit = calculator.SubPUnit; subP.SubPPrice = calculator.SubPPrice; subP.SubPEscRate = calculator.SubPEscRate; subP.SubPEscType = calculator.SubPEscType; subP.SubPTotal = calculator.SubPTotal; subP.SubPTotalPerUnit = calculator.SubPTotalPerUnit; subP.SubPDistType = calculator.SubPDistType; subP.SubPAmountB = calculator.SubPAmountB; subP.SubPPriceB = calculator.SubPPriceB; subP.SubPEscRateB = calculator.SubPEscRateB; subP.SubPTotalB = calculator.SubPTotalB; subP.SubPAmountC = calculator.SubPAmountC; subP.SubPPriceC = calculator.SubPPriceC; subP.SubPEscRateC = calculator.SubPEscRateC; subP.SubPTotalC = calculator.SubPTotalC; }
private void InitSubPrice3Properties(SubPrice3 subP) { subP.SubPName = string.Empty; subP.SubPDescription = string.Empty; subP.SubPLabel = string.Empty; subP.SubPType = PRICE_TYPE.none.ToString(); subP.SubPAltType = ALTERNATIVE_TYPE.none.ToString(); subP.SubPFactor = 0; subP.SubPYears = 0; subP.SubPAmount = 0; subP.SubPUnit = string.Empty; subP.SubPPrice = 0; subP.SubPEscRate = 0; subP.SubPEscType = string.Empty; subP.SubPTotal = 0; subP.SubPTotalPerUnit = 0; subP.SubPFactor = 0; subP.SubPDistType = DISTRIBUTION_TYPE.none.ToString(); subP.SubPAmountB = 0; subP.SubPPriceB = 0; subP.SubPEscRateB = 0; subP.SubPTotalB = 0; subP.SubPAmountC = 0; subP.SubPPriceC = 0; subP.SubPEscRateC = 0; subP.SubPTotalC = 0; }
private void SetSubPrice3Attributes(SubPrice3 subP, string attNameExtension, ref XElement calculator) { //remember that the calculator inheriting from this class must set id and name atts //and remove unwanted old atts i.e. this.SetCalculatorAttributes(calculator); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPName, attNameExtension), subP.SubPName); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPDescription, attNameExtension), subP.SubPDescription); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPLabel, attNameExtension), subP.SubPLabel); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPType, attNameExtension), subP.SubPType); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPAltType, attNameExtension), subP.SubPAltType); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPFactor, attNameExtension), subP.SubPFactor); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPYears, attNameExtension), subP.SubPYears); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPAmount, attNameExtension), subP.SubPAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPUnit, attNameExtension), subP.SubPUnit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPPrice, attNameExtension), subP.SubPPrice); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPEscRate, attNameExtension), subP.SubPEscRate); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPEscType, attNameExtension), subP.SubPEscType); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotal, attNameExtension), subP.SubPTotal); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotalPerUnit, attNameExtension), subP.SubPTotalPerUnit); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPDistType, attNameExtension), subP.SubPDistType); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPAmountB, attNameExtension), subP.SubPAmountB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPPriceB, attNameExtension), subP.SubPPriceB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPEscRateB, attNameExtension), subP.SubPEscRateB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotalB, attNameExtension), subP.SubPTotalB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPAmountC, attNameExtension), subP.SubPAmountC); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPPriceC, attNameExtension), subP.SubPPriceC); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPEscRateC, attNameExtension), subP.SubPEscRateC); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotalC, attNameExtension), subP.SubPTotalC); }
private void SetSubPrice3Properties(SubPrice3 subP, string attNameExtension, XElement calculator) { //set this object's properties subP.SubPName = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPName, attNameExtension)); subP.SubPDescription = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPDescription, attNameExtension)); subP.SubPLabel = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPLabel, attNameExtension)); subP.SubPAltType = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPAltType, attNameExtension)); subP.SubPType = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPType, attNameExtension)); subP.SubPAmount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPAmount, attNameExtension)); subP.SubPUnit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPUnit, attNameExtension)); subP.SubPPrice = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPPrice, attNameExtension)); subP.SubPFactor = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPFactor, attNameExtension)); subP.SubPYears = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPYears, attNameExtension)); subP.SubPEscRate = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPEscRate, attNameExtension)); subP.SubPEscType = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPEscType, attNameExtension)); subP.SubPTotal = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPTotal, attNameExtension)); subP.SubPTotalPerUnit = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPTotalPerUnit, attNameExtension)); subP.SubPDistType = CalculatorHelpers.GetAttribute(calculator, string.Concat(cSubPDistType, attNameExtension)); subP.SubPAmountB = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPAmountB, attNameExtension)); subP.SubPPriceB = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPPriceB, attNameExtension)); subP.SubPEscRateB = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPEscRateB, attNameExtension)); subP.SubPTotalB = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPTotalB, attNameExtension)); subP.SubPAmountC = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPAmountC, attNameExtension)); subP.SubPPriceC = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPPriceC, attNameExtension)); subP.SubPEscRateC = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPEscRateC, attNameExtension)); subP.SubPTotalC = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cSubPTotalC, attNameExtension)); }
public virtual void SetSubPrice3Attributes(SubPrice3 subP, string attNameExtension, ref XmlWriter writer) { writer.WriteAttributeString( string.Concat(cSubPName, attNameExtension), subP.SubPName); writer.WriteAttributeString( string.Concat(cSubPDescription, attNameExtension), subP.SubPDescription); writer.WriteAttributeString( string.Concat(cSubPLabel, attNameExtension), subP.SubPLabel); writer.WriteAttributeString( string.Concat(cSubPType, attNameExtension), subP.SubPType); writer.WriteAttributeString( string.Concat(cSubPAltType, attNameExtension), subP.SubPAltType); writer.WriteAttributeString( string.Concat(cSubPFactor, attNameExtension), subP.SubPFactor.ToString()); writer.WriteAttributeString( string.Concat(cSubPYears, attNameExtension), subP.SubPYears.ToString()); writer.WriteAttributeString( string.Concat(cSubPAmount, attNameExtension), subP.SubPAmount.ToString()); writer.WriteAttributeString( string.Concat(cSubPUnit, attNameExtension), subP.SubPUnit); writer.WriteAttributeString( string.Concat(cSubPPrice, attNameExtension), subP.SubPPrice.ToString()); writer.WriteAttributeString( string.Concat(cSubPEscRate, attNameExtension), subP.SubPEscRate.ToString()); writer.WriteAttributeString( string.Concat(cSubPEscType, attNameExtension), subP.SubPEscType); writer.WriteAttributeString( string.Concat(cSubPTotal, attNameExtension), subP.SubPTotal.ToString()); writer.WriteAttributeString( string.Concat(cSubPTotalPerUnit, attNameExtension), subP.SubPTotalPerUnit.ToString()); writer.WriteAttributeString( string.Concat(cSubPDistType, attNameExtension), subP.SubPDistType); writer.WriteAttributeString( string.Concat(cSubPAmountB, attNameExtension), subP.SubPAmountB.ToString()); writer.WriteAttributeString( string.Concat(cSubPPriceB, attNameExtension), subP.SubPPriceB.ToString()); writer.WriteAttributeString( string.Concat(cSubPEscRateB, attNameExtension), subP.SubPEscRateB.ToString()); writer.WriteAttributeString( string.Concat(cSubPTotalB, attNameExtension), subP.SubPTotalB.ToString()); writer.WriteAttributeString( string.Concat(cSubPAmountC, attNameExtension), subP.SubPAmountC.ToString()); writer.WriteAttributeString( string.Concat(cSubPPriceC, attNameExtension), subP.SubPPriceC.ToString()); writer.WriteAttributeString( string.Concat(cSubPEscRateC, attNameExtension), subP.SubPEscRateC.ToString()); writer.WriteAttributeString( string.Concat(cSubPTotalC, attNameExtension), subP.SubPTotalC.ToString()); }
public virtual string GetSubPrice3sProperty(string attName, int colIndex) { string sPropertyValue = string.Empty; if (this.SubPrice3s.Count >= (colIndex + 1)) { SubPrice3 subP = this.SubPrice3s.ElementAt(colIndex); if (subP != null) { sPropertyValue = GetSubPrice3Property(subP, attName); } } return(sPropertyValue); }
public virtual void CopySubPrice3sProperties( SubPrice3 calculator) { if (calculator.SubPrice3s != null) { if (this.SubPrice3s == null) { this.SubPrice3s = new List <SubPrice3>(); } foreach (SubPrice3 calculatorInd in calculator.SubPrice3s) { SubPrice3 subP = new SubPrice3(); CopySubPrice3Properties(subP, calculatorInd); this.SubPrice3s.Add(subP); } } }
public virtual void SetSubPrice3sProperty(string attName, string attValue, int colIndex) { if (this.SubPrice3s == null) { this.SubPrice3s = new List <SubPrice3>(); } if (this.SubPrice3s.Count < (colIndex + 1)) { SubPrice3 subP1 = new SubPrice3(); this.SubPrice3s.Insert(colIndex, subP1); } SubPrice3 subP = this.SubPrice3s.ElementAt(colIndex); if (subP != null) { SetSubPrice3Property(subP, attName, attValue); } }
//add a base health input stock to the baseStat.BuildCost1s dictionary public static bool AddSubPrice3StocksToDictionary(this SubPrice3Stock baseStat, string filePosition, int nodePosition, SubPrice3 indicators) { bool bIsAdded = false; if (string.IsNullOrEmpty(filePosition) || nodePosition < 0) { baseStat.ErrorMessage = Errors.MakeStandardErrorMsg("ANALYSES_INDEX_OUTOFBOUNDS"); return(false); } if (baseStat.SubPrice3Labels == null) { baseStat.SubPrice3Labels = new Dictionary <string, List <SubPrice3> >(); } if (baseStat.SubPrice3Labels.ContainsKey(filePosition)) { if (baseStat.SubPrice3Labels[filePosition] != null) { for (int i = 0; i <= nodePosition; i++) { if (baseStat.SubPrice3Labels[filePosition].Count <= i) { baseStat.SubPrice3Labels[filePosition] .Add(new SubPrice3()); } } baseStat.SubPrice3Labels[filePosition][nodePosition] = indicators; bIsAdded = true; } } else { //add the missing dictionary entry List <SubPrice3> baseStats = new List <SubPrice3>(); KeyValuePair <string, List <SubPrice3> > newStat = new KeyValuePair <string, List <SubPrice3> >( filePosition, baseStats); baseStat.SubPrice3Labels.Add(newStat); bIsAdded = AddSubPrice3StocksToDictionary(baseStat, filePosition, nodePosition, indicators); } return(bIsAdded); }
private string GetSubPrice3Property(SubPrice3 subP, string attName) { string sPropertyValue = string.Empty; switch (attName) { case cSubPName: sPropertyValue = subP.SubPName; break; case cSubPDescription: sPropertyValue = subP.SubPDescription; break; case cSubPLabel: sPropertyValue = subP.SubPLabel; break; case cSubPType: sPropertyValue = subP.SubPType; break; case cSubPAltType: sPropertyValue = subP.SubPAltType; break; case cSubPFactor: sPropertyValue = subP.SubPFactor.ToString(); break; case cSubPYears: sPropertyValue = subP.SubPYears.ToString(); break; case cSubPAmount: sPropertyValue = subP.SubPAmount.ToString(); break; case cSubPUnit: sPropertyValue = subP.SubPUnit.ToString(); break; case cSubPPrice: sPropertyValue = subP.SubPPrice.ToString(); break; case cSubPEscRate: sPropertyValue = subP.SubPEscRate.ToString(); break; case cSubPEscType: sPropertyValue = subP.SubPEscType; break; case cSubPTotal: sPropertyValue = subP.SubPTotal.ToString(); break; case cSubPTotalPerUnit: sPropertyValue = subP.SubPTotalPerUnit.ToString(); break; case cSubPDistType: sPropertyValue = subP.SubPDistType.ToString(); break; case cSubPAmountB: sPropertyValue = subP.SubPAmountB.ToString(); break; case cSubPPriceB: sPropertyValue = subP.SubPPriceB.ToString(); break; case cSubPEscRateB: sPropertyValue = subP.SubPEscRateB.ToString(); break; case cSubPTotalB: sPropertyValue = subP.SubPTotalB.ToString(); break; case cSubPAmountC: sPropertyValue = subP.SubPAmountC.ToString(); break; case cSubPPriceC: sPropertyValue = subP.SubPPriceC.ToString(); break; case cSubPEscRateC: sPropertyValue = subP.SubPEscRateC.ToString(); break; case cSubPTotalC: sPropertyValue = subP.SubPTotalC.ToString(); break; default: break; } return(sPropertyValue); }
private void SetSubPrice3Property(SubPrice3 subP, string attName, string attValue) { switch (attName) { case cSubPName: subP.SubPName = attValue; break; case cSubPDescription: subP.SubPDescription = attValue; break; case cSubPLabel: subP.SubPLabel = attValue; break; case cSubPType: subP.SubPType = attValue; break; case cSubPAltType: subP.SubPAltType = attValue; break; case cSubPFactor: subP.SubPFactor = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPYears: subP.SubPYears = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPAmount: subP.SubPAmount = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPUnit: subP.SubPUnit = attValue; break; case cSubPPrice: subP.SubPPrice = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPEscRate: subP.SubPEscRate = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPEscType: subP.SubPEscType = attValue; break; case cSubPTotal: subP.SubPTotal = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPTotalPerUnit: subP.SubPTotalPerUnit = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPDistType: subP.SubPDistType = attValue; break; case cSubPAmountB: subP.SubPAmountB = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPPriceB: subP.SubPPriceB = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPEscRateB: subP.SubPEscRateB = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPTotalB: subP.SubPTotalB = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPAmountC: subP.SubPAmountC = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPPriceC: subP.SubPPriceC = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPEscRateC: subP.SubPEscRateC = CalculatorHelpers.ConvertStringToDouble(attValue); break; case cSubPTotalC: subP.SubPTotalC = CalculatorHelpers.ConvertStringToDouble(attValue); break; default: break; } }
//copy constructors public SubPrice3(SubPrice3 calculator) { CopySubPrice3sProperties(calculator); }