protected void CallResultCallback(ResultEnum result)
 {
     if (m_resultCallback != null)
     {
         m_resultCallback(result);
     }
 }
        private void btnInsert_Click(object sender, EventArgs e)
        {
            //validate form
            List <hourError> errors = ValidateHours(gbHours);
            //get error messages in string
            string err = GetErrorMsg();

            //print out error messages if found else continue code
            if (err != SUCCESS)
            {
                MessageBox.Show(err);
                tags[0].Focus();
                return;
            }

            //set working hours into hour Working hour class
            WorkingHour hour = new WorkingHour();

            hour.EmpID    = empID;
            hour.Hours    = double.Parse(txtHours.Text);
            hour.WorkDate = txtDate.Text;
            //return the result enum when attempting to insert into DB

            ResultEnum result = Insert(hour);

            if (result == ResultEnum.Success)
            {
                MessageBox.Show("Successfully entered Working Hours");
            }
            else
            {
                MessageBox.Show("An Unexpected Error Occured");
            }
        }
        private void btnSaveEmp_Click(object sender, EventArgs e)
        {
            //read the employees
            Employees updateEmployees = new Employees();

            updateEmployees.EmpID     = int.Parse(lblIDSavEmp.Text);
            updateEmployees.FirstName = txtFNameSav.Text;
            updateEmployees.LastName  = txtLNameSav.Text;
            updateEmployees.Email     = txtEmailSav.Text;
            updateEmployees.DOB       = txtDOBSav.Text;
            updateEmployees.Phone     = txtPhoneSav.Text;

            //save to DB
            EmployeesController controller = new EmployeesController();
            ResultEnum          result     = controller.Update(updateEmployees);

            if (result == ResultEnum.Success)
            {
                //reload the list
                Reload();
                MessageBox.Show("Updated");
            }
            else
            {
                MessageBox.Show("Cannot update");
            }
        }
Example #4
0
 void CallResultCallback(ResultEnum val)
 {
     if (ResultCallback != null)
     {
         ResultCallback(val);
     }
 }
Example #5
0
 public OperationResultEventArgs(ResultEnum result, Exception error, int tryCount)
     : base(error, result == ResultEnum.Canceled, null)
 {
     _result   = result;
     _tryCount = tryCount;
     _success  = result == ResultEnum.Success;
 }
Example #6
0
        //Record employee hours
        #region
        private void btnRecordHours_Click(object sender, EventArgs e)
        {
            //validation
            if (!ValidationHelper.NumberWithDashOrDecimal(txtHours.Text))
            {
                MessageBox.Show("Please enter the amount of hours employee has worked.");
                return;
            }

            //read input
            EmpHours empHours = new EmpHours();

            empHours.EmpID    = int.Parse(txtIdEmp.Text);
            empHours.WorkDate = DateTime.Parse(dtbWorkDate.Text);
            empHours.Hours    = decimal.Parse(txtHours.Text);

            //pass to controller
            EmpHoursController controller = new EmpHoursController();
            ResultEnum         result     = controller.AddHours(empHours);

            //show output
            switch (result)
            {
            case ResultEnum.Success:
                MessageBox.Show("Hours added.");
                break;

            case ResultEnum.Fail:
                MessageBox.Show("Cannot add hours");
                break;
            }
        }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebhookAttempts" /> class.
 /// </summary>
 /// <param name="clientError">Kazoo-side error string, if any.</param>
 /// <param name="hookId">Id of the hook attempted (required).</param>
 /// <param name="reason">short reason for the failure.</param>
 /// <param name="responseBody">HTTP response body received, if any.</param>
 /// <param name="responseCode">HTTP response code received, if any.</param>
 /// <param name="result">Whether the attempt succeeded or not (required).</param>
 /// <param name="retriesLeft">How many retries were left after this attempt.</param>
 public WebhookAttempts(string clientError = default(string), string hookId = default(string), string reason = default(string), string responseBody = default(string), string responseCode = default(string), ResultEnum result = default(ResultEnum), int?retriesLeft = default(int?))
 {
     // to ensure "hookId" is required (not null)
     if (hookId == null)
     {
         throw new InvalidDataException("hookId is a required property for WebhookAttempts and cannot be null");
     }
     else
     {
         this.HookId = hookId;
     }
     // to ensure "result" is required (not null)
     if (result == null)
     {
         throw new InvalidDataException("result is a required property for WebhookAttempts and cannot be null");
     }
     else
     {
         this.Result = result;
     }
     this.ClientError  = clientError;
     this.Reason       = reason;
     this.ResponseBody = responseBody;
     this.ResponseCode = responseCode;
     this.RetriesLeft  = retriesLeft;
 }
