Пример #1
0
        private void txtBusqueda_TextChanged(object sender, EventArgs e)
        {
            String Descripcion = txtBusqueda.Text;

            if (TipoComponente == "Familia")
            {
                //Buscamos Familia
                var obj = BDcomponentes.List.OfType <cFamilia>().ToList().Find(f => f.Descripcion == Descripcion);
                var pos = BDcomponentes.IndexOf(obj);
                BDcomponentes.Position = pos;
            }
            else if (TipoComponente == "Marca")
            {
                //Buscamos Marca
                var obj = BDcomponentes.List.OfType <cMarca>().ToList().Find(f => f.Descripcion == Descripcion);
                var pos = BDcomponentes.IndexOf(obj);
                BDcomponentes.Position = pos;
            }
            else if (TipoComponente == "UnidadEntrada")
            {
                //Buscamos Unidad Entrada
                var obj = BDcomponentes.List.OfType <cUnidadInventario>().ToList().Find(f => f.Descripcion == Descripcion);
                var pos = BDcomponentes.IndexOf(obj);
                BDcomponentes.Position = pos;
            }
            else if (TipoComponente == "UnidadSalida")
            {
                //Buscamos Unidad Salida
                var obj = BDcomponentes.List.OfType <cUnidadInventario>().ToList().Find(f => f.Descripcion == Descripcion);
                var pos = BDcomponentes.IndexOf(obj);
                BDcomponentes.Position = pos;
            }
        }
Пример #2
0
        private void buttonItem14_Click(object sender, EventArgs e)
        {
            BindingSource BDMarca = new BindingSource();

            BDMarca.DataSource = ObjetoMarca.Listar();

            //Realizamos la busqueda deendiendo del critrio
            dgvMarca.AutoGenerateColumns = false;
            dgvMarca.DataSource          = BDMarca;

            //Busqueda por codigo
            if (cbCriterio.SelectedItem.ToString() == "Codigo")
            {
                int Codigo = Convert.ToInt32(txtBusqueda.Text);
                var obj    = BDMarca.List.OfType <cMarca>().ToList().Find(f => f.Codigo == Codigo);
                var pos    = BDMarca.IndexOf(obj);
                BDMarca.Position = pos;
            }

            //Busqueda por Descripcion
            if (cbCriterio.SelectedItem.ToString() == "Descripcion")
            {
                string Descripcion = txtBusqueda.Text;
                var    obj         = BDMarca.List.OfType <cMarca>().ToList().Find(f => f.Descripcion == Descripcion);
                var    pos         = BDMarca.IndexOf(obj);
                BDMarca.Position = pos;
            }
        }
Пример #3
0
 private void OnErrOrder(object sender, ErrOrderArgs e)
 {
     this.Invoke(new Action(() =>
     {
         if (_bsOrder.IndexOf(e.Value) < 0)
         {
             _bsOrder.Add(e.Value);
         }
     }));
 }
Пример #4
0
 public void updateRecListCell(RecInfo ri)
 {
     formAction(() => {
         var i = recListDataSource.IndexOf(ri);
         if (i == -1)
         {
             return;
         }
         var cellNum = recList.Columns.Count;
         for (var j = 0; j < cellNum; j++)
         {
             recList.UpdateCellValue(j, i);
         }
     });
 }
Пример #5
0
        public void AddQuery(QueryParameters parameters)
        {
            CheckQueryParametersForAddOrReplace(parameters);

            if (_queryList.FirstOrDefault(x => x.Name == parameters.Name) != null)
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
                                                          "A query with name '{0}' already exists.", parameters.Name));
            }

            _queryList.Add(parameters);
            _queryList.Sort();
            _queryBindingSource.ResetBindings(false);
            _queryBindingSource.Position = _queryBindingSource.IndexOf(parameters);
        }
Пример #6
0
        public static int fncBuscaIndexCabAlb(BindingSource bS, string vAlb)
        {
            int vReg = 0;

            if (bS.SupportsSearching)
            {
                vReg = bS.Find("NumAlb", vAlb);
            }
            else
            {
                List <cAlbaranesCompra.CabAlbCompra> lista = (List <cAlbaranesCompra.CabAlbCompra>)bS.List;

                cAlbaranesCompra.CabAlbCompra result = lista.Find(
                    delegate(cAlbaranesCompra.CabAlbCompra bus)
                {
                    return(bus.NumAlb == vAlb);
                }
                    );


                if (result != null)
                {
                    vReg = bS.IndexOf(result);
                }
            }

            return(vReg);
        }
