コード例 #1
0
        private void AddDataSupplier_Click(object sender, RoutedEventArgs e)
        {
            SupplierController CallSupplier = new SupplierController();


            if (SupplierNameTextBox.Text.Length == 0 && SupplierPhoneTextBox.Text.Length == 0 && SupplierAddressTextBox.Text.Length == 0)
            {
                SupplierNameErrorMessage.Text    = "You Must Enter Supplier Name!";
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierPhoneErrorMessage.Text   = "You Must Enter Supplier Phone Number!";
                SupplierNameTextBox.Focus();
                SupplierAddressTextBox.Focus();
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierNameTextBox.Text.Length == 0 && SupplierAddressTextBox.Text.Length == 0)
            {
                SupplierNameErrorMessage.Text    = "You Must Enter Supplier Name!";
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierNameTextBox.Focus();
                SupplierAddressTextBox.Focus();
            }
            else if (SupplierNameTextBox.Text.Length == 0 && SupplierPhoneTextBox.Text.Length == 0)
            {
                SupplierPhoneErrorMessage.Text = "You Must Enter Supplier Phone Number!";
                SupplierNameErrorMessage.Text  = "You Must Enter Supplier Name!";
                SupplierNameTextBox.Focus();
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierAddressTextBox.Text.Length == 0 && SupplierPhoneTextBox.Text.Length == 0)
            {
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierPhoneErrorMessage.Text   = "You Must Enter Supplier Phone Number!";
                SupplierAddressTextBox.Focus();
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierPhoneTextBox.Text.Length == 0)
            {
                SupplierPhoneErrorMessage.Text = "You Must Enter Supplier Phone Number!";
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierAddressTextBox.Text.Length == 0)
            {
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierAddressTextBox.Focus();
            }
            else if (SupplierNameTextBox.Text.Length == 0)
            {
                SupplierNameErrorMessage.Text = "You Must Enter Supplier Name!";
                SupplierNameTextBox.Focus();
            }
            else
            {
                string Sname    = SupplierNameTextBox.Text;
                string Saddress = SupplierAddressTextBox.Text;
                string Sphone   = SupplierPhoneTextBox.Text;

                CallSupplier.AddSupplier(Sname, Saddress, Sphone);
            }
        }
コード例 #2
0
        private void UpdateDataSupplier_Click(object sender, RoutedEventArgs e)
        {
            SupplierController CallSupplier = new SupplierController();

            if (SupplierNameTextBox.Text.Length == 0 && SupplierPhoneTextBox.Text.Length == 0 && SupplierAddressTextBox.Text.Length == 0)
            {
                SupplierNameErrorMessage.Text    = "You Must Enter Supplier Name!";
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierPhoneErrorMessage.Text   = "You Must Enter Supplier Phone Number!";
                SupplierNameTextBox.Focus();
                SupplierAddressTextBox.Focus();
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierNameTextBox.Text.Length == 0 && SupplierAddressTextBox.Text.Length == 0)
            {
                SupplierNameErrorMessage.Text    = "You Must Enter Supplier Name!";
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierNameTextBox.Focus();
                SupplierAddressTextBox.Focus();
            }
            else if (SupplierNameTextBox.Text.Length == 0 && SupplierPhoneTextBox.Text.Length == 0)
            {
                SupplierPhoneErrorMessage.Text = "You Must Enter Supplier Phone Number!";
                SupplierNameErrorMessage.Text  = "You Must Enter Supplier Name!";
                SupplierNameTextBox.Focus();
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierAddressTextBox.Text.Length == 0 && SupplierPhoneTextBox.Text.Length == 0)
            {
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierPhoneErrorMessage.Text   = "You Must Enter Supplier Phone Number!";
                SupplierAddressTextBox.Focus();
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierPhoneTextBox.Text.Length == 0)
            {
                SupplierPhoneErrorMessage.Text = "You Must Enter Supplier Phone Number!";
                SupplierPhoneTextBox.Focus();
            }
            else if (SupplierAddressTextBox.Text.Length == 0)
            {
                SupplierAddressErrorMessage.Text = "You Must Enter Supplier Address!";
                SupplierAddressTextBox.Focus();
            }
            else if (SupplierNameTextBox.Text.Length == 0)
            {
                SupplierNameErrorMessage.Text = "You Must Enter Supplier Name!";
                SupplierNameTextBox.Focus();
            }
            else
            {
                string Sname    = SupplierNameTextBox.Text;
                string Saddress = SupplierAddressTextBox.Text;
                string Sphone   = SupplierPhoneTextBox.Text;

                CallSupplier.UpdateSupplier(Convert.ToInt16((dataGridSupplier.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text), Sname, Saddress, Sphone);
            }
        }