コード例 #1
0
 public void ClearUsersTextBox()
 {
     TextBoxName.Clear();
     TextBoxPassword.Clear();
     RadioAdmi.IsChecked = false;
     RadioUser.IsChecked = false;
 }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.accountId      = Common.GetEncryptedQueryStringValue("AccountId", 0);
            LabelPageTitle.Text = (this.accountId == 0) ? "New Account" : "Edit Account";

            Page.Form.DefaultFocus  = TextBoxName.ClientID;
            Page.Form.DefaultButton = ButtonSave.UniqueID;

            if (!IsPostBack)
            {
                TextBoxName.Focus();

                BindAccountType();
                BindAccountStatus();

                ButtonSave.Visible              = true;
                ButtonSaveNew.Visible           = true;
                ButtonAddAccountContact.Visible = false;

                if (ViewState["AccountId"] != null)
                {
                    this.accountId = Convert.ToInt32(ViewState["AccountId"].ToString());
                }
                if (this.accountId != 0)
                {
                    BindAccount();
                    ButtonAddAccountContact.Visible = true;
                    BindAccountContactGridView();
                }
            }
        }
コード例 #3
0
        // event handlers
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // make sure name and unit are not empty string
            if (string.IsNullOrWhiteSpace(TextBoxName.Text))
            {
                FlyoutWarmingText.Text = "Name cannot be empty!";
                FlyoutWarming.ShowAt(TextBoxName);
                args.Cancel = true;
                return;
            }
            if (ComboBoxCategory.SelectedIndex == -1)
            {
                FlyoutWarmingText.Text = "Category cannot be empty!";
                FlyoutWarming.ShowAt(ComboBoxCategory);
                args.Cancel = true;
                return;
            }
            if (ComboBoxUnit.SelectedIndex == -1)
            {
                FlyoutWarmingText.Text = "Unit cannot be empty!";
                FlyoutWarming.ShowAt(ComboBoxUnit);
                args.Cancel = true;
                return;
            }

            // perform real update
            TextBoxName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            ComboBoxCategory.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateSource();
            ComboBoxUnit.GetBindingExpression(ComboBox.SelectedValueProperty).UpdateSource();
            ImageThumbnail.GetBindingExpression(Image.SourceProperty).UpdateSource();
            this.ingredient.ThumbnailFilename = this.thumbnailFilename;
        }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);

        if (!IsPostBack)
        {
            DataRow dr = dbGetEvent(Request.QueryString["id"]);

            if (dr == null)
            {
                throw new Exception("The event was not found");
            }

            TextBoxStart.Text     = Convert.ToDateTime(dr["ReservationStart"]).ToShortDateString();
            TextBoxEnd.Text       = Convert.ToDateTime(dr["ReservationEnd"]).ToShortDateString();
            TextBoxStartTime.Text = dr["StartTime"] as string;
            TextBoxEndTime.Text   = dr["EndTime"] as string;
            TextBoxName.Text      = dr["ReservationName"] as string;
            TextBoxUser.Text      = dr["UserName"] as string;

            DropDownListRoom.DataSource     = dbGetResources();
            DropDownListRoom.DataTextField  = "RoomName";
            DropDownListRoom.DataValueField = "RoomId";
            DropDownListRoom.SelectedValue  = Convert.ToString(dr["RoomId"]);
            DropDownListRoom.DataBind();

            DropDownListStatus.SelectedValue = Convert.ToString(dr["ReservationStatus"]);
            DropDownListPaid.SelectedValue   = Convert.ToString(dr["ReservationPaid"]);
            TextBoxName.Focus();
        }
    }
コード例 #5
0
        bool IsValid()
        {
            bool isValid = true;

            if (string.IsNullOrEmpty(TextBoxName.Text.CleanText()))
            {
                isValid = false;
                SystemMessages sm = new SystemMessages(new Message()
                {
                    UserMessage = "Invalid Name", SystemMessage = "Please provide valid Name.", UserMessageType = MessageType.Error
                },
                                                       ButtonType.OkOnly);
                sm.Closed += new EventHandler(delegate(object sender, EventArgs e)
                {
                    TextBoxName.Focus();
                });
#if !SILVERLIGHT
                sm.Owner = Window.GetWindow(this);
#endif
                sm.ShowPopup();
                return(isValid);
            }

            return(isValid);
        }
