protected void btnReg_Click(object sender, EventArgs e) { clearMsgLabel(); resetLabelControl(); Promotion promotion = new Promotion(); bool validationResult = ValidateInputAndFillPromotion(promotion); bool checkPromo = checkPromotedEmployee(); if (!checkPromo) { btnReg.Visible = false; btnAddNewIntrenal.Visible = true; return; } //if Data is not valid - stop the flow if (!validationResult) { return; } //continue otherwise PromotionManager promotionManager = new PromotionManager(promotion); TransactionResponse response = promotionManager.addNewPromotion(); //if store to DB is successful, register notification for this Promotion if (response.isSuccessful()) { //Register Notification for the promotion assigned to HR Manager. string notificationRegistractionMessage = registerNotification(promotion); msgPanel.Visible = true; SucessDIV.Visible = true; lblSuccessMessage.Text = response.getMessage() + notificationRegistractionMessage; btnReg.Visible = false; btnAddNewIntrenal.Visible = true; } // show error message to a user. else { msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = "(" + response.getErrorCode() + ") " + response.getMessage(); } }