Example #8
0
        public void Check_ShouldReturnCorrectStatus(int posX, int posY, ResultEnum expectedResult)
        {
            //Arrange
            var currentPos  = new Point(posX, posY);
            var gameSetting = new GameSetting
            {
                ExitPoint     = new Point(4, 4),
                MinePositions = new List <Point>
                {
                    new Point(1, 1),
                    new Point(3, 3)
                }
            };
            var sequenceMoveHandler = new SequenceMoveHandler(gameSetting);
            //Act
            var actualCheck =
                sequenceMoveHandler.Check(new Position()
            {
                Direction = DirectionEnum.East, CurrentPosition = currentPos
            },
                                          false);

            //Assert
            Assert.Equal(expectedResult, actualCheck);
        }
Example #9
0
        public ResultEnum FilterResult(ResultEnum result)
        {
            if (String.IsNullOrEmpty(_ToUnknownStr))
            {
                return(result);
            }
            String val = ((int)result).ToString();

            if (val.Length == 2)
            {
                return(_ToUnknownStr.Contains(val) ? ResultEnum.BadSample_Ambiguous : result);
            }
            int postion = _ToUnknownStr.IndexOf(val);

            if (postion > 0)
            {
                if ("-" == _ToUnknownStr.ElementAt(postion - 1).ToString())
                {
                    return(result);
                }
                else
                {
                    return(ResultEnum.BadSample_Ambiguous);
                }
            }
            else
            {
                return(result);
            }
        }
        /// <summary>
        /// Converts result into the string type
        /// </summary>
        /// <param name="result">Result in the ResultEnum type</param>
        /// <returns>String result</returns>
        public static string PrintResult(ResultEnum result)
        {
            switch (result)
            {
            case ResultEnum.NotRunned:
            {
                return(Lang.resultNotRunned);
            }

            case ResultEnum.Failed:
            {
                return(Lang.resultFailed);
            }

            case ResultEnum.Passed:
            {
                return(Lang.resultPassed);
            }

            default:
            {
                return(Lang.Results_NotDefined);
            }
            }
        }
Example #11
0
        //*********************************************************************
        ///
        /// <summary>
        ///
        /// </summary>
        /// <param name="operationText"></param>
        ///
        ///
        //*********************************************************************

        private void AzureArmOperationStatus(string operationText)
        {
            try
            {
                Status = Utilities.FetchJsonValue(operationText, "status") as string;
            }
            catch (Exception e)
            {
                Status       = "Failed";
                ErrorCode    = e.HResult.ToString();
                ErrorMessage = e.Message;
            }
            finally
            {
                switch (Status)
                {
                case "Failed":
                    Result = ResultEnum.Failed;
                    break;

                default:
                    Result = ResultEnum.Success;
                    break;
                }
            }
        }
Example #12
0
        private void UpdateOutputFunc(ResultEnum value)
        {
            switch (value)
            {
            case ResultEnum.Simple:
                OutputFunc = SimpleOutputFunc;
                OonIFunc   = SimpleOonIFunc;
                break;

            case ResultEnum.Relu:
                OutputFunc = ReluOutputFunc;
                OonIFunc   = ReluOonIFunc;
                break;

            case ResultEnum.Sigmoid:
                OutputFunc = SigmoidOutputFunc;
                OonIFunc   = SigmoidOonIFunc;
                break;

            case ResultEnum.Softmax:
                OutputFunc = SoftmaxOutputFunc;
                OonIFunc   = SoftmaxOonIFunc;
                break;

            default:
                break;
            }
        }
Example #13
0
        private void btnAddEmployee_Click(object sender, EventArgs e)
        {
            //input
            Employee emp = new Employee();

            emp.FirstName = txtFirstName.Text;
            emp.LastName  = txtLastName.Text;
            emp.Email     = txtEmail.Text;
            emp.DOB       = DateTime.Parse(dtpDOB.Text);
            emp.Phone     = txtPhone.Text;

            //process - add employee
            EmployeeManager manager = new EmployeeManager();
            ResultEnum      result  = manager.InsertEmployee(emp);

            //output
            if (result == ResultEnum.Success)
            {
                MessageBox.Show("Employee added successfully");
            }
            else
            {
                MessageBox.Show("Error occured!");
            }
        }
 public void OnClosedTextBox(ResultEnum result)
 {
     if (m_textBox == null)
     {
         return;
     }
     CloseWindow();
 }
