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(); } }