public BudgetForecast GetForecast(int current, int min, int max, bool preferExpansion = false) { CycleStage stage = GetStage(current, min, max, preferExpansion); stage.duration = GetRandomDuration(); stage.length = BudgetUtils.RoundOff(GetRawChangeLength(BudgetUtils.Multiply(stage.duration), Math.Abs(stage.allowedChange))); return(new BudgetForecast(stage.FormForecast())); }
private int GetMultiplier() { if (String.IsNullOrEmpty(this.Request.QueryString["AmountScaleOption"])) { throw new IndException(ApplicationMessages.MessageWithParameters(ApplicationMessages.EXCEPTION_COULD_NOT_GET_PARAMETER, "AmountScaleOption")); } AmountScaleOption amountScaleOption = BudgetUtils.GetAmountScaleOptionFromText(this.Request.QueryString["AmountScaleOption"]); int multiplier = 1; for (int i = 1; i <= (int)amountScaleOption; i++) { multiplier *= 1000; } return(multiplier); }
public List <int> FormForecast(int part) { var result = new List <int>(); int tempBudget = current; int remains = length; for (int i = 0; i < duration; i++) { int partBudget = BudgetUtils.RoundOff(part); tempBudget += partBudget; remains -= partBudget; result.Add(tempBudget); } if (result.Count > 0) { result[result.Count - 1] += remains; } return(result); }
protected void btnApply_Click(object sender, ImageClickEventArgs e) { try { #region Build Object //Gets the amount scale AmountScaleOption scaleOption = BudgetUtils.GetAmountScaleOptionFromText(this.Request.QueryString["AmountScaleOption"]); int multiplier = 1; //Find out the number that will be used to multiply the values with for (int i = 1; i <= (int)scaleOption; i++) { multiplier *= 1000; } //Build the object from the screen values InitialBudgetOtherCosts otherCosts = SessionManager.GetSessionValueNoRedirect(this, SessionStrings.INITIAL_OTHER_COSTS) as InitialBudgetOtherCosts; otherCosts.TE = (txtTE.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : decimal.Parse(txtTE.Text) * multiplier; otherCosts.ProtoParts = (txtProtoParts.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : decimal.Parse(txtProtoParts.Text) * multiplier; otherCosts.ProtoTooling = (txtProtoTooling.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : decimal.Parse(txtProtoTooling.Text) * multiplier; otherCosts.Trials = (txtTrials.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : decimal.Parse(txtTrials.Text) * multiplier; otherCosts.OtherExpenses = (txtOtherExpenses.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : decimal.Parse(txtOtherExpenses.Text) * multiplier; //Add object to session SessionManager.AddOtherCosts(this, otherCosts); #endregion Buidl Object //Close the page if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "ButtonClickScript")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ButtonClickScript", "window.returnValue = 1; window.close();", true); } } catch (IndException exc) { ShowError(exc); return; } catch (Exception exc) { ShowError(new IndException(exc)); return; } }
public int ConvertToRealBudget(float budget) { return(BudgetUtils.RoundOff(budget)); }