コード例 #6
0
ファイル: Register.cs プロジェクト: psnwd/shop
        private void ButtonStepTwo_Click(object sender, EventArgs e)
        {
            if (!ValidateStepTwo())
            {
                MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxName.Focus();

                return;
            }

            try {
                if (!ValidateDocument())
                {
                    MessageBox.Show("CPF já cadastrado.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TextBoxName.Focus();

                    return;
                }
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TextBoxName.Focus();

                return;
            }

            Customer.Name     = TextBoxName.Text;
            Customer.Email    = TextBoxEmail.Text;
            Customer.Document = TextBoxDocument.Text;
            Customer.Phone    = TextBoxDocument.Text;

            PanelStepTwo.Visible   = false;
            PanelStepThree.Visible = true;

            AcceptButton = ButtonRegister;
        }
コード例 #7
0
 //Очистка текстбоксов
 private void ClearTextBoxes()
 {
     TextBoxSurname.Clear();
     TextBoxName.Clear();
     TextBoxPatronymic.Clear();
     TextBoxSalary.Clear();
 }
コード例 #8
0
 private void ClearControls()
 {
     TextBoxCode.Clear();
     TextBoxName.Clear();
     TextBoxCost.Clear();
     ComboBoxCategory.ResetText();
 }
コード例 #9
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            var messageQueue = SnackbarThree.MessageQueue;

            if (TextBoxName.Text == string.Empty)
            {
                TextBoxName.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Saisissez le nom"));
                return;
            }

            if (TextBoxInitialAmount.Text == string.Empty)
            {
                TextBoxInitialAmount.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Entrez la valeur initiale"));
                return;
            }

            string name         = TextBoxName.Text;
            Double initialValue = Double.Parse(TextBoxInitialAmount.Text, NumberStyles.Currency);

            control.SaveAccount(name, initialValue);
            LoadAccounts();

            TextBoxName.Text          = string.Empty;
            TextBoxInitialAmount.Text = string.Empty;
        }
コード例 #10
0
        private bool CheckedUser()
        {
            String strName = TextBoxName.Text.Trim();

            if (_strDic.Count > 0 && _strDic.ContainsKey(strName))
            {
                MessageBox.Show("用户名【" + strName + "】已经存在,请重新输入!", "操作提示");
                return(false);
            }

            if (!strName.Equals("260905"))
            {
                if (strName.Equals(string.Empty))
                {
                    TextBoxName.Clear();
                    TextBoxName.Focus();
                    MessageBox.Show("用户名不能为空!", "操作提示");
                    return(false);
                }
                else if (TextBoxPassword.Text.Trim().Equals(string.Empty))
                {
                    TextBoxPassword.Clear();
                    TextBoxPassword.Focus();
                    MessageBox.Show("密码不能为空!", "操作提示");
                    return(false);
                }
            }
            else
            {
                MessageBox.Show("不能创建该用户!", "操作提示");
                return(false);
            }
            return(true);
        }
コード例 #11
0
 private void ShowEditBox()
 {
     TextBoxName.Visibility = Windows.UI.Xaml.Visibility.Visible;
     PageTitle.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
     TextBoxName.Focus(Windows.UI.Xaml.FocusState.Programmatic);
     TextBoxName.SelectAll();
 }
