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.GetMaterialPriceListById(this.CurrentEntityMasterID); if (this.currentEntity != null) { this.SetHdnField(this.currentEntity.idMaterialPriceList.ToString()); this.tbxLME.Text = this.currentEntity.LME_RoundString; this.tbxPremium.Text = this.currentEntity.PremiumRoundString; 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(); }
/// <summary> /// Create a new MaterialPriceList object. /// </summary> /// <param name="idMaterialPriceList">Initial value of the idMaterialPriceList property.</param> /// <param name="lME">Initial value of the LME property.</param> /// <param name="premium">Initial value of the Premium property.</param> /// <param name="dateFrom">Initial value of the DateFrom property.</param> public static MaterialPriceList CreateMaterialPriceList(global::System.Int32 idMaterialPriceList, global::System.Decimal lME, global::System.Decimal premium, global::System.DateTime dateFrom) { MaterialPriceList materialPriceList = new MaterialPriceList(); materialPriceList.idMaterialPriceList = idMaterialPriceList; materialPriceList.LME = lME; materialPriceList.Premium = premium; materialPriceList.DateFrom = dateFrom; return materialPriceList; }
/// <summary> /// Deprecated Method for adding a new object to the MaterialPriceLists EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMaterialPriceLists(MaterialPriceList materialPriceList) { base.AddObject("MaterialPriceLists", materialPriceList); }
protected void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING) { this.currentEntity = new MaterialPriceList(); } else { this.currentEntity = this.ownerPage.CostCalculationRef.GetMaterialPriceListById(this.hdnRowMasterKey.Value); if (this.currentEntity == null) { this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; base.AddMessage(this.lbResultContext, string.Format("Entity `MaterialPriceList` not found by ID ({0})!", this.hdnRowMasterKey.Value)); return; } } this.currentEntity.LME = BaseHelper.ConvertToDecimalOrMinValue(this.tbxLME.Text.Trim()); this.currentEntity.Premium = BaseHelper.ConvertToDecimalOrMinValue(this.tbxPremium.Text.Trim()); this.currentEntity.DateFrom = this.tbxDateFrom.TextAsDateParseExactOrMinValue; this.currentEntity.DateTo = this.tbxDateTo.TextAsDateParseExact; this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.MaterialPriceListSave(new List<MaterialPriceList>() { 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 MaterialPricesList) { ((MaterialPricesList)this.ownerPage).LoadFilteredList(); } }