Example #15
0
 public bool Equals(ResultEnum obj)
 {
     if ((object)obj == null)
     {
         return(false);
     }
     return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value));
 }
Example #16
0
 public ResultMessageList(ResultEnum status, List <string> messageList = null)
 {
     this.Status = status;
     if (messageList != null)
     {
         this.MessageList = messageList;
     }
 }
Example #17
0
        private void buttonCheckout_Click(object sender, EventArgs e)
        {
            ResultEnum result = Controller.Checkout(() => Query("You've already got the files checked out. Are you sure you want to overwrite your local files with the state of the remote path?"));

            if (result == ResultEnum.CheckedOutBySomeoneElse)
            {
                ShowError("Files are currently locked by someone else");
            }
        }
Example #18
0
        public BaseResponse(ResultEnum result)
        {
            var attributes = result.GetAttribute <ReturnValuesAttribute>();

            Success = attributes.Success;
            Code    = attributes.Code;
            Message = attributes.Message;
            Info    = attributes.Info;
        }
Example #19
0
 public static BaseResponse <T> Get(bool success, string mess, T data, ResultEnum resultCode)
 {
     return(new BaseResponse <T>()
     {
         Success = success,
         Message = mess,
         Data = data,
         ResultCode = (int)resultCode
     });
 }
Example #20
0
 public static ApiException Get(bool success, string mess, ResultEnum errorStatus, HttpStatusCode statusCode)
 {
     return(new ApiException()
     {
         Success = success,
         ErrorMessage = mess,
         ErrorStatus = errorStatus,
         StatusCode = (int)statusCode
     });
 }
        public async Task <IActionResult> CreateSettings(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest());
            }
            ResultEnum result = await _service.CreateSetting(id);

            return(result == ResultEnum.Success ? (IActionResult)Ok() : BadRequest());
        }
        public async Task <IActionResult> UpdateProfile([FromBody] ProfileDto model, [FromRoute] string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest());
            }
            ResultEnum result = await _service.UpdateProfile(id, model.FirstName, model.MiddleName, model.LastName, model.Birthday);

            return(result == ResultEnum.Success ? (IActionResult)Ok(result) : BadRequest());
        }
        public async Task <IActionResult> UpdatePassword([FromBody] PasswordDto model, [FromRoute] string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest());
            }
            ResultEnum result = await _service.UpdatePassword(id, model.OldPassword, model.NewPassword, model.ConfirmPassword);

            return(result == ResultEnum.Success ? (IActionResult)Ok(result) : BadRequest());
        }
        public async Task <IActionResult> UpdateSettings([FromRoute] string id, [FromBody] Settings model)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest());
            }
            ResultEnum result = await _service.UpdateSettings(id, model.IsPrivateAccount, model.IsGetTicketInfo);

            return(result == ResultEnum.Success ? (IActionResult)Ok() : BadRequest());
        }
        public async Task <IActionResult> UpdateNotification([FromBody] Notifications notification, [FromRoute] string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest());
            }
            ResultEnum result = await _service.UpdateNotifications(id, notification);

            return(result == ResultEnum.Success ? (IActionResult)Ok(result) : BadRequest());
        }
Example #26
0
        public static ResultEnum Show(string title, string message, string leftButtonText = "Got it!", string rightButtonText = null)
        {
            var p = new DialogBox();

            p.SetContent(title, message, leftButtonText, rightButtonText);
            p.DialogHost.IsOpen = true;
            p.ShowDialog();
            Result = p._result;
            return(p._result);
        }
        public async Task <IActionResult> UpdateEmail([FromBody] string email, [FromRoute] string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest());
            }
            ResultEnum result = await _service.UpdateEmail(id, email);

            return(result == ResultEnum.Success ? (IActionResult)Ok(result) : BadRequest());
        }
        public async Task <IActionResult> UpdateVisibleInformation([FromBody] VisibleInfo visibleInfo, [FromRoute] string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest());
            }
            ResultEnum result = await _service.UpdateVisible(id, visibleInfo);

            return(result == ResultEnum.Success ? (IActionResult)Ok(result) : BadRequest());
        }