コード例 #12
0
 //Updates the edited user
 private void UpdateButton_Click(object sender, RoutedEventArgs e)
 {
     if (CheckInput())
     {
         if (CheckForDuplicate())
         {
             NewUser();
             if (((User)ListBoxUsers.SelectedItem != null))
             {
                 ((User)ListBoxUsers.SelectedItem).Name  = TextBoxName.Text;
                 ((User)ListBoxUsers.SelectedItem).Email = TextBoxEmail.Text;
                 ListBoxUsers.Items.Remove(ListBoxUsers.SelectedItem);
             }
             else if (((User)ListBoxAdmins.SelectedItem != null))
             {
                 ((User)ListBoxAdmins.SelectedItem).Name  = TextBoxName.Text;
                 ((User)ListBoxAdmins.SelectedItem).Email = TextBoxEmail.Text;
                 ListBoxAdmins.Items.Remove(ListBoxAdmins.SelectedItem);
             }
             ButtonsDisabled();
             UpdateButton.IsEnabled     = false;
             ButtonCreateUser.IsEnabled = true;
             ListBoxUsers.IsEnabled     = true;
             ListBoxAdmins.IsEnabled    = true;
             TextBoxName.Clear();
             TextBoxEmail.Clear();
         }
     }
 }
コード例 #13
0
 private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
 {
     _dbReactor.AddUser(TextBoxName.Text.ToUpper(), TextBoxPassword.Text.ToUpper());
     lableAnswer.Content = $"User {TextBoxName.Text} created";
     TextBoxName.Clear();
     TextBoxPassword.Clear();
 }
コード例 #14
0
        private void ButtonFindOrAddPlayer_Click(object sender, RoutedEventArgs e)
        {
            string name = TextBoxName.Text;

            // Om empty vissa messagebox
            if (!string.IsNullOrEmpty(name))
            {
                Player getPlayer = dataHandeler.GetPlayerByName(name);


                // Om spelare finns skriv all info till listbox
                if (getPlayer != null)
                {
                    guiHandeler.GenerateListData(ref ListBoxStatsInfo, getPlayer, dataHandeler.GetPlayers());
                }
                else
                {
                    // Om ej finns skapa ny spelare
                    dataHandeler.AddNewPlayer(name);

                    // For Debug
                    WriteNamesAndLevelsToListBoxesForDebugPurpes();

                    MessageBox.Show("La till spelare " + name);
                }

                TextBoxName.Clear();
            }
            else
            {
                MessageBox.Show("Du angav inget namn!");
            }
        }
コード例 #15
0
 private void TextBoxName_GotFocus(object sender, RoutedEventArgs e)
 {
     if (TextBoxName.Text == "请输入姓名+学号")
     {
         TextBoxName.Clear();
     }
 }
コード例 #16
0
ファイル: Start.cs プロジェクト: psnwd/shop
        private void ButtonRegister_Click(object sender, EventArgs e)
        {
            if (!ValidateRegister())
            {
                MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxName.Focus();

                return;
            }

            Manager.Name     = TextBoxName.Text;
            Manager.Username = TextBoxUsername.Text;
            Manager.Password = TextBoxPassword.Text;
            Manager.Enabled  = true;

            Manager.CreatedAt = DateTime.Now;
            Manager.UpdatedAt = DateTime.Now;

            try {
                DAO.Managers.Add(Manager);

                MessageBox.Show("Bem-vindo a Prophet Shop, " + Manager.Name + "!", "", MessageBoxButtons.OK);

                Close();
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TextBoxUsername.Focus();

                return;
            }
        }
コード例 #17
0
ファイル: Edit.aspx.cs プロジェクト: 215520960/ICEPproject
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);

        dr = Db.LoadAppointment(Convert.ToInt32(Request.QueryString["id"]));

        if (dr == null)
        {
            throw new Exception("The requested time slot was not found");
        }

        if (!IsPostBack)
        {
            TextBoxStart.Text = Convert.ToDateTime(dr["AppointmentStart"]).ToString();
            TextBoxEnd.Text   = Convert.ToDateTime(dr["AppointmentEnd"]).ToString();
            TextBoxName.Text  = dr["AppointmentPatientName"] as string;
            DropDownListStatus.SelectedValue = (string)dr["AppointmentStatus"];

            DropDownListRoom.DataSource     = Db.LoadDoctors();
            DropDownListRoom.DataTextField  = "DoctorName";
            DropDownListRoom.DataValueField = "DoctorId";
            DropDownListRoom.SelectedValue  = Convert.ToString(dr["DoctorId"]);
            DropDownListRoom.DataBind();

            TextBoxName.Focus();
        }
    }
