protected void btnSave_Click(object sender, EventArgs e) { if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.CommissionsByAgentSave, false)) { return; } if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING) { this.currentEntity = new CommissionsByAgent(); } else { this.currentEntity = this.ownerPage.CostCalculationRef.GetCommissionsByAgentById(this.hdnRowMasterKey.Value); if (this.currentEntity == null) { this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; base.AddMessage(this.lbResultContext, string.Format("Entity `CommissionsByAgent` not found by ID ({0})!", this.hdnRowMasterKey.Value)); return; } } this.currentEntity.idAgent = this.ddlAgent.SelectedValueINT; this.currentEntity.FixedCommission = BaseHelper.ConvertToDecimal(this.tbxFixedCommission.Text.Trim()); this.currentEntity.CommissionPercent = BaseHelper.ConvertToDecimal(this.tbxCommissionPercent.Text.Trim()); this.currentEntity.DateFrom = this.tbxDateFrom.TextAsDateParseExactOrMinValue; this.currentEntity.DateTo = this.tbxDateTo.TextAsDateParseExact; this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.CommissionsByAgentSave(new List <CommissionsByAgent>() { 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 CommissionsByAgentsList) { ((CommissionsByAgentsList)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.GetCommissionsByAgentById(this.CurrentEntityMasterID); if (this.currentEntity != null) { this.SetHdnField(this.currentEntity.idCommissionsByAgent.ToString()); BaseHelper.CheckAndSetSelectedValue(this.ddlAgent.DropDownListCTRL, this.currentEntity.idAgent.ToString(), false); this.tbxFixedCommission.Text = this.currentEntity.FixedCommissionRoundString; this.tbxCommissionPercent.Text = this.currentEntity.CommissionPercentRoundString; 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(); }