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(); }
/// <summary> /// Create a new CommissionsByAgent object. /// </summary> /// <param name="idCommissionsByAgent">Initial value of the idCommissionsByAgent property.</param> /// <param name="idAgent">Initial value of the idAgent property.</param> /// <param name="dateFrom">Initial value of the DateFrom property.</param> public static CommissionsByAgent CreateCommissionsByAgent(global::System.Int32 idCommissionsByAgent, global::System.Int32 idAgent, global::System.DateTime dateFrom) { CommissionsByAgent commissionsByAgent = new CommissionsByAgent(); commissionsByAgent.idCommissionsByAgent = idCommissionsByAgent; commissionsByAgent.idAgent = idAgent; commissionsByAgent.DateFrom = dateFrom; return commissionsByAgent; }
/// <summary> /// Deprecated Method for adding a new object to the CommissionsByAgents EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCommissionsByAgents(CommissionsByAgent commissionsByAgent) { base.AddObject("CommissionsByAgents", commissionsByAgent); }
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(); } }