Example #1
0
        private void add_button_Click(object sender, EventArgs e)
        {
            bool same = false;

            if ((firstNameTBox.Text != "" || lastNameTBox.Text != "") && addressTBox.Text != "" && phoneNumberTBox.Text != "" &&
                check_phone_number() == true)
            {
                supplier[] Supplier = mySQL.GetSupplierData();
                supplier   supp     = new supplier();

                string nameTmp = phoneNumberTBox.Text;

                for (int i = 0; i < Supplier.Length; i++)
                {
                    if (nameTmp == Supplier[i].Phone_number)
                    {
                        same = true;
                    }
                }

                if (same)
                {
                    MessageBox.Show("ספק קייםת ניתן לעדכן פרטיו");

                    update_supplier uSupplier = new update_supplier();
                    supp = mySQL.GetSupplierDataByPhone(phoneNumberTBox.Text);
                    uSupplier.firstNameTBox.Text   = supp.FirstName;
                    uSupplier.lastNameTBox.Text    = supp.LasttName;
                    uSupplier.addressTBox.Text     = supp.Address;
                    uSupplier.phoneNumberTBox.Text = supp.Phone_number;
                    uSupplier.deptTBox.Text        = supp.Dept.ToString();
                    uSupplier.paidTBox.Text        = supp.Paid.ToString();
                    uSupplier.ShowDialog();
                    this.Close();
                    uSupplier.Close();

                    th = new Thread(open_supManagment);
                    th.TrySetApartmentState(ApartmentState.STA);
                    th.Start();
                }
                else
                {
                    new_supplier(supp);

                    this.Close();
                    th = new Thread(open_supManagment);
                    th.TrySetApartmentState(ApartmentState.STA);
                    th.Start();
                }
            }
            else
            {
                MessageBox.Show("קלט לא תקין:נא לבדוק תקינות נתונים בשדות");
            }
        }
Example #2
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            update_supplier uSupplier = new update_supplier();

            uSupplier.firstNameTBox.Text   = suppliers_grid.CurrentRow.Cells[0].Value.ToString();
            uSupplier.lastNameTBox.Text    = suppliers_grid.CurrentRow.Cells[1].Value.ToString();
            uSupplier.addressTBox.Text     = suppliers_grid.CurrentRow.Cells[3].Value.ToString();
            uSupplier.phoneNumberTBox.Text = suppliers_grid.CurrentRow.Cells[2].Value.ToString();
            uSupplier.deptTBox.Text        = suppliers_grid.CurrentRow.Cells[5].Value.ToString();
            uSupplier.paidTBox.Text        = suppliers_grid.CurrentRow.Cells[4].Value.ToString();
            uSupplier.ShowDialog();

            this.Close();
            th = new Thread(openSelf);
            th.TrySetApartmentState(ApartmentState.STA);
            th.Start();
        }