Ejemplo n.º 1
0
        public frmTool()
        {
            InitializeComponent();
            serviceDA = new AlmacenDisecWS.DBControllerWSClient();

            listWayToPay.Add("CRÉDITO");
            listWayToPay.Add("CONTADO");

            cboWayofPay.DataSource    = listWayToPay;
            cboWayofPay.SelectedIndex = -1;

            cboBrand.DataSource    = serviceDA.queryAllBrand();
            cboBrand.DisplayMember = "brand_name";
            cboBrand.ValueMember   = "brand_id";


            cboCategory.DataSource    = serviceDA.queryAllCategory();
            cboCategory.DisplayMember = "category_name";
            cboCategory.ValueMember   = "category_id";

            //AlmacenDisecWS.category c = (AlmacenDisecWS.category)cboCategory.SelectedItem;
            //cboFamily.DisplayMember = "name_family";
            //cboFamily.ValueMember = "id_family";
            //cboFamily.DataSource = serviceDA.queryAllFamily(c.category_id);
            //cboFamily.SelectedValue = -1;

            cboSupplier.DataSource    = serviceDA.queryAllSupplier();
            cboSupplier.DisplayMember = "supplier_name";
            cboSupplier.ValueMember   = "id_supplier";

            cboStorehouse.DataSource    = serviceDA.queryAllStorehouse();
            cboStorehouse.DisplayMember = "storehouse_name";
            cboStorehouse.ValueMember   = "id_storehouse";


            cboMoney.DataSource = userTypes;

            txtCode.Enabled   = false;
            txtId.Enabled     = false;
            btnDelete.Enabled = false;
            btnDataG.Enabled  = true;
            btnCancel.Enabled = true;

            cboBrand.SelectedValue      = -1;
            cboCategory.SelectedValue   = -1;
            cboSupplier.SelectedValue   = -1;
            cboFamily.SelectedValue     = -1;
            cboStorehouse.SelectedValue = -1;
            cboMoney.SelectedIndex      = -1;

            txtName.CharacterCasing = CharacterCasing.Upper;
        }
Ejemplo n.º 2
0
        public frmMaterial()
        {
            InitializeComponent();
            //txtCode.Enabled = false;
            // Bitmap img = new Bitmap(Application.StartupPath+@"\img\fondo.jpg");
            // this.BackgroundImage = img;
            // this.BackgroundImageLayout = ImageLayout.Stretch;
            serviceDA = new AlmacenDisecWS.DBControllerWSClient();
            listas.Add("SOLES");
            listas.Add("DOLARES");

            cboBrand.DataSource    = serviceDA.queryAllBrand();
            cboBrand.DisplayMember = "brand_name";
            cboBrand.ValueMember   = "brand_id";



            cboUnit.DataSource    = serviceDA.queryAllMeasurement_Unit();
            cboUnit.DisplayMember = "abbrevation_measure_unit";
            cboUnit.ValueMember   = "id_measure_unit";


            cboMoney.DataSource = listas;

            cboCategory.DataSource    = serviceDA.queryAllCategory();
            cboCategory.DisplayMember = "category_name";
            cboCategory.ValueMember   = "category_id";

            cboSupplier.DataSource    = serviceDA.queryAllSupplier();
            cboSupplier.DisplayMember = "supplier_name";
            cboSupplier.ValueMember   = "id_supplier";

            cboBrand.DataSource    = serviceDA.queryAllBrand();
            cboBrand.DisplayMember = "brand_name";
            cboBrand.ValueMember   = "brand_id";

            cboBrand.SelectedIndex    = -1;
            cboCategory.SelectedIndex = -1;
            cboFamily.SelectedIndex   = -1;
            cboUnit.SelectedIndex     = -1;
            cboStatus.SelectedIndex   = -1;
            cboSupplier.SelectedIndex = -1;
            cboMoney.SelectedIndex    = -1;
            txtCode.Enabled           = false;
            btnDelete.Enabled         = false;
            txtName.CharacterCasing   = CharacterCasing.Upper;
        }
        private void btnSearch_Click_1(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtSearch.Text))
            {
                list.Clear();
                int cont = 0;
                AlmacenDisecWS.supplier[] a = new AlmacenDisecWS.supplier[100];

                a    = serviceDA.queryAllSupplier();
                cont = a.Count();
                for (int i = 0; i < cont; i++)
                {
                    Supplier s = new Supplier();
                    //     s = (Supplier)a[i];
                    s.id_supplier    = a[i].id_supplier;
                    s.supplier_name  = a[i].supplier_name;
                    s.city.id_city   = a[i].city.id_city;
                    s.city.name_city = a[i].city.name_city;
                    s.email          = a[i].email;
                    s.ruc            = a[i].ruc;
                    s.phone_number   = a[i].phone_number;
                    s.adress         = a[i].adress;
                    list.Add(s);
                }


                /*  s2.supplier_name = a[1].supplier_name;
                 * s2.city.id_city = a[1].city.id_city;
                 * s2.city.name_city = a[1].city.name_city;
                 * s3.supplier_name = a[2].supplier_name;
                 * s3.city.id_city = a[2].city.id_city;
                 * s3.city.name_city = a[2].city.name_city;
                 *
                 * s2.email = a[1].email;
                 * s2.ruc = a[1].ruc;
                 * s2.phone_number = a[1].phone_number;
                 * s2.adress = a[1].adress;
                 * s3.email = a[2].email;
                 * s3.ruc = a[2].ruc;
                 * s3.phone_number = a[2].phone_number;
                 * s3.adress = a[2].adress;
                 *
                 *
                 *
                 *
                 * list.Add(s2);
                 * list.Add(s3);*/

                btnModify.Enabled             = true;
                dgvSearch.AutoGenerateColumns = false;
                dgvSearch.DataSource          = list;
            }
            else
            {
                BindingList <Supplier>  list2 = new BindingList <Supplier>();
                AlmacenDisecWS.supplier s     = new AlmacenDisecWS.supplier();
                String name = txtSearch.Text;

                s = serviceDA.querySupplierByName(name);
                if (s.id_supplier == 0)
                {
                    frmMessageBoxSearchNull frm = new frmMessageBoxSearchNull();
                    frm.ShowDialog();
                }
                else
                {
                    Supplier s2 = new Supplier();

                    s2.id_supplier = s.id_supplier;

                    s2.supplier_name              = s.supplier_name;
                    s2.city.id_city               = s.city.id_city;
                    s2.city.name_city             = s.city.name_city;
                    s2.email                      = s.email;
                    s2.ruc                        = s.ruc;
                    s2.phone_number               = s.phone_number;
                    s2.adress                     = s.adress;
                    dgvSearch.AutoGenerateColumns = false;
                    list2.Add(s2);
                    dgvSearch.DataSource = list2;
                    btnModify.Enabled    = true;
                }

                //Insertar el codigo de busqueda por nombre
            }
        }