コード例 #18
0
        public AddElementWindow(string insertedId = "", bool addElement = true,
                                WarehouseItem warehouseItemToModify = null)
        {
            InitializeComponent();
            AddElement = addElement;

            if (!AddElement)
            {
                TextBoxCode.IsReadOnly = true;

                if (warehouseItemToModify == null)
                {
                    return;
                }
                TextBoxName.Text     = warehouseItemToModify.Name;
                TextBoxCode.Text     = warehouseItemToModify.Id;
                TextBoxPrice.Text    = warehouseItemToModify.Price.ToString("0.00");
                TextBoxQuantity.Text = warehouseItemToModify.Quantity.ToString();
                TextBoxName.Focus();
            }
            else
            {
                if (string.IsNullOrEmpty(insertedId))
                {
                    TextBoxCode.Focus();
                }
                else
                {
                    TextBoxCode.Text       = insertedId;
                    TextBoxCode.IsReadOnly = true;
                    TextBoxName.Focus();
                }
            }
        }
コード例 #19
0
ファイル: Index.xaml.cs プロジェクト: farseerrenhui/RHTools
        private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            int count = StackPanelContainer.Children.Count;

            if (e.Key == Key.Down && count > 0 && StackPanelContainer.Children[count - 1].IsFocused)
            {
                StackPanelContainer.Children[0].Focus();
                e.Handled = true;
            }
            else if (e.Key == Key.Up && count > 0 && StackPanelContainer.Children[0].IsFocused)
            {
                StackPanelContainer.Children[count - 1].Focus();
                e.Handled = true;
            }
            else if (e.Key == Key.Escape)
            {
                TextBoxName.Clear();
            }
            else if (e.Key == Key.Enter)
            {
                if (count == 1)
                {
                    IndexButton indexButton = StackPanelContainer.Children[0] as IndexButton;
                    indexButton.IndexButtonClick(indexButton, null);
                }
            }
            else if (e.Key != Key.Up && e.Key != Key.Down)
            {
                TextBoxName.Focus();
            }
        }
コード例 #20
0
        private async void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(TextBoxName.Text) || !string.IsNullOrWhiteSpace(Password.Password))
            {
                var metroWindow = (Window.GetWindow(this) as MetroWindow);
                try
                {
                    await _electionConfigurationService.SaveCommissionerAsync(new Commissioner
                    {
                        FullName    = TextBoxName.Text,
                        UserName    = Username.Text,
                        Password    = Password.Password,
                        IsChairman  = Convert.ToBoolean(IsChairman.IsChecked),
                        IsPresident = Convert.ToBoolean(IsPresident.IsChecked)
                    });

                    await metroWindow.ShowMessageAsync("Success !", $"{Username.Text} Successfully created");

                    Util.Clear(this);
                    TextBoxName.Focus();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                    await metroWindow.ShowMessageAsync("Wait !", "Something Went Wrong");
                }
            }
        }
コード例 #21
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            var messageQueue = SnackbarThree.MessageQueue;

            if (TextBoxName.Text == string.Empty)
            {
                TextBoxName.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe o nome"));
                return;
            }

            if (TextBoxValue.Text == string.Empty)
            {
                TextBoxValue.Focus();
                Task.Factory.StartNew(() => messageQueue.Enqueue("Informe o valor"));
                return;
            }

            string   name     = TextBoxName.Text;
            Double   value    = Double.Parse(TextBoxValue.Text, NumberStyles.Currency);
            DateTime deadline = DatePickerDeadline.SelectedDate ?? DateTime.Now;

            control.SaveGoal(name, value, deadline);
            LoadGoals();

            TextBoxName.Text        = string.Empty;
            TextBoxValue.Text       = string.Empty;
            DatePickerDeadline.Text = string.Empty;

            LoadBox();
        }
