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

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

                this.tbxDateFrom.SetTxbDateTimeValue(this.currentEntity.SAPData.DateFrom);
                this.tbxDateTo.SetTxbDateTimeValue(this.currentEntity.SAPData.DateTo);
                this.tbxStatus.Text = this.currentEntity.SAPData.Status;

                BaseHelper.CheckAndSetSelectedValue(this.ddlCostCenter.DropDownListCTRL, this.currentEntity.idCostCenter.ToString(), false);
                BaseHelper.CheckAndSetSelectedValue(this.ddlQuantityType.DropDownListCTRL, this.currentEntity.idQuantityType.ToString(), false);

                this.tbxValueData.Text = this.currentEntity.ValueDataRoundString;

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

            this.pnlFormData.Visible = true;
            this.pnlFormData.Focus();
        }
Пример #2
0
 /// <summary>
 /// Create a new SAPDataQuantity object.
 /// </summary>
 /// <param name="idSAPDataQuantity">Initial value of the idSAPDataQuantity property.</param>
 /// <param name="idSAPData">Initial value of the idSAPData property.</param>
 /// <param name="idCostCenter">Initial value of the idCostCenter property.</param>
 /// <param name="idQuantityType">Initial value of the idQuantityType property.</param>
 /// <param name="valueData">Initial value of the ValueData property.</param>
 public static SAPDataQuantity CreateSAPDataQuantity(global::System.Int32 idSAPDataQuantity, global::System.Int32 idSAPData, global::System.Int32 idCostCenter, global::System.Int32 idQuantityType, global::System.Decimal valueData)
 {
     SAPDataQuantity sAPDataQuantity = new SAPDataQuantity();
     sAPDataQuantity.idSAPDataQuantity = idSAPDataQuantity;
     sAPDataQuantity.idSAPData = idSAPData;
     sAPDataQuantity.idCostCenter = idCostCenter;
     sAPDataQuantity.idQuantityType = idQuantityType;
     sAPDataQuantity.ValueData = valueData;
     return sAPDataQuantity;
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SAPDataQuantities EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSAPDataQuantities(SAPDataQuantity sAPDataQuantity)
 {
     base.AddObject("SAPDataQuantities", sAPDataQuantity);
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.SAPDataQuantitySave, false))
            {
                return;
            }

            
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING)
            {
                this.currentEntity = new SAPDataQuantity();
            }
            else
            {
                this.currentEntity = this.ownerPage.CostCalculationRef.GetSAPDataQuantityById(this.hdnRowMasterKey.Value);

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

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

                    return;
                }

                
            }

            this.currentEntity.idCostCenter = this.ddlCostCenter.SelectedValueINT;
            this.currentEntity.idQuantityType = this.ddlQuantityType.SelectedValueINT;
            this.currentEntity.ValueData = BaseHelper.ConvertToDecimalOrMinValue(this.tbxValueData.Text.Trim());

            this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.SAPDataQuantitySave(new List<SAPDataQuantity>() { 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 SAPDataQuantitiesList)
            {
                ((SAPDataQuantitiesList)this.ownerPage).LoadFilteredList();
            }
        }