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.GetAverageOutturnOverTimeById(this.CurrentEntityMasterID);

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

                this.tbxValueOfPressSMS1.Text = this.currentEntity.ValueOfPressSMS1.ToStringNotFormatted();
                this.tbxValueOfPressSMS2.Text = this.currentEntity.ValueOfPressSMS2.ToStringNotFormatted();
                this.tbxValueOfPressBREDA.Text = this.currentEntity.ValueOfPressBREDA.ToStringNotFormatted();
                this.tbxValueOfPressFARREL.Text = this.currentEntity.ValueOfPressFARREL.ToStringNotFormatted();

                this.tbxDateFrom.SetTxbDateTimeValue(this.currentEntity.DateFrom);
                this.tbxDateTo.SetTxbDateTimeValue(this.currentEntity.DateTo);

                base.ClearResultContext(this.lbResultContext);
            }
            else
            {
                SetEmptyValues();
            }

            this.pnlFormData.Visible = true;
            this.pnlFormData.Focus();
        }
Пример #2
0
 /// <summary>
 /// Create a new AverageOutturnOverTime object.
 /// </summary>
 /// <param name="idAverageOutturnOverTime">Initial value of the idAverageOutturnOverTime property.</param>
 /// <param name="dateFrom">Initial value of the DateFrom property.</param>
 public static AverageOutturnOverTime CreateAverageOutturnOverTime(global::System.Int32 idAverageOutturnOverTime, global::System.DateTime dateFrom)
 {
     AverageOutturnOverTime averageOutturnOverTime = new AverageOutturnOverTime();
     averageOutturnOverTime.idAverageOutturnOverTime = idAverageOutturnOverTime;
     averageOutturnOverTime.DateFrom = dateFrom;
     return averageOutturnOverTime;
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the AverageOutturnOverTimes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAverageOutturnOverTimes(AverageOutturnOverTime averageOutturnOverTime)
 {
     base.AddObject("AverageOutturnOverTimes", averageOutturnOverTime);
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING)
            {
                this.currentEntity = new AverageOutturnOverTime();
            }
            else
            {
                this.currentEntity = this.ownerPage.CostCalculationRef.GetAverageOutturnOverTimeById(this.hdnRowMasterKey.Value);

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

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

                    return;
                }

                
            }
            this.currentEntity.ValueOfPressSMS1 = BaseHelper.ConvertToDecimalOrMinValue(this.tbxValueOfPressSMS1.Text.Trim());
            this.currentEntity.ValueOfPressSMS2 = BaseHelper.ConvertToDecimalOrMinValue(this.tbxValueOfPressSMS2.Text.Trim());

            this.currentEntity.ValueOfPressBREDA = BaseHelper.ConvertToDecimalOrMinValue(this.tbxValueOfPressBREDA.Text.Trim());
            this.currentEntity.ValueOfPressFARREL = BaseHelper.ConvertToDecimalOrMinValue(this.tbxValueOfPressFARREL.Text.Trim());
            

            this.currentEntity.DateFrom = this.tbxDateFrom.TextAsDateParseExactOrMinValue;
            this.currentEntity.DateTo = this.tbxDateTo.TextAsDateParseExact;

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

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

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

            if (this.ownerPage is AverageOutturnOverTimeList)
            {
                ((AverageOutturnOverTimeList)this.ownerPage).LoadFilteredList();
            }
        }