Example #29
0
        public MyGuiScreenMessageBox(
            MyMessageBoxStyleEnum styleEnum,
            MyMessageBoxButtonsType buttonType,
            StringBuilder messageText,
            StringBuilder messageCaption,
            MyStringId okButtonText,
            MyStringId cancelButtonText,
            MyStringId yesButtonText,
            MyStringId noButtonText,
            Action <ResultEnum> callback,
            int timeoutInMiliseconds,
            ResultEnum focusedResult,
            bool canHideOthers) :
            base(position: new Vector2(0.5f, 0.5f),
                 backgroundColor: null,
                 size: null,
                 isTopMostScreen: true,
                 backgroundTexture: null)
        {
            InstantClose = true;

            m_style         = m_styles[(int)styleEnum];
            m_focusedResult = focusedResult;

            m_backgroundColor   = Vector4.One;
            m_backgroundTexture = m_style.BackgroundTexture.Texture;

            EnabledBackgroundFade = true;

            m_buttonType           = buttonType;
            m_okButtonText         = okButtonText;
            m_cancelButtonText     = cancelButtonText;
            m_yesButtonText        = yesButtonText;
            m_noButtonText         = noButtonText;
            ResultCallback         = callback;
            m_drawEvenWithoutFocus = true;
            CanBeHidden            = false;
            CanHideOthers          = canHideOthers;

            // Size of the message box is given by its background.
            m_size = m_style.BackgroundTexture.SizeGui;

            m_messageText    = messageText;
            m_messageCaption = messageCaption ?? new StringBuilder();

            RecreateControls(true);

            if (buttonType == MyMessageBoxButtonsType.YES_NO_TIMEOUT || buttonType == MyMessageBoxButtonsType.NONE_TIMEOUT)
            {
                m_timeoutStartedTimeInMiliseconds = MyGuiManager.TotalTimeInMilliseconds;
                m_timeoutInMiliseconds            = timeoutInMiliseconds;
                m_formatText     = messageText.ToString();
                m_formattedCache = new StringBuilder(m_formatText.Length);
            }
        }
Example #30
0
 private void AllowReload(ResultEnum response)
 {
     if (response == ResultEnum.OK)
     {
         crashed = false;
     }
     else
     {
         crashed = true;
     }
 }
 private void ButtonSelected_Click(object sender, RoutedEventArgs e)
 {
   Result = ResultEnum.Selected;
   Close();
 }
 private void ButtonAll_Click(object sender, RoutedEventArgs e)
 {
   Result = ResultEnum.All;
   Close();
 }
 public WindowPromptSelectedAll()
 {
   InitializeComponent();
   Result = ResultEnum.Cancel;
 }
 protected void CallResultCallback(ResultEnum result)
 {
     if (m_resultCallback != null) m_resultCallback(result);
 }
 protected override void Canceling()
 {
     base.Canceling();
     m_screenResult = ResultEnum.CANCEL;
 }
 private void ConfirmRelinkResponse(ResultEnum result)
 {
     SendConfirmMessage(ConfirmCode, result == ResultEnum.OK, PlayerMarketManage.ConfirmRelink);
 }
 void CallResultCallback(ResultEnum val)
 {
     if (ResultCallback != null) ResultCallback(val);
 }
        public MyGuiScreenMessageBox(
            MyMessageBoxStyleEnum styleEnum,
            MyMessageBoxButtonsType buttonType,
            StringBuilder messageText,
            StringBuilder messageCaption,
            MyStringId okButtonText,
            MyStringId cancelButtonText,
            MyStringId yesButtonText,
            MyStringId noButtonText,
            Action<ResultEnum> callback,
            int timeoutInMiliseconds,
            ResultEnum focusedResult,
            bool canHideOthers):
            base(position: new Vector2(0.5f, 0.5f),
                 backgroundColor: null,
                 size: null,
                 isTopMostScreen: true,
                 backgroundTexture: null)
        {
            InstantClose = true;

            m_style = m_styles[(int)styleEnum];
            m_focusedResult = focusedResult;

            m_backgroundColor   = Vector4.One;
            m_backgroundTexture = m_style.BackgroundTexture.Texture;

            EnabledBackgroundFade = true;

            m_buttonType           = buttonType;
            m_okButtonText         = okButtonText;
            m_cancelButtonText     = cancelButtonText;
            m_yesButtonText        = yesButtonText;
            m_noButtonText         = noButtonText;
            ResultCallback         = callback;
            m_drawEvenWithoutFocus = true;
            CanBeHidden            = false;
            CanHideOthers = canHideOthers;

            // Size of the message box is given by its background.
            m_size = m_style.BackgroundTexture.SizeGui;

            m_messageText = messageText;
            m_messageCaption = messageCaption ?? new StringBuilder();

            RecreateControls(true);

            if (buttonType == MyMessageBoxButtonsType.YES_NO_TIMEOUT || buttonType == MyMessageBoxButtonsType.NONE_TIMEOUT)
            {
                m_timeoutStartedTimeInMiliseconds = MyGuiManager.TotalTimeInMilliseconds;
                m_timeoutInMiliseconds = timeoutInMiliseconds;
                m_formatText = messageText.ToString();
                m_formattedCache = new StringBuilder(m_formatText.Length);
            }
        }
 private void ButtonOverwite_Click(object sender, RoutedEventArgs e)
 {
   Result = ResultEnum.Overwrite;
   Close();
 }
 public void OnClosedTextBox(ResultEnum result)
 {
     if (m_textBox.Description.Text.Length > MAX_NUMBER_CHARACTERS)
     {
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                              styleEnum: MyMessageBoxStyleEnum.Info,
                              callback: OnClosedMessageBox,
                              buttonType: MyMessageBoxButtonsType.YES_NO,
                              messageText: MyTexts.Get(MyCommonTexts.MessageBoxTextTooLongText)));
     }
     else
     {
         CloseWindow(m_isEditingPublic);
     }
 }
