Beispiel #1
0
        private void BtnBack_Click(object sender, EventArgs e)
        {
            frmMessageBoxBack frm = new frmMessageBoxBack();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                frmSearchStoreHouse fm = Owner as frmSearchStoreHouse;
                this.Close();
            }
        }
        private void BtnSearchStore_Click(object sender, EventArgs e)
        {
            panel3.Visible   = true;
            panel8.Visible   = true;
            panel6.Visible   = true;
            btnBrand.Visible = true;
            plStore.Visible  = false;

            btnTool.Visible     = true;
            btnMaterial.Visible = true;
            frmSearchStoreHouse fm = new frmSearchStoreHouse();

            // fm.FormClosed += new FormClosedEventHandler(ShowFormInitialCloseForms);
            OpenFormPanel(fm);
        }
Beispiel #3
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(txtId.Text))
     {
         frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
         frm.ShowDialog();
     }
     else
     {
         frmMessageBoxDelete frm = new frmMessageBoxDelete();
         if (frm.ShowDialog() == DialogResult.OK)
         {
             int id = int.Parse(txtId.Text);
             serviceDA.deleteStorehouse(id);
             frmSearchStoreHouse fm = Owner as frmSearchStoreHouse;
             fm.dgvSearch.AutoGenerateColumns = false;
             fm.dgvSearch.DataSource          = "";
             this.Close();
         }
     }
 }
Beispiel #4
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            {
                if (String.IsNullOrEmpty(txtNameStorehouse.Text) ||
                    String.IsNullOrEmpty(txtPhone.Text) || cboCity.SelectedIndex == -1 ||
                    String.IsNullOrEmpty(txtAddressStorehouse.Text))
                {
                    frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
                    frm.ShowDialog();
                }
                else
                {
                    if (flag == true)
                    {
                        if (String.IsNullOrEmpty(txtId.Text))
                        {
                            AlmacenDisecWS.storehouse store = new AlmacenDisecWS.storehouse();

                            frmMessageBoxSave frm = new frmMessageBoxSave();
                            if (frm.ShowDialog() == DialogResult.OK)
                            {
                                string name        = txtNameStorehouse.Text;
                                int    phoneNumber = int.Parse(txtPhone.Text);
                                string address     = txtAddressStorehouse.Text;
                                store.address         = address;
                                store.phone_number    = phoneNumber;
                                store.storehouse_name = name;
                                AlmacenDisecWS.city city = new AlmacenDisecWS.city();
                                city       = (AlmacenDisecWS.city)cboCity.SelectedItem;
                                store.city = city;
                                int result = serviceDA.insertStorehouse(store);
                            }
                            frmSearchStoreHouse fm = Owner as frmSearchStoreHouse;
                            fm.dgvSearch.AutoGenerateColumns = false;
                            fm.dgvSearch.DataSource          = "";

                            this.Close();
                        }
                        else
                        {
                            frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral();
                            frm2.ShowDialog();
                        }
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(txtNameStorehouse.Text) ||
                            String.IsNullOrEmpty(txtPhone.Text) || cboCity.SelectedIndex == -1 ||
                            String.IsNullOrEmpty(txtAddressStorehouse.Text))
                        {
                            frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull();
                            frm2.ShowDialog();
                        }
                        else
                        {
                            AlmacenDisecWS.storehouse store = new AlmacenDisecWS.storehouse();

                            frmMessageBoxSave frm = new frmMessageBoxSave();
                            if (frm.ShowDialog() == DialogResult.OK)
                            {
                                int    id          = int.Parse(txtId.Text);
                                string name        = txtNameStorehouse.Text;
                                int    phoneNumber = int.Parse(txtPhone.Text);
                                string address     = txtAddressStorehouse.Text;
                                store.id_storehouse   = id;
                                store.address         = address;
                                store.phone_number    = phoneNumber;
                                store.storehouse_name = name;
                                AlmacenDisecWS.city city = new AlmacenDisecWS.city();
                                city       = (AlmacenDisecWS.city)cboCity.SelectedItem;
                                store.city = city;
                                int result = serviceDA.updateStorehouse(store);
                            }
                        }
                        frmSearchStoreHouse fm = Owner as frmSearchStoreHouse;
                        fm.dgvSearch.AutoGenerateColumns = false;
                        fm.dgvSearch.DataSource          = "";

                        this.Close();
                    }
                }
            }
        }