Beispiel #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     {
         if (flag == true)
         {
             if (String.IsNullOrEmpty(txtCost.Text) || String.IsNullOrEmpty(txtP.Text) || cboDestino.SelectedIndex == -1 ||
                 cboDriver.SelectedIndex == -1 || cboOrigen.SelectedIndex == -1)
             {
                 frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
                 frm.ShowDialog();
             }
             else
             {
                 if (String.IsNullOrEmpty(txtId.Text))
                 {
                     frmMessageBoxSave frm = new frmMessageBoxSave();
                     if (frm.ShowDialog() == DialogResult.OK)
                     {
                         //  String name = txtName.Text;
                         //Category cat = new category(name,1);
                         //Se llama al insert
                         reiniciar();
                     }
                 }
                 else
                 {
                     frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral();
                     frm2.ShowDialog();
                 }
             }
         }
         else
         {
             if ((String.IsNullOrEmpty(txtId.Text)))
             {
                 frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull();
                 frm2.ShowDialog();
             }
             else
             {
                 frmMessageBoxSave frm = new frmMessageBoxSave();
                 if (frm.ShowDialog() == DialogResult.OK)
                 {
                     //  int id = Int32.Parse(txtId.Text);
                     //    String name = txtName.Text;
                     //  Category cat = (Category)cboCategory.SelectedIndex;
                     //Category cat = new category(name,0);
                     //Se llama al update
                     reiniciar();
                 }
             }
         }
     }
 }
Beispiel #2
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            {
                if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtSerie.Text) || String.IsNullOrEmpty(txtPrice.Text) ||
                    cboBrand.SelectedIndex == -1 || cboCategory.SelectedIndex == -1 || cboFamily.SelectedIndex == -1 ||
                    cboSupplier.SelectedIndex == -1 || cboMoney.SelectedIndex == -1)
                {
                    frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
                    frm.ShowDialog();
                }
                else
                {
                    if (flag == 2)
                    {
                        if (String.IsNullOrEmpty(txtCode.Text))
                        {
                            frmMessageBoxSave frm = new frmMessageBoxSave();
                            if (frm.ShowDialog() == DialogResult.OK)
                            {
                                String name = txtName.Text;
                                //Category cat = new category(name,1);
                                //Se llama al insert

                                frmMessageBoxAdd frm2 = new frmMessageBoxAdd();
                                if (frm2.ShowDialog() == DialogResult.OK)
                                {
                                    txtCode.Clear();
                                    txtSerie.Clear();
                                    //cboStatus.SelectedIndex = -1;
                                }
                                else
                                {
                                    reiniciar();
                                }
                            }
                        }
                    }
                    else
                    {
                        if (flag == 0)
                        {
                            if (String.IsNullOrEmpty(txtCode.Text))
                            {
                                frmMessageBoxNew frm2 = new frmMessageBoxNew();
                                frm2.ShowDialog();
                            }
                            else
                            {
                                frmMessageBoxSave frm = new frmMessageBoxSave();
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    //  int id = Int32.Parse(txtId.Text);
                                    String name = txtName.Text;
                                    //  Category cat = (Category)cboCategory.SelectedIndex;
                                    //Category cat = new category(name,0);
                                    //Se llama al update
                                    reiniciar();
                                }
                            }
                        }
                        else
                        {
                            if (flag == 1)
                            {
                                frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral();
                                frm2.ShowDialog();
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            {
                if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtMinQuantity.Text) || String.IsNullOrEmpty(txtSerie.Text) ||
                    String.IsNullOrEmpty(txtPrice.Text) || cboBrand.SelectedIndex == -1 || cboCategory.SelectedIndex == -1 ||
                    cboFamily.SelectedIndex == -1 || cboUnit.SelectedIndex == -1 || cboStatus.SelectedIndex == -1 ||
                    cboSupplier.SelectedIndex == -1 || cboMoney.SelectedIndex == -1)
                {
                    frmMessageBoxFillNull frm = new frmMessageBoxFillNull();
                    frm.ShowDialog();
                }
                else
                {
                    if (flag == 2)
                    {
                        if (String.IsNullOrEmpty(txtCode.Text))
                        {
                            frmMessageBoxSave frm = new frmMessageBoxSave();
                            if (frm.ShowDialog() == DialogResult.OK)
                            {
                                String name = txtName.Text;
                                //Category cat = new category(name,1);
                                //Se llama al insert

                                frmMessageBoxAdd frm2 = new frmMessageBoxAdd();
                                if (frm2.ShowDialog() == DialogResult.OK)
                                {
                                    int id_c = 0;
                                    AlmacenDisecWS.materialDetail detail = new AlmacenDisecWS.materialDetail();
                                    AlmacenDisecWS.material       m      = new AlmacenDisecWS.material();
                                    AlmacenDisecWS.category       c      = new AlmacenDisecWS.category();
                                    detail.measure        = (AlmacenDisecWS.measureUnit)cboUnit.SelectedItem;
                                    detail.serie_material = txtSerie.Text;
                                    m.min_quantity        = Int32.Parse(txtMinQuantity.Text);
                                    m.brand  = (AlmacenDisecWS.brand)cboUnit.SelectedItem;
                                    m.family = (AlmacenDisecWS.family)cboFamily.SelectedItem;
                                    c        = (AlmacenDisecWS.category)cboCategory.SelectedItem;
                                    /// m.supplier = (AlmacenDisecWS.supplier)cbosupplier.SelectedItem
                                    m.price     = Double.Parse(txtPrice.Text);
                                    m.name_item = txtName.Text;
                                    //     m.material_details.  = detail;

                                    if (cboMoney.SelectedItem.ToString() == "SOLES")
                                    {
                                        id_c = 1;
                                    }
                                    else
                                    {
                                        if (cboMoney.SelectedItem.ToString() == "DOLARES")
                                        {
                                            id_c = 2;
                                        }
                                    }

                                    m.family.category.category_id   = c.category_id;
                                    m.family.category.category_name = c.category_name;

                                    //  int result = serviceDA.insertMaterial(m,id_c) ;
                                    txtCode.Clear();
                                    txtSerie.Clear();
                                    cboStatus.SelectedIndex = -1;
                                }
                                else
                                {
                                    reiniciar();
                                }
                            }
                        }
                    }
                    else
                    {
                        if (flag == 0)
                        {
                            if (String.IsNullOrEmpty(txtCode.Text))
                            {
                                frmMessageBoxNew frm2 = new frmMessageBoxNew();
                                frm2.ShowDialog();
                            }
                            else
                            {
                                frmMessageBoxSave frm = new frmMessageBoxSave();
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    //  int id = Int32.Parse(txtId.Text);
                                    String name = txtName.Text;
                                    //  Category cat = (Category)cboCategory.SelectedIndex;
                                    //Category cat = new category(name,0);
                                    //Se llama al update
                                    reiniciar();
                                }
                            }
                        }
                        else
                        {
                            if (flag == 1)
                            {
                                frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral();
                                frm2.ShowDialog();
                            }
                        }
                    }
                }
            }
        }
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();
                    }
                }
            }
        }