Example #41
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public Result(ResultEnum result)
 {
     _optionalMessage = string.Empty;
     _optionalException = null;
     _value = result;
 }
 private void OnClick(ResultEnum result)
 {
     if (CloseBeforeCallback)
     {
         CloseInternal();
         CallResultCallback(result);
     }
     else
     {
         CallResultCallback(result);
         CloseInternal();
     }
 }
Example #43
0
 public KirkException(ResultEnum Result, string Message = "")
     : base(String.Format("KirkException: {0} : {1}", Result, Message))
 {
     this.Result = Result;
 }
        private void SaveCode(ResultEnum result)
        {
            MyGuiScreenGamePlay.ActiveGameplayScreen = MyGuiScreenGamePlay.TmpGameplayScreenHolder;
            MyGuiScreenGamePlay.TmpGameplayScreenHolder = null;
            SyncObject.SendCloseEditor();
            if (m_editorScreen.TextTooLong() == true)
            {
                var messageBox = MyGuiSandbox.CreateMessageBox(
                        messageCaption: MyTexts.Get(MySpaceTexts.ProgrammableBlock_CodeChanged),
                        messageText: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_TextTooLong),
                        buttonType: MyMessageBoxButtonsType.OK,
                        canHideOthers: false);
                MyScreenManager.AddScreen(messageBox);
                return;
            }

            DetailedInfo.Clear();
            RaisePropertiesChanged();
            if (result == ResultEnum.OK)
            {
                SaveCode();
            }
            else
            {
                string editorText = m_editorScreen.Description.Text.ToString();
                if (editorText != m_programData)
                {
                    var messageBox = MyGuiSandbox.CreateMessageBox(
                        messageCaption: MyTexts.Get(MySpaceTexts.ProgrammableBlock_CodeChanged),
                        messageText: MyTexts.Get(MySpaceTexts.ProgrammableBlock_SaveChanges),
                        buttonType: MyMessageBoxButtonsType.YES_NO,
                        canHideOthers: false);

                    messageBox.ResultCallback = delegate(MyGuiScreenMessageBox.ResultEnum result2)
                    {
                        if (result2 == MyGuiScreenMessageBox.ResultEnum.YES)
                        {
                            SaveCode(ResultEnum.OK);
                        }
                        else
                        {
                            m_editorData = m_programData;
                        }
                    };
                    MyScreenManager.AddScreen(messageBox);
                }
            }
        }
 void OkButtonClicked(MyGuiControlButton button)
 {
     m_screenResult = ResultEnum.OK;
     CloseScreen();
 }
Example #46
0
 public KirkException(ResultEnum Result)
 {
     this.Result = Result;
 }
 public WindowPromptAppendOverwrite()
 {
   InitializeComponent();
   Result = ResultEnum.Cancel;
 }