Пример #7
0
        public static int fncBuscaIndexOF(BindingSource bS, string vOF)
        {
            int vReg = 0;

            if (bS.SupportsSearching)
            {
                vReg = bS.Find("IdOF", vOF);
            }
            else
            {
                List <OF> lista = (List <OF>)bS.List;

                OF result = lista.Find(
                    delegate(OF bus)
                {
                    return(bus.IdOF == vOF);
                }
                    );


                if (result != null)
                {
                    vReg = bS.IndexOf(result);
                }
            }

            return(vReg);
        }
Пример #8
0
        /// <summary>
        /// Обработчикс события
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EventHandler_TreeViewNetwork_AfterSelect(
            object sender, TreeViewEventArgs e)
        {
            Device   device;
            TreeView control = (TreeView)sender;

            if ((e.Action == TreeViewAction.ByKeyboard) ||
                (e.Action == TreeViewAction.ByMouse) ||
                (e.Action == TreeViewAction.Unknown))
            {
                if (e.Node.Equals(control.TopNode))
                {
                    _TabControlDeviceProperties.Visible = false;
                }
                else if (e.Node.Tag is Device)
                {
                    device = e.Node.Tag as Device;
                    _TabControlDeviceProperties.Visible = true;

                    _TabControlDeviceProperties.Enabled = true;
                    _BindingSourceDevices.Position      =
                        _BindingSourceDevices.IndexOf(device);
                    //Object obj = _DataGridViewHoldingRegisters.DataSource;
                }
                else
                {
                    _TabControlDeviceProperties.Enabled = false;
                }
            }
            return;
        }
Пример #9
0
        public static int fncBuscaIndexCabPed(BindingSource bS, string vProy)
        {
            int vReg = 0;

            if (bS.SupportsSearching)
            {
                vReg = bS.Find("NumPed", vProy);
            }
            else
            {
                List <cPedidosCompra.CabCompra> lista = (List <cPedidosCompra.CabCompra>)bS.List;

                cPedidosCompra.CabCompra result = lista.Find(
                    delegate(cPedidosCompra.CabCompra bus)
                {
                    return(bus.NumPed == vProy);
                }
                    );


                if (result != null)
                {
                    vReg = bS.IndexOf(result);
                }
            }

            return(vReg);
        }
Пример #10
0
        public static int fncBuscaIndexCabPrep(BindingSource bS, string vProy)
        {
            int vReg = 0;

            if (bS.SupportsSearching)
            {
                vReg = bS.Find("NumPrep", vProy);
            }
            else
            {
                List <cEntregas.CabPrepEntrega> lista = (List <cEntregas.CabPrepEntrega>)bS.List;

                cEntregas.CabPrepEntrega result = lista.Find(
                    delegate(cEntregas.CabPrepEntrega bus)
                {
                    return(bus.NumPrep == Convert.ToInt32(vProy));
                }
                    );


                if (result != null)
                {
                    vReg = bS.IndexOf(result);
                }
            }

            return(vReg);
        }
Пример #11
0
        public static int fncBuscaIndexOF(BindingSource bS, string vProducto)
        {
            int vReg = 0;

            if (bS.SupportsSearching)
            {
                vReg = bS.Find("Producto", vProducto);
            }
            else
            {
                List <Articulo> lista  = (List <Articulo>)bS.List;
                Articulo        result = lista.Find(bus => bus.Producto == vProducto);

                if (result != null)
                {
                    vReg = bS.IndexOf(result);
                }
                else
                {
                    vReg = -1;
                }
            }

            return(vReg);
        }
