protected void btnSave_Click(object sender, EventArgs e) { if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.DiePriceListSave, false)) { return; } if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING) { this.currentEntity = new DiePriceList(); } else { this.currentEntity = this.ownerPage.CostCalculationRef.GetDiePriceListById(this.hdnRowMasterKey.Value); if (this.currentEntity == null) { this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; base.AddMessage(this.lbResultContext, string.Format("Entity `DiePriceList` not found by ID ({0})!", this.hdnRowMasterKey.Value)); return; } } this.currentEntity.idVendor = this.ddlVendor.SelectedValueINT; this.currentEntity.DateFrom = this.tbxDateFrom.TextAsDateParseExactOrMinValue; this.currentEntity.DateTo = this.tbxDateTo.TextAsDateParseExact; this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.DiePriceListSave(new List <DiePriceList>() { 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); this.btnImportPriceListDetails.Enabled = true; } else { if (!ShowErrors(new List <CallContext>() { this.ownerPage.CallContext })) { return; } } if (this.ownerPage is DiePricesList) { ((DiePricesList)this.ownerPage).LoadFilteredList(); } }
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.GetDiePriceListById(this.CurrentEntityMasterID); if (this.currentEntity != null) { this.SetHdnField(this.currentEntity.idDiePriceList.ToString()); BaseHelper.CheckAndSetSelectedValue(this.ddlVendor.DropDownListCTRL, this.currentEntity.idVendor.ToString(), false); this.tbxDateFrom.SetTxbDateTimeValue(this.currentEntity.DateFrom); this.tbxDateTo.SetTxbDateTimeValue(this.currentEntity.DateTo); this.btnImportPriceListDetails.Enabled = true; if (this.currentEntity.DiePriceListDetails != null && this.currentEntity.DiePriceListDetails.Count > 0) { this.ddlVendor.DropDownEnabled = false; this.tbxDateFrom.ReadOnly = true; this.btnImportPriceListDetails.Enabled = false; } base.ClearResultContext(this.lbResultContext); } else { SetEmptyValues(); } this.pnlFormData.Visible = true; this.pnlFormData.Focus(); }