public override void UserControlLoad()
        {
            SetEmptyValues();
            base.ClearResultContext(this.lbResultContext);

            if (this.ownerPage == null)
            {
                throw new UMSException("Current Page is null or is not inheritor of BasicPage.");
            }

            if (!string.IsNullOrEmpty(this.hdnRowMasterKey.Value) && this.hdnRowMasterKey.Value != Constants.INVALID_ID_ZERO_STRING)
            {
                this.CurrentEntityMasterID = this.hdnRowMasterKey.Value;
            }

            InitLoadControls();

            this.currentEntity = this.ownerPage.CostCalculationRef.GetDiePriceListDetailById(this.CurrentEntityMasterID);

            if (this.currentEntity != null)
            {
                this.SetHdnField(this.currentEntity.idDiePriceListDetail.ToString());

                BaseHelper.CheckAndSetSelectedValue(this.ddlVendor.DropDownListCTRL, this.currentEntity.idDiePriceList.ToString(), false);
                BaseHelper.CheckAndSetSelectedValue(this.ddlNumberOfCavities.DropDownListCTRL, this.currentEntity.idNumberOfCavities.ToString(), false);
                BaseHelper.CheckAndSetSelectedValue(this.ddlProfileCategory.DropDownListCTRL, this.currentEntity.idProfileCategory.ToString(), false);
                BaseHelper.CheckAndSetSelectedValue(this.ddlProfileComplexity.DropDownListCTRL, this.currentEntity.idProfileComplexity.ToString(), false);
                this.tbxDimensionA.Text = this.currentEntity.DimensionA_String;
                this.tbxDimensionB.Text = this.currentEntity.DimensionB_String;
                this.tbxDiePrice.Text = this.currentEntity.PriceRoundString;
                this.tbxLifespan.Text = this.currentEntity.LifespanRoundString;

                base.ClearResultContext(this.lbResultContext);
            }
            else
            {
                SetEmptyValues();                
            }
                        
            this.pnlFormData.Visible = true;
            this.pnlFormData.Focus();
        }
 /// <summary>
 /// Create a new DiePriceListDetail object.
 /// </summary>
 /// <param name="idDiePriceListDetail">Initial value of the idDiePriceListDetail property.</param>
 /// <param name="idDiePriceList">Initial value of the idDiePriceList property.</param>
 /// <param name="idNumberOfCavities">Initial value of the idNumberOfCavities property.</param>
 /// <param name="idProfileCategory">Initial value of the idProfileCategory property.</param>
 /// <param name="idProfileComplexity">Initial value of the idProfileComplexity property.</param>
 /// <param name="dimensionA">Initial value of the DimensionA property.</param>
 /// <param name="dimensionB">Initial value of the DimensionB property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 /// <param name="lifespan">Initial value of the Lifespan property.</param>
 public static DiePriceListDetail CreateDiePriceListDetail(global::System.Int32 idDiePriceListDetail, global::System.Int32 idDiePriceList, global::System.Int32 idNumberOfCavities, global::System.Int32 idProfileCategory, global::System.Int32 idProfileComplexity, global::System.Int32 dimensionA, global::System.Int32 dimensionB, global::System.Decimal price, global::System.Decimal lifespan)
 {
     DiePriceListDetail diePriceListDetail = new DiePriceListDetail();
     diePriceListDetail.idDiePriceListDetail = idDiePriceListDetail;
     diePriceListDetail.idDiePriceList = idDiePriceList;
     diePriceListDetail.idNumberOfCavities = idNumberOfCavities;
     diePriceListDetail.idProfileCategory = idProfileCategory;
     diePriceListDetail.idProfileComplexity = idProfileComplexity;
     diePriceListDetail.DimensionA = dimensionA;
     diePriceListDetail.DimensionB = dimensionB;
     diePriceListDetail.Price = price;
     diePriceListDetail.Lifespan = lifespan;
     return diePriceListDetail;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the DiePriceListDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDiePriceListDetails(DiePriceListDetail diePriceListDetail)
 {
     base.AddObject("DiePriceListDetails", diePriceListDetail);
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.DiePriceListDetailsSave, false))
            {
                return;
            }

            
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING)
            {
                this.currentEntity = new DiePriceListDetail();

                this.currentEntity.idDiePriceList = this.ddlVendor.SelectedValueINT;
            }
            else
            {
                this.currentEntity = this.ownerPage.CostCalculationRef.GetDiePriceListDetailById(this.hdnRowMasterKey.Value);

                if (this.currentEntity == null)
                {
                    this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error;

                    base.AddMessage(this.lbResultContext, string.Format("Entity `DiePriceListDetail` not found by ID ({0})!", this.hdnRowMasterKey.Value));

                    return;
                }

               
            }

            this.currentEntity.idNumberOfCavities = this.ddlNumberOfCavities.SelectedValueINT;
            this.currentEntity.idProfileCategory = this.ddlProfileCategory.SelectedValueINT;
            this.currentEntity.idProfileComplexity = this.ddlProfileComplexity.SelectedValueINT;
            this.currentEntity.DimensionA = BaseHelper.ConvertToIntOrMinValue(this.tbxDimensionA.Text.Trim());
            this.currentEntity.DimensionB = BaseHelper.ConvertToIntOrMinValue(this.tbxDimensionB.Text.Trim());
            this.currentEntity.Price = BaseHelper.ConvertToDecimalOrMinValue(this.tbxDiePrice.Text.Trim());
            this.currentEntity.Lifespan = BaseHelper.ConvertToDecimalOrMinValue(this.tbxLifespan.Text.Trim());

            this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.DiePriceListDetailsSave(new List<DiePriceListDetail>() { this.currentEntity }, this.ownerPage.CallContext);

            if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success)
            {
                this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID;

                this.lbResultContext.Text = this.ownerPage.CallContext.Message;
                
                base.AddMessage(this.lbResultContext, this.ownerPage.CallContext.Message);
            }
            else
            {
                if (!ShowErrors(new List<CallContext>() { this.ownerPage.CallContext }))
                {
                    return;
                }
            }

            if (this.ownerPage is DiePriceListDetailsList)
            {
                ((DiePriceListDetailsList)this.ownerPage).LoadFilteredList();
            }
        }