Пример #12
0
        private void TsbUserNewClick(object sender, EventArgs e)
        {
            using (UserForm userForm = new UserForm())
            {
                if (userForm.ShowDialog() == DialogResult.OK)
                {
                    DataRowView newUser = _bsUser.AddNew() as DataRowView;

                    if (userForm.tbPass.Text != string.Empty && userForm.tbPass.Text == userForm.tbConfirmPass.Text)
                    {
                        newUser["Name"] = userForm.tbName.Text;
                        newUser["Pass"] = userForm.tbPass.Text;

                        _bsUser.EndEdit();
                        _bsUser.ResetCurrentItem();

                        _bsUser.Position = 0;
                        int indx = _bsUser.IndexOf(newUser);
                        _bsUser.Position = indx;
                    }
                    else
                    {
                        MessageBox.Show("Senha inválida!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        _bsUser.CancelEdit();
                    }
                }
            }
        }
Пример #13
0
        public static int fncBuscaIndexLinPed(BindingSource bS, string vPed)
        {
            int vReg = 0;

            if (bS.SupportsSearching)
            {
                vReg = bS.Find("NumPed", vPed);
            }
            else
            {
                List <cPedidosVenta.LinVenta> lista  = (List <cPedidosVenta.LinVenta>)bS.List;
                cPedidosVenta.LinVenta        result = lista.Find(
                    delegate(cPedidosVenta.LinVenta bus)
                {
                    return(bus.NumPed == Convert.ToInt32(vPed));
                }
                    );


                if (result != null)
                {
                    vReg = bS.IndexOf(result);
                }
            }

            return(vReg);
        }
Пример #14
0
        /// <summary>Return the transmitter for 'pair' if it exists, otherwise null</summary>
        public Transmitter FindTransmitter(string sym)
        {
            // If the pair is already in the list, set it as the current pair
            var idx = Transmitters.IndexOf(x => x.SymbolCode == sym);

            return(idx != -1 ? Transmitters[idx] : null);
        }
Пример #15
0
 protected override void OnCurrentChanged(EventArgs e)
 {
     base.OnCurrentChanged(e);
     if (NeedSync && !(Current is GroupRow))
     {
         bsource.Position = bsource.IndexOf(Current);
     }
 }
Пример #16
0
        public void OnMessageEvent(ServerEventMessage msg)
        {
            if (msg.Channel == typeof(JarsDefaultAppointment).Name)
            {
                // throw new NotImplementedException();
                ServerEventMessageData msgData = msg.Json.FromJson <ServerEventMessageData>();
                switch (msg.Selector)
                {
                case SelectorTypes.store:

                    List <JarsDefaultAppointment> appts = msgData.jsonDataString.ConvertTo <List <JarsDefaultAppointment> >();
                    foreach (var item in appts)
                    {
                        //first see if the appt is already in the list, if it is then update it, otherwise add it.
                        var findItm = ((List <JarsDefaultAppointment>)standardAppointmentDefaultBindingSource.List).FirstOrDefault(x => x.Id == item.Id);
                        if (findItm != null)
                        {
                            findItm.PopulateWith(item);
                        }
                        else
                        {
                            standardAppointmentDefaultBindingSource.List.Add(item.ConvertTo <JarsDefaultAppointment>());
                        }
                    }

                    this.BeginInvokeIfRequired(c =>
                    {
                        c.Refresh();
                    });
                    break;

                case SelectorTypes.delete:

                    List <int> ids      = msgData.jsonDataString.ConvertTo <List <int> >();
                    var        findList = ((List <JarsDefaultAppointment>)standardAppointmentDefaultBindingSource.List).Where(j => ids.Contains(j.Id));//.CreateCopy();
                    this.BeginInvokeIfRequired(c =>
                    {
                        int[] idx = new int[findList.Count()];
                        int x     = 0;
                        foreach (var item in findList)
                        {
                            idx[x] = standardAppointmentDefaultBindingSource.IndexOf(item);
                            x++;
                        }
                        for (int i = 0; i < idx.Length; i++)
                        {
                            standardAppointmentDefaultBindingSource.RemoveAt(idx[i]);
                        }
                        c.Refresh();
                    });
                    break;

                default:
                    break;
                }
            }
        }
Пример #17
0
        private void txtBusqueda_TextChanged(object sender, EventArgs e)
        {
            string Criterio = cbCriterio.Text;
            string Busqueda = txtBusqueda.Text;

            //Busqueda por codigo
            if (Criterio == "Codigo")
            {
                string Codigo = Busqueda;
                var    obj    = BDInventario.List.OfType <cInventario>().ToList().Find(f => f.CodigoArticulo == Codigo);
                var    pos    = BDInventario.IndexOf(obj);
                BDInventario.Position = pos;
            }

            //Busqueda por Descripcion
            if (Criterio == "Descripcion")
            {
                string Descripcion = Busqueda;
                var    obj         = BDInventario.List.OfType <cInventario>().ToList().Find(f => f.Descripcion.StartsWith(Descripcion));
                var    pos         = BDInventario.IndexOf(obj);
                BDInventario.Position = pos;
            }


            //Busqueda por Tipo Familia
            if (Criterio == "Familia")
            {
                string Familia = Busqueda;
                var    obj     = BDInventario.List.OfType <cInventario>().ToList().Find(f => f.FamiliaID == Familia);
                var    pos     = BDInventario.IndexOf(obj);
                BDInventario.Position = pos;
            }

            //Busqueda por Tipo Marca
            if (Criterio == "Marca")
            {
                string Marca = Busqueda;
                var    obj   = BDInventario.List.OfType <cInventario>().ToList().Find(f => f.MarcaID == Marca);
                var    pos   = BDInventario.IndexOf(obj);
                BDInventario.Position = pos;
            }
        }
        internal void Expand(BindingSource bSource)
        {
            int index = bSource.IndexOf(this);

            foreach (AppointStateHistory item in this)
            {
                bSource.Insert(++index, item);
            }

            Expanded = true;
        }
Пример #19
0
        public FBuscar(TipoBasico d, TipoDeClase tipoDeClase, ServiciosVenta sv, ServiciosDependiente sd, ServiciosArticulos sa) : this(tipoDeClase, sv, sd, sa)
        {
            //Se mueve directamente al dependiente de clave "clave"

            int i = bindingSource.IndexOf(d);

            if (i >= 0)
            {
                bindingSource.Position = i;
            }
        }
Пример #20
0
        public static void UpdateItem <T>(this BindingSource bindingSource, T boundItem, T updatedItem)
        {
            _ = bindingSource ?? throw new ArgumentNullException(nameof(bindingSource));
            var index = bindingSource.IndexOf(boundItem);

            if (index != -1)
            {
                bindingSource[index] = updatedItem;
                bindingSource.ResetItem(index);
            }
        }
Пример #21
0
        public static void MoveToItem(this BindingSource source, object obj)
        {
            if (obj == null)
            {
                return;
            }

            source.Position = source.IndexOf(obj);

            Assert(ReferenceEquals(obj, source.Current));
        }
Пример #22
0
        private void FillUpFields(BindingSource bsMovies)
        {
            DataRowView drv = bsMovies.Current as DataRowView;

            if (drv != null)
            {
                tbTitle.Text           = drv["Title"].ToString();
                tbYear.Text            = drv["Year"].ToString();
                tbReleased.Text        = drv["Released"].ToString();
                tbRated.Text           = drv["imdbRating"].ToString();
                tbGenre.Text           = drv["Genre"].ToString();
                tbActors.Text          = drv["Actors"].ToString();
                tbPlot.Text            = drv["Plot"].ToString();
                tbMetascore.Text       = drv["Metascore"].ToString();
                pbPoster.ImageLocation = drv["Poster"].ToString();

                btnLeft.Enabled  = _bsMovies.IndexOf(drv) != 0;
                btnRight.Enabled = _bsMovies.IndexOf(drv) != _bsMovies.Count - 1;
            }
        }
Пример #23
0
        public void BuscarProveedor(string Criterio, string Busqueda)
        {
            ProveedorBL   ObjetoProveedor = new ProveedorBL();
            BindingSource DbProveedor     = new BindingSource();

            DbProveedor.DataSource = ObjetoProveedor.Listar();

            //Realizamos la busqueda deendiendo del critrio
            dgvProveedor.AutoGenerateColumns = false;
            dgvProveedor.DataSource          = DbProveedor;

            if (Criterio == "Código")
            {
                //Busqueda por codigo
                Int32 Codigo = Convert.ToInt32(Busqueda);
                var   obj    = DbProveedor.List.OfType <cProveedor>().ToList().Find(f => f.Codigo == Codigo);
                var   pos    = DbProveedor.IndexOf(obj);
                DbProveedor.Position = pos;
            }
            else if (Criterio == "Nombre")
            {
                //Busqueda por codigo
                var obj = DbProveedor.List.OfType <cProveedor>().ToList().Find(f => f.NombreComercial == Busqueda);
                var pos = DbProveedor.IndexOf(obj);
                DbProveedor.Position = pos;
            }
            else if (Criterio == "Teléfono")
            {
                //Busqueda por codigo
                var obj = DbProveedor.List.OfType <cProveedor>().ToList().Find(f => f.Telefono == Busqueda);
                var pos = DbProveedor.IndexOf(obj);
                DbProveedor.Position = pos;
            }
            else if (Criterio == "RNC / Cedula")
            {
                //Busqueda por codigo
                var obj = DbProveedor.List.OfType <cProveedor>().ToList().Find(f => f.RNC == Busqueda);
                var pos = DbProveedor.IndexOf(obj);
                DbProveedor.Position = pos;
            }
        }
 private void button_Rechercher_Click(object sender, EventArgs e)
 {
     try
     {
         bs.Position = bs.IndexOf(cs.Adherents.Find(int.Parse(Textbox_CodeRechAdhérent.Text)));
         //bs.Position = Program.ds.Tables["Adherent"].Rows.Find(int.Parse(Textbox_CodeRechAdhérent.Text))
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #25
0
        private void ThumbnailList_ItemClick(object sender, ItemClickEventArgs e)
        {
            var fImg = e.Item.Tag as ImageDocument;

            if (fImg == null)
            {
                return;
            }


            BindingSource.Position = BindingSource.IndexOf(fImg);  // fImg.OrderInDocument;//
            //CurrentViewImage = fImg;
        }
Пример #26
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            Persona p = (Persona)miBinding.Current;
            int     index;

            index = miBinding.IndexOf(p);
            frmEditar modificar = new frmEditar(p);

            if (modificar.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.miBinding[index] = modificar.Persona;
            }
        }
Пример #27
0
        void importer_RomStatusChanged(object sender, RomStatusChangedEventArgs e)
        {
            if (InvokeRequired)
            {
                //Make sure we only execute on main thread
                BeginInvoke(new MethodInvoker(delegate()
                {
                    importer_RomStatusChanged(sender, e);
                }
                                              ));
                return;
            }

            if (closing || restarting)
            {
                return;
            }

            RomMatch romMatch;

            if (e.Status == RomMatchStatus.PendingHash)
            {
                romMatch = e.RomMatch;
                if (!checkRow(romMatch)) //if false, add a new row
                {
                    addRow(romMatch);
                    return;
                }
            }
            else if (e.Status == RomMatchStatus.Ignored || e.Status == RomMatchStatus.Removed)
            {
                importerBindingSource.Remove(e.RomMatch);
                return;
            }

            int rowNum = importerBindingSource.IndexOf(e.RomMatch);

            if (rowNum < 0) //match not in grid
            {
                return;
            }

            romMatch = e.RomMatch;
            if (romMatch.Status == RomMatchStatus.Ignored && e.Status != RomMatchStatus.PendingHash && e.Status != RomMatchStatus.Ignored)
            {
                return;
            }

            refreshRow(rowNum);
            updateButtons();
        }
Пример #28
0
        /// <summary>
        /// Adds an image to the collection
        /// </summary>
        /// <param name="newImage">Images to add to the collection.</param>
        /// <returns>The ID value of the added image.
        /// If the orginally supplied id value was negative then a new ID value is created.</returns>
        /// <exception cref="ArgumentException">System.SystemException.ArgumentException -
        /// if any of the image ids already exist in the collection</exception>
        public void AddImage(ImageDocument image)
        {
            var AddedImages = new Collection <ImageDocument>();

            image.OrderInDocument = BindingSource.IndexOf(image) + 1;
            var ImgItm = new ImageListViewItem(image);

            if (Path.IsPathRooted(image.Description) && File.Exists(image.Description))
            {
                ImgItm = new ImageListViewItem(image.Description);
            }
            else
            {
                ImgItm.FileName = image.GUid.ToString();
            }

            ImgItm.Tag = image;

            ImgItm.Text   = image.OrderInDocument.ToString();
            ImgItm.ZOrder = image.OrderInDocument;

            var ti = BindingSource.IndexOf(image);

            if (ti > Items.Count)
            {
            }

            Items.Insert(BindingSource.IndexOf(image), ImgItm);//.Add(ImgItm);

            //if (image.Image != null)
            //{
            //    image.Image.Dispose();  //Added by rm 901018
            //    image.Image = null;
            //}



            if (null != AddedImage)
            {
                //var fImages = new Collection<BaseImage>();
                //var oi = 0;
                //foreach (var iigg in AddedImages)
                //{
                //    fImages[oi] = iigg;
                //    oi++;
                //}

                var e = new ImageEventArgs(AddedImages);
                AddedImage(this, e);
            }
        }
Пример #29
0
        /// <summary>
        /// Изменение отображаемого состояния номера в списке номеров
        /// </summary>
        /// <param name="number"></param>
        /// <param name="e"></param>
        public void ChangeNumberOutput(PhoneNumber number, PhoneNumberStateChangedEventArgs e)
        {
            if (number == null)
            {
                throw new ArgumentNullException(nameof(number));
            }
            if (e == null)
            {
                throw new ArgumentNullException("Аргумент состояния пуст!");
            }

            _bsPhoneNumbers.Position = _bsPhoneNumbers.IndexOf(number);
            number.OutputNumber      = e.Message;
        }
Пример #30
0
        private void ucImageListView_ViewItemChanged(object sender, EventArgs e)
        {
            var itm = sender as ImageListItem;

            if (itm != null)
            {
                var fImg = itm.Tag as ImageDocument;

                if (fImg != null)
                {
                    BindingSource.Position = BindingSource.IndexOf(fImg);
                }
            }
        }