protected void ModalUpdate_OnClick(object sender, EventArgs e)
    {
        try
        {
            string course = Modal.Text.Trim();
            if (course.Equals(""))
            {
                throw new Exception("Course is required");
            }
            if (course.Length > 500 || course.Length <= 0)
            {
                throw new Exception("Course length must be between 1 and 500 characters");
            }

            if (ConnectToSql(0, "Update"))
            {
                MessageBox1.Add(
                    "Sucessfully Updated the Course: [" + Modal.Text + "] of type [" + ModalType.SelectedItem.Text + @"].",
                    MessageStatus.Success);
            }
        }
        catch (Exception exception)
        {
            ModalMessageBox.Add(exception.Message, MessageStatus.Error);
            ScriptManager.RegisterStartupScript(this, GetType(), "onrowcommandscript1", @"
            var obj = document.getElementById('" + Modal.ClientID + "'); " + "taCount(obj,'ModalCounter', 500);", true);
            ScriptManager.RegisterStartupScript(this, GetType(), "onrowcommandscript2", "$('#Modal').modal({backdrop: 'static', keyboard: false}).modal('show');", true);
        }

        ConnectToSql(0, "Form");
        BindControls("Form");
    }
示例#2
0
        private void ResetRequested(RequestResetOrderMessage obj)
        {
            var confirmationDialog = new ModalMessageBox();

            confirmationDialog.Message = Properties.Resources.ORDER_RESET_CONFIRMATION;
            confirmationDialog.Title   = Properties.Resources.ORDER_RESET_TITLE;
            confirmationDialog.Owner   = this;
            var result = confirmationDialog.ShowDialog();

            this.messenger.Send(new RestOrderConfirmationMessage(result.HasValue && result.Value));
        }
示例#3
0
        /// <summary>
        /// Display a simple error message box
        /// </summary>
        /// <param name="msg">The message text</param>
        public static void DisplayErrorMessage(string msg)
        {
            var msgBox = new ModalMessageBox();

            msgBox.Caption = Resources.Status;
            msgBox.Title   = "Validation Errors";
            msgBox.Message = msg;
            msgBox.Buttons = MessageBoxButtons.OK;
            DialogResult result = msgBox.ShowDialog();

            msgBox.Dispose();
        }
示例#4
0
    public void ShowMessageBox(string text, UnityAction callBack = null)
    {
        if (ModalPanel == null)
        {
            return;
        }

        //disableControl();
        GameObject gO = Instantiate <GameObject>(ModalPanel);

        gO.GetComponent <RectTransform>().SetParent(GetCurrentCanvas().transform, false);
        ModalMessageBox msgBox = gO.GetComponent <ModalMessageBox>();

        msgBox.SetCloseEvent(callBack);
        msgBox.Initialize();
        msgBox.Show(text, true);
    }
示例#5
0
        /// <summary>
        /// Display a simple confirmation dialog box
        /// </summary>
        /// <param name="msgIn">The text message to display </param>
        /// <returns>true = Proceed | false = Abort</returns>
        public static bool Confirmation(string caption, string title, string msgIn)
        {
            var message = String.Format("{0}{3}{3}{1}{3}{2}",
                                        msgIn,
                                        Resources.PressOKToProceed,
                                        Resources.PressCancelToAbort,
                                        Environment.NewLine);
            var msgBox = new ModalMessageBox();

            msgBox.Caption = caption;
            msgBox.Title   = title;
            msgBox.Message = message;
            msgBox.Buttons = MessageBoxButtons.OKCancel;
            DialogResult result = msgBox.ShowDialog();

            msgBox.Dispose();
            return(result != DialogResult.Cancel);
        }
 protected void ModalInsertAndAddSection_OnClick(object sender, EventArgs e)
 {
     try
     {
         ModalInsert_OnClick(sender, e);
         var linq = _ds.Tables[0].AsEnumerable()
                    .OrderByDescending(x => x.Field <DateTimeOffset>("DateCreated"))
                    .Select(x => x.Field <int>("CourseId"))
                    .First();
         gvCourses_OnRowCommand_LoadSection(linq, true);
     }
     catch (Exception exception)
     {
         ModalMessageBox.Add(exception.Message, MessageStatus.Error);
         ScriptManager.RegisterStartupScript(this, GetType(), "onrowcommandscript1", @"
         var obj = document.getElementById('" + Modal.ClientID + "'); " + "taCount(obj,'ModalCounter', 500);", true);
         ScriptManager.RegisterStartupScript(this, GetType(), "onrowcommandscript2", "$('#Modal').modal({backdrop: 'static', keyboard: false}).modal('show');", true);
     }
 }
示例#7
0
    public void ShowYesNoMessageBox(string text, UnityAction yesAction, UnityAction noAction, UnityAction callBack = null)
    {
        if (ModalPanel == null)
        {
            return;
        }

        //disableControl();
        GameObject gO = Instantiate <GameObject>(ModalPanel);

        gO.GetComponent <RectTransform>().SetParent(GetCurrentCanvas().transform, false);
        ModalMessageBox msgBox = gO.GetComponent <ModalMessageBox>();

        msgBox.SetCloseEvent(callBack);
        msgBox.Initialize();

        msgBox.AddDialogOption(LocalizationManager.Instance.GetLocalizedValue("Yes"), yesAction);
        msgBox.AddDialogOption(LocalizationManager.Instance.GetLocalizedValue("No"), noAction);
        msgBox.Show(text, true);
    }
    protected void ModalDelete_OnClick(object sender, EventArgs e)
    {
        try
        {
            if (ConnectToSql(0, "Delete"))
            {
                MessageBox1.Add(
                    "Sucessfully Deleted the Course: [" + Modal.Text + "] of type [" + ModalType.SelectedItem.Text + "]",
                    MessageStatus.Success);
            }
        }
        catch (Exception exception)
        {
            ModalMessageBox.Add(exception.Message, MessageStatus.Error);
            ScriptManager.RegisterStartupScript(this, GetType(), "onrowcommandscript1", @"
            var obj = document.getElementById('" + Modal.ClientID + "'); " + "taCount(obj,'ModalCounter', 500);", true);
            ScriptManager.RegisterStartupScript(this, GetType(), "onrowcommandscript2", "$('#Modal').modal({backdrop: 'static', keyboard: false}).modal('show');", true);
        }

        ConnectToSql(0, "Form");
        BindControls("Form");
    }
示例#9
0
    public void ShowMessageBoxWithOptions(string text, params LocalizedMessageOption[] actions)
    {
        if (ModalPanel == null)
        {
            return;
        }

        //disableControl();
        GameObject gO = Instantiate <GameObject>(ModalPanel);

        gO.GetComponent <RectTransform>().SetParent(GetCurrentCanvas().transform, false);
        ModalMessageBox msgBox = gO.GetComponent <ModalMessageBox>();

        msgBox.SetCloseEvent(null);
        msgBox.Initialize();

        foreach (var action in actions)
        {
            msgBox.AddDialogOption(LocalizationManager.Instance.GetLocalizedValue(action.LocalizedValueTag), action.actionToPerform);
        }

        msgBox.Show(text, true);
    }