Beispiel #5
0
        public override void UserControlLoad()
        {
            if (this.ownerPage == null)
            {
                throw new UMSException("Current Page is null or is not inheritor of BasicPage.");
            }

            InitLoadControls();
            SetEmptyValues();

            if (!string.IsNullOrEmpty(this.hdnRowMasterKey.Value) && this.hdnRowMasterKey.Value != Constants.INVALID_ID_STRING)
            {
                this.CurrentEntityMasterID = this.hdnRowMasterKey.Value;
            }

            this.currentEntity = this.ownerPage.CostCalculationRef.GetOfferByID(this.CurrentEntityMasterID);

            if (this.currentEntity != null)
            {

                //this.btnChoose.Enabled = false;

                this.currentEntity.LoadProductCostResult();
                this.currentEntity.LoadOfferOverviewResult();


                if (this.currentEntity.idDiePriceListDetail.HasValue)
                {
                    this.diePriceListDetail = this.ownerPage.CostCalculationRef.GetDiePriceListDetailById(this.currentEntity.idDiePriceListDetail.Value.ToString());
                    this.diePriceList = this.ownerPage.CostCalculationRef.GetDiePriceListById(this.diePriceListDetail.idDiePriceList.ToString());
                    this.tbxVendor.Text = this.ownerPage.GetKeyValueByID(this.diePriceList.idVendor).Name;
                    this.tbxPriceListStr.Text = diePriceList.DateFromString + "-" + diePriceList.DateToString;
                }


                
                this.tbxInquiryNumber.Text = this.currentEntity.InquiryNumber;
                this.tbxOfferDate.SetTxbDateTimeValue(this.currentEntity.OfferDate);
                //this.tbxOfferDate.ReadOnly = true;
                this.tbxCustomer.Text = this.currentEntity.Customer;
              

                this.tbxValueForA.Text = this.currentEntity.ValueForA.ToStringFormatted();
                this.tbxValueForB.Text = this.currentEntity.ValueForB.ToStringFormatted();
                this.tbxValueForC.Text = this.currentEntity.ValueForC.ToStringFormatted();
                this.tbxValueForD.Text = this.currentEntity.ValueForD.ToStringFormatted();
                this.tbxValueForS.Text = this.currentEntity.ValueForS.ToStringFormatted();

                this.tbxPin.Text = this.currentEntity.ValueForPin.ToStringNotFormatted();
                this.tbxPout.Text = this.currentEntity.ValueForPout.ToStringNotFormatted();

                this.tbxLME.Text        = this.currentEntity.LME.ToStringNotFormatted();
                this.tbxPREMIUM.Text    = this.currentEntity.PREMIUM.ToStringNotFormatted();
                this.tbxMaterial.Text   = this.currentEntity.MaterialComputable.ToStringFormatted();
                this.tbxMaterial_EUR.Text = this.currentEntity.Material_EUR_Computable.ToStringFormatted();
                

                if (this.currentEntity.idMaterialPriceList.HasValue)
                {
                    MaterialPriceList material = this.ownerPage.CostCalculationRef.GetMaterialPriceListById(this.currentEntity.idMaterialPriceList.ToString());
                    this.tbxMaterialPriceList.Text = material.DateFromString + " - " + material.DateToString;
                    this.hdnIdMaterialPriceList.Value = material.idMaterialPriceList.ToString();
                }

                ReloadDimensionCTRLByProfileSettingID(this.currentEntity.idProfileSetting.ToString());
                  



                this.tbxDiameter.Text = this.currentEntity.Diameter.ToStringNotFormatted();
                this.tbxDieDiameter.Text = this.currentEntity.DieDiameter.ToStringNotFormatted();
                this.tbxDieDimensions.Text = this.currentEntity.DieDimensions.ToStringNotFormatted();


                
                //OfferProducitivity  offerProducitivity = this.ownerPage.CostCalculationRef.GetOfferProducitivityByOfferID(this.CurrentEntityMasterID);


                //if(offerProducitivity != null)
                //{
                //    KeyValue kvPress = this.ownerPage.GetKeyValueByID(offerProducitivity.idPress);

                //    if(kvPress != null)
                //    {
                //        this.tbxPress.Text = kvPress.Name;
                //        this.ddlPress.SelectedValue = kvPress.idKeyValue.ToString();
                //    }
                //}
                
                this.tbxDiePrice.Text = this.currentEntity.DiePrice.ToStringNotFormatted();
                this.ddlPress.SelectedValue = this.currentEntity.idPress.ToString();

                this.tbxLengthOfFinalPC.Text = this.currentEntity.LengthOfFinalPC.ToStringNotFormatted();
                this.tbxWeightPerMeter.Text = this.currentEntity.WeightPerMeter.ToStringNotFormatted();
                this.tbxWeightPerPC.Text = this.currentEntity.WeightPerPC.ToStringNotFormatted();
                this.tbxDaysOfCredit.Text = this.currentEntity.DaysOfCredit.ToStringNotFormatted();
                this.tbxInterest.Text = this.currentEntity.Interest.ToStringNotFormatted();
                this.tbxGrossMargin.Text = this.currentEntity.GrossMargin.ToStringNotFormatted();
                this.tbxSavingsRate.Text = this.currentEntity.SavingsRate.ToStringNotFormatted();

                
                
                this.tbxPcsForTheWholeProject.Text = this.currentEntity.PcsForTheWholeProject.ToStringNotFormatted();


                this.ddlNumberOfCavities.SelectedValue = currentEntity.idNumberOfCavities.ToString();
                //this.ddlNumberOfCavities.DropDownEnabled = false;

                this.ddlAgent.SelectedValue = currentEntity.idAgent.ToString();
                this.ddlAging.SelectedValue = currentEntity.idAging.ToString();

                this.ddlHardness.SelectedValue = currentEntity.idHardness.ToString();
                this.ddlStandardPackaging.SelectedValue = currentEntity.idStandardPackaging.ToString();
                //this.ddlAging.DropDownEnabled = false;

                this.ddlCommision.SelectedValue = currentEntity.idCommision.ToString();
                this.ddlCalculationCommission.SelectedValue = currentEntity.idCalculationCommission.ToString();
                


                this.tbxExtrusion_EUR_TON.Text = currentEntity.Extrusion_EUR_TON_Computable.ToStringFormatted();
                this.tbxExtrusion_EUR.Text = currentEntity.Extrusion_EUR_Computable.ToStringFormatted();

                this.tbxPackaging_EUR_TON.Text = currentEntity.Packaging_EUR_TON_Computable.ToStringFormatted();
                this.tbxPackaging_EUR.Text = currentEntity.Packaging_EUR_Computable.ToStringFormatted();



                this.tbxTransportationCost.Text = this.currentEntity.TransportationCost.ToStringNotFormatted();
                this.tbxAdministrationExpenses.Text = this.currentEntity.AdministrationExpenses.ToStringNotFormatted();
                this.tbxSalesExpenses.Text = this.currentEntity.SalesExpenses.ToStringNotFormatted();
                this.tbxFinancialFixedExpenses.Text = this.currentEntity.FinancialFixedExpenses.ToStringNotFormatted();
                this.tbxFinancialVariableExpenses.Text = this.currentEntity.Financial_variable_Computable.ToStringNotFormatted();
                

                this.tbxSGAsAndFin_EUR_TON.Text = this.currentEntity.SGAsAndFin_EUR_TON_Computable.ToStringNotFormatted();
                this.tbxSGAsAndFin_EUR.Text = this.currentEntity.SGAsAndFin_EUR_Computable.ToStringFormatted();

                //

                this.tbxActualTotalSalesPriceToCustomer.Text = this.currentEntity.ActualTotalSalesPriceToCustomer.ToStringNotFormatted();

                this.tbxActualTotalSalesPriceToCustomerAll.Text = (this.currentEntity.ActualTotalSalesPriceToCustomer * this.currentEntity.Tonnage).ToStringFormatted();


                this.tbxTargetPrice.Text = this.currentEntity.TargetPrice_EUR_TON.ToStringNotFormatted();

                this.tbxTotalSalesPrice_EUR_TON.Text = this.currentEntity.TotalSalesPrice_EUR_TON_Computable.ToStringFormatted();

                this.tbxTotalSalesPrice_EUR.Text = this.currentEntity.TotalSalesPrice.ToStringFormatted();

                PresetData();

                ddlCommision_SelectedIndexChanged(null, null);
                ddlCalculationCommission_SelectedIndexChanged(null, null);

                this.hdnRowMasterKey.Value = this.currentEntity.idOffer.ToString();

                ClearResultContext();
            }
            else
            {
                SetEmptyValues();
            }
        }