/// <summary>
        /// Removes otherCosts BudgetRevisedOtherCosts object from the list of BudgetRevisedOtherCosts objects
        /// </summary>
        /// <param name="page">calling page</param>
        /// <param name="otherCosts">object to be removed from the list</param>
        public static void RemoveRevisedOtherCosts(Page page, RevisedBudgetOtherCosts otherCosts)
        {
            if (!(page is IndBasePage))
            {
                throw new IndException(ApplicationMessages.EXCEPTION_PAGE_NOT_INDBASEPAGE);
            }

            List <RevisedBudgetOtherCosts> otherCostsList = (List <RevisedBudgetOtherCosts>)GetSessionValue(page as IndBasePage, SessionStrings.REVISED_OTHER_COSTS_LIST, false);

            try
            {
                if (otherCostsList == null)
                {
                    return;
                }
                //BudgetRevisedOtherCosts foundOtherCost = null;
                foreach (RevisedBudgetOtherCosts currentOC in otherCostsList)
                {
                    if ((currentOC.IdProject == otherCosts.IdProject) &&
                        (currentOC.IdPhase == otherCosts.IdPhase) &&
                        (currentOC.IdWP == otherCosts.IdWP) &&
                        (currentOC.IdCostCenter == otherCosts.IdCostCenter))
                    {
                        otherCostsList.Remove(currentOC);
                        SetSessionValue(page, SessionStrings.REVISED_OTHER_COSTS_LIST, otherCostsList);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new IndException(ex);
            }
        }
Beispiel #2
0
 private void UpdateUpdateCosts(RevisedBudgetOtherCosts otherCosts, int multiplier)
 {
     otherCosts.UpdateCosts.TE            = (txtUpdateTE.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(Rounding.Round(decimal.Parse(txtUpdateTE.Text)), multiplier);
     otherCosts.UpdateCosts.ProtoParts    = (txtUpdateProtoParts.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(Rounding.Round(decimal.Parse(txtUpdateProtoParts.Text)), multiplier);
     otherCosts.UpdateCosts.ProtoTooling  = (txtUpdateProtoTooling.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(Rounding.Round(decimal.Parse(txtUpdateProtoTooling.Text)), multiplier);
     otherCosts.UpdateCosts.Trials        = (txtUpdateTrials.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(Rounding.Round(decimal.Parse(txtUpdateTrials.Text)), multiplier);
     otherCosts.UpdateCosts.OtherExpenses = (txtUpdateOtherExpenses.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(Rounding.Round(decimal.Parse(txtUpdateOtherExpenses.Text)), multiplier);
 }
Beispiel #3
0
 private void UpdateCurrentCosts(RevisedBudgetOtherCosts otherCosts, int multiplier)
 {
     otherCosts.CurrentCosts.TE            = (lblCurrentTE.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(decimal.Parse(lblCurrentTE.Text), multiplier);
     otherCosts.CurrentCosts.ProtoParts    = (lblCurrentProtoParts.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(decimal.Parse(lblCurrentProtoParts.Text), multiplier);
     otherCosts.CurrentCosts.ProtoTooling  = (lblCurrentProtoTooling.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(decimal.Parse(lblCurrentProtoTooling.Text), multiplier);
     otherCosts.CurrentCosts.Trials        = (lblCurrentTrials.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(decimal.Parse(lblCurrentTrials.Text), multiplier);
     otherCosts.CurrentCosts.OtherExpenses = (lblCurrentOtherExpenses.Text == String.Empty) ? ApplicationConstants.DECIMAL_NULL_VALUE : Decimal.Multiply(decimal.Parse(lblCurrentOtherExpenses.Text), multiplier);
 }
Beispiel #4
0
    private void UpdateNewCosts(RevisedBudgetOtherCosts otherCosts, int multiplier)
    {
        if (otherCosts.CurrentCosts.TE == ApplicationConstants.DECIMAL_NULL_VALUE && otherCosts.UpdateCosts.TE == ApplicationConstants.DECIMAL_NULL_VALUE)
        {
            otherCosts.NewCosts.TE = ApplicationConstants.DECIMAL_NULL_VALUE;
        }
        else
        {
            otherCosts.NewCosts.TE = ApplicationUtils.GetDecimalValueForSum(otherCosts.CurrentCosts.TE) +
                                     ApplicationUtils.GetDecimalValueForSum(otherCosts.UpdateCosts.TE);
        }

        if (otherCosts.CurrentCosts.ProtoParts == ApplicationConstants.DECIMAL_NULL_VALUE && otherCosts.UpdateCosts.ProtoParts == ApplicationConstants.DECIMAL_NULL_VALUE)
        {
            otherCosts.NewCosts.ProtoParts = ApplicationConstants.DECIMAL_NULL_VALUE;
        }
        else
        {
            otherCosts.NewCosts.ProtoParts = ApplicationUtils.GetDecimalValueForSum(otherCosts.CurrentCosts.ProtoParts) +
                                             ApplicationUtils.GetDecimalValueForSum(otherCosts.UpdateCosts.ProtoParts);
        }

        if (otherCosts.CurrentCosts.ProtoTooling == ApplicationConstants.DECIMAL_NULL_VALUE && otherCosts.UpdateCosts.ProtoTooling == ApplicationConstants.DECIMAL_NULL_VALUE)
        {
            otherCosts.NewCosts.ProtoTooling = ApplicationConstants.DECIMAL_NULL_VALUE;
        }
        else
        {
            otherCosts.NewCosts.ProtoTooling = ApplicationUtils.GetDecimalValueForSum(otherCosts.CurrentCosts.ProtoTooling) +
                                               ApplicationUtils.GetDecimalValueForSum(otherCosts.UpdateCosts.ProtoTooling);
        }

        if (otherCosts.CurrentCosts.Trials == ApplicationConstants.DECIMAL_NULL_VALUE && otherCosts.UpdateCosts.Trials == ApplicationConstants.DECIMAL_NULL_VALUE)
        {
            otherCosts.NewCosts.Trials = ApplicationConstants.DECIMAL_NULL_VALUE;
        }
        else
        {
            otherCosts.NewCosts.Trials = ApplicationUtils.GetDecimalValueForSum(otherCosts.CurrentCosts.Trials) +
                                         ApplicationUtils.GetDecimalValueForSum(otherCosts.UpdateCosts.Trials);
        }

        if (otherCosts.CurrentCosts.OtherExpenses == ApplicationConstants.DECIMAL_NULL_VALUE && otherCosts.UpdateCosts.OtherExpenses == ApplicationConstants.DECIMAL_NULL_VALUE)
        {
            otherCosts.NewCosts.OtherExpenses = ApplicationConstants.DECIMAL_NULL_VALUE;
        }
        else
        {
            otherCosts.NewCosts.OtherExpenses = ApplicationUtils.GetDecimalValueForSum(otherCosts.CurrentCosts.OtherExpenses) +
                                                ApplicationUtils.GetDecimalValueForSum(otherCosts.UpdateCosts.OtherExpenses);
        }
    }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //If the page is not posted back, populate the controls on it with other costs data
         if (!IsPostBack)
         {
             if (String.IsNullOrEmpty(this.Request.QueryString["IsAssociateCurrency"]))
             {
                 throw new IndException(ApplicationMessages.MessageWithParameters(ApplicationMessages.EXCEPTION_COULD_NOT_GET_PARAMETER, "IsAssociateCurrency"));
             }
             if (this.Request.QueryString["IsAssociateCurrency"] != "0" && this.Request.QueryString["IsAssociateCurrency"] != "1")
             {
                 throw new IndException(ApplicationMessages.EXCEPTION_WRONG_ASSOCIATE_CURRENCY_PARAMETER);
             }
             if (String.IsNullOrEmpty(this.Request.QueryString["AmountScaleOption"]))
             {
                 throw new IndException(ApplicationMessages.MessageWithParameters(ApplicationMessages.EXCEPTION_COULD_NOT_GET_PARAMETER, "AmountScaleOption"));
             }
             RevisedBudgetOtherCosts otherCosts = (RevisedBudgetOtherCosts)SessionManager.GetSessionValueRedirect(this, SessionStrings.REVISED_OTHER_COSTS);
             //If other costs is null, the redirect does not take place immediately
             if (otherCosts != null)
             {
                 //initialize controls to empty string before loading from database
                 InitializePopupControls();
                 RevisedBudgetOtherCosts existingOtherCosts = SessionManager.GetRevisedOtherCost(this, otherCosts);
                 if (existingOtherCosts == null)
                 {
                     otherCosts.IsAssociateCurrency = this.Request.QueryString["IsAssociateCurrency"] == "1" ? true : false;
                     DataSet dsOtherCosts = otherCosts.GetAll(true);
                     PopulateControls(dsOtherCosts.Tables[0]);
                 }
                 else
                 {
                     PopulateControls(existingOtherCosts);
                 }
             }
         }
     }
     catch (IndException exc)
     {
         ShowError(exc);
         return;
     }
     catch (Exception exc)
     {
         ShowError(new IndException(exc));
         return;
     }
 }
Beispiel #6
0
    private void PopulateControls(RevisedBudgetOtherCosts otherCosts)
    {
        int multiplier = GetMultiplier();

        lblCurrentTE.Text            = (otherCosts.CurrentCosts.TE == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty :  Rounding.Round(Decimal.Divide(otherCosts.CurrentCosts.TE, multiplier)).ToString();
        lblCurrentProtoParts.Text    = (otherCosts.CurrentCosts.ProtoParts == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.CurrentCosts.ProtoParts, multiplier)).ToString();
        lblCurrentProtoTooling.Text  = (otherCosts.CurrentCosts.ProtoTooling == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.CurrentCosts.ProtoTooling, multiplier)).ToString();
        lblCurrentTrials.Text        = (otherCosts.CurrentCosts.Trials == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.CurrentCosts.Trials, multiplier)).ToString();
        lblCurrentOtherExpenses.Text = (otherCosts.CurrentCosts.OtherExpenses == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.CurrentCosts.OtherExpenses, multiplier)).ToString();

        txtUpdateTE.Text            = (otherCosts.UpdateCosts.TE == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.UpdateCosts.TE, multiplier)).ToString();
        txtUpdateProtoParts.Text    = (otherCosts.UpdateCosts.ProtoParts == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.UpdateCosts.ProtoParts, multiplier)).ToString();
        txtUpdateProtoTooling.Text  = (otherCosts.UpdateCosts.ProtoTooling == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.UpdateCosts.ProtoTooling, multiplier)).ToString();
        txtUpdateTrials.Text        = (otherCosts.UpdateCosts.Trials == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.UpdateCosts.Trials, multiplier)).ToString();
        txtUpdateOtherExpenses.Text = (otherCosts.UpdateCosts.OtherExpenses == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.UpdateCosts.OtherExpenses, multiplier)).ToString();

        lblNewTE.Text            = (otherCosts.NewCosts.TE == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.NewCosts.TE, multiplier)).ToString();
        lblNewProtoParts.Text    = (otherCosts.NewCosts.ProtoParts == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.NewCosts.ProtoParts, multiplier)).ToString();
        lblNewProtoTooling.Text  = (otherCosts.NewCosts.ProtoTooling == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.NewCosts.ProtoTooling, multiplier)).ToString();
        lblNewTrials.Text        = (otherCosts.NewCosts.Trials == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.NewCosts.Trials, multiplier)).ToString();
        lblNewOtherExpenses.Text = (otherCosts.NewCosts.OtherExpenses == ApplicationConstants.DECIMAL_NULL_VALUE) ? String.Empty : Rounding.Round(Decimal.Divide(otherCosts.NewCosts.OtherExpenses, multiplier)).ToString();
    }
Beispiel #7
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                //Build the object from the screen values
                RevisedBudgetOtherCosts otherCosts = SessionManager.GetSessionValueRedirect(this, SessionStrings.REVISED_OTHER_COSTS) as RevisedBudgetOtherCosts;
                int multiplier = GetMultiplier();

                if (otherCosts != null)
                {
                    UpdateCurrentCosts(otherCosts, multiplier);
                    UpdateUpdateCosts(otherCosts, multiplier);
                    UpdateNewCosts(otherCosts, multiplier);

                    //Add object to session
                    SessionManager.AddRevisedOtherCosts(this, otherCosts);

                    //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;
        }
    }