コード例 #22
0
 private void BtnCancel_Click(object sender, RoutedEventArgs e)
 {
     TextBoxName.Clear();
     TextBoxFamily.Clear();
     TextBoxThirdName.Clear();
     TextBoxAddress.Clear();
     TextBoxNumber.Clear();
 }
コード例 #23
0
 public void CLearFields()
 {
     TextBoxSurname.Clear();
     TextBoxName.Clear();
     MaskedTBPhone.Clear();
     TextBoxEmail.Clear();
     LabelNumber.Text = "";
 }
コード例 #24
0
 private void addWorkersToPlaces()
 {
     name       = TextBoxName.Text.ToString();
     department = TextBoxName.Text.ToString();
     TextBoxName.Clear();
     TextBoxDepartment.Clear();
     state = true;
 }
コード例 #25
0
 private void TextBoxName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         TextBoxName.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
         Keyboard.ClearFocus();
     }
 }
コード例 #26
0
        public void ButtonEdit_Click(object sender, EventArgs e)
        {
            if (ButtonEdit.Content.Equals("Edit")) // .Equals is required instead of ==
            {
                ButtonEdit.Background = brush2;
                ButtonEdit.Content    = "Save";
                // enable text boxes to be edited
                TextBoxName.IsReadOnly = false;
                TextBoxAge.IsReadOnly  = false;
                // change the colour of the textboxes while they are being edited
                TextBoxAge.Background  = (SolidColorBrush)Brushes.White;
                TextBoxName.Background = (SolidColorBrush)Brushes.White;
                // to keep the add button disabled
                ButtonAdd.IsEnabled = false;
                // to highlight the text of the rabbit name
                TextBoxName.Focus();
                TextBoxName.SelectAll();
            }
            else
            {
                ButtonEdit.Background = brush3;
                ButtonEdit.Content    = "Edit";
                if ((TextBoxAge.Text.Length > 0) && (TextBoxName.Text.Length > 0))
                {
                    // must have selected a rabbit
                    if (rabbit != null)
                    {
                        rabbit.Name = TextBoxName.Text;
                        if (int.TryParse(TextBoxAge.Text, out int age))
                        {
                            rabbit.AGE = age;
                        }

                        using (var db = new RabbitDbEntities())
                        {
                            // read rabbit from database by ID
                            var rabbitToUpdate = db.Rabbits.Find(rabbit.RabbitId);
                            // read rabbit
                            rabbitToUpdate.Name = rabbit.Name;
                            rabbitToUpdate.AGE  = rabbit.AGE;
                            // save rabbit back to db
                            db.SaveChanges();
                            // clear listbox because we're going to change (the binding)
                            rabbit = null; // remove the binding rabbit
                            // ListBoxRabbit.ItemsSource = null; // remove binding
                            //ListBoxRabbit.Items.Clear();    // clear it out
                            // repopulate listbox // re-read from db
                            rabbits = db.Rabbits.ToList();       // get rabbits
                            ListBoxRabbit.ItemsSource = rabbits; // bind to listbox again
                        }
                    }
                    //TextBoxAge.Text = "";
                    //TextBoxName.Text = "";
                    TextBoxAge.IsReadOnly  = true;
                    TextBoxName.IsReadOnly = true;
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// Verify that the user's account exists on the Unity Connection server and that they have administrator rights.  The login
        /// to CUPI for admins will fail otherwise.
        /// If the login goes through add the user information to the session variable - this doesn't get used for anything other than
        /// as verification that the currently logged in user is authenticated - the credentials have to be resent with each CUPI command
        /// regardless.  This just makes sure the user isn't getting cute and going directly to the user selection page.
        /// </summary>
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            ConnectionServerRest currentConnectionServer;

            //check for empty strings - yes, you can use ASP form control checks for these but then you have difficulty with the Java Script
            //method of enabling/disabling the login button on the client side so I do the checks manually here and just use a single status
            //label for feedback - not quite as slick but the trade off is worth it.
            if (string.IsNullOrEmpty(TextBoxServerName.Text.Trim()))
            {
                LabelStatus.Text = "You must provide a Connection server name";
                TextBoxServerName.Focus();
                return;
            }

            if (string.IsNullOrEmpty(TextBoxName.Text.Trim()))
            {
                LabelStatus.Text = "You must provide a login name";
                TextBoxName.Focus();
                return;
            }

            if (string.IsNullOrEmpty(TextBoxPassword.Text.Trim()))
            {
                LabelStatus.Text = "You must provide a password";
                TextBoxPassword.Focus();
                return;
            }

            LabelStatus.Text = "";

            try
            {
                currentConnectionServer = new ConnectionServerRest(new RestTransportFunctions(), TextBoxServerName.Text.Trim(), TextBoxName.Text.Trim(),
                                                                   TextBoxPassword.Text.Trim());
            }
            catch
            {
                LabelStatus.Text    = "Login failed, make sure the server name is valid, DNS is working properly and the user name and login are valid";
                ButtonLogin.Enabled = true;
                return;
            }

            //if the class creation failed but the server login still didn't complete (this should really never happen, but just in case)
            if (currentConnectionServer.ServerName.Length == 0)
            {
                //login failed = give the user the chance to try again.
                LabelStatus.Text    = "Login failed, make sure the server name is valid, DNS is working properly and the user name and login are valid";
                ButtonLogin.Enabled = true;
                return;
            }

            //stuff the current connection server object into the session state where we can pull it out later.  Then redirect to the select user
            //page which is where all the action takes place.
            Session["CurrentConnectionServer"] = currentConnectionServer;
            Response.Redirect("~/SelectUser.aspx");
        }
コード例 #28
0
 /// <summary>
 /// Clears the TextBoxes after they have been used.
 /// </summary>
 private void CRUDTextBoxClear()
 {
     TextBoxName.Clear();
     TextBoxYearOfBirth.Clear();
     TextBoxPlaceOfBirth.Clear();
     comboBoxMother.Items.Clear();
     comboBoxFather.Items.Clear();
     TextBoxYearOfDeath.Clear();
     TextBoxPlaceOfDeath.Clear();
 }
コード例 #29
0
ファイル: AddCentre.cs プロジェクト: ntokozo-shagala/SIMS
        private void metroTileEnter_Click(object sender, EventArgs e)
        {
            SimsOracle db   = new SimsOracle();
            int        rows = 0;

            if (TextBoxName.Text == "")
            {
                MessageBox.Show("You should enter centre name");
                TextBoxName.Focus();
            }
            else if (TextBoxAddress.Text == "")
            {
                MessageBox.Show("You should enter centre address");
                TextBoxAddress.Focus();
            }
            else if (TextBoxClasses.Text == "")
            {
                MessageBox.Show("You should enter number of classes");
                TextBoxClasses.Focus();
            }
            else if (!checkValue.isValidInteger(TextBoxClasses.Text))
            {
                MessageBox.Show("The number format is not valid");
                TextBoxClasses.Focus();
            }
            else
            {
                try
                {
                    string sql = "INSERT INTO CENTRE " +
                                 "(NAME, ADDRESS, CLASSES) " +
                                 " VALUES " +
                                 "(:NAME, :ADDRESS, :CLASSES)";
                    OracleCommand cmd = new OracleCommand(sql, db.Connection);
                    cmd.Parameters.Add("NAME", TextBoxName.Text);
                    cmd.Parameters.Add("ADDRESS", TextBoxAddress.Text);
                    cmd.Parameters.Add("CLASSES", TextBoxClasses.Text);

                    rows = cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error adding a centre:\n" + ex.Message.ToString());
                }
                if (rows > 0)
                {
                    MessageBox.Show("Centre added successfully");
                    ClearControls();
                }
                else
                {
                    MessageBox.Show("Centre was not added, there might have been unexpected error");
                }
            }
        }
コード例 #30
0
 private void InputTextDialog_Load(object sender, EventArgs e)
 {
     try
     {
         if (Path.HasExtension(TextBoxName.Text))
         {
             TextBoxName.Select(0, TextBoxName.Text.IndexOf(Path.GetExtension(TextBoxName.Text)));
         }
     }
     catch { }
 }