Exemplo n.º 1
0
        private void AddNew()
        {
            app_currency objCurrency = new app_currency();

            entity.db.app_currency.Add(objCurrency);
            app_currencyViewSource.View.MoveCurrentToLast();
            btnDelete.Visibility = Visibility.Collapsed;
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="db"></param>
        /// <returns>CurrencyFX Entity</returns>
        public static app_currencyfx get_DefaultFX(db db)
        {
            if (CurrentSession.Id_Company > 0)
            {
                app_currency app_currency = db.app_currency.Where(x => x.is_priority && x.id_company == CurrentSession.Id_Company).FirstOrDefault();
                if (app_currency != null)
                {
                    return(db.app_currencyfx.Where(x => x.is_active && x.id_currency == app_currency.id_currency).FirstOrDefault());
                }
            }

            return(null);
        }
Exemplo n.º 3
0
 private void crud_modal_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (crud_modal.Visibility == System.Windows.Visibility.Hidden)
     {
         app_currency objCurrency = entity.db.app_currency.Where(x => x.id_currency == _IdCurrency).FirstOrDefault();
         if (objCurrency != null)
         {
             entity.db.Entry <app_currency>(objCurrency).Reload();
         }
         entity.db.app_currency.Where(a => a.id_company == _entity.company_ID).OrderByDescending(a => a.is_active).Load();
         app_currencyViewSource.Source = entity.db.app_currency.Local;
         app_currencyViewSource.View.Refresh();
     }
 }
Exemplo n.º 4
0
        private void chkIsPriority_Checked(object sender, RoutedEventArgs e)
        {
            if (!isLoadedFirstTime)
            {
                app_currency _app_currency = app_currencyViewSource.View.CurrentItem as app_currency;
                if (chkIsPriority.IsChecked == true)
                {
                    listapp_currencyfx = new List <app_currencyfx>();
                    if (_app_currency.app_currencyfx.Count > 0)
                    {
                        listapp_currencyfx = _app_currency.app_currencyfx.Where(x => x.type == app_currencyfx.CurrencyFXTypes.Impex).ToList();
                    }
                    foreach (var item in listapp_currencyfx)
                    {
                        entity.db.app_currencyfx.Remove(item);
                    }

                    app_currencyfx _app_currencyfx = new app_currencyfx();
                    _app_currencyfx.is_active  = false;
                    _app_currencyfx.type       = app_currencyfx.CurrencyFXTypes.Impex;
                    _app_currencyfx.buy_value  = 1;
                    _app_currencyfx.sell_value = 1;
                    _app_currency.app_currencyfx.Add(_app_currencyfx);

                    dataCurrencyfx.IsEnabled = false;
                }
                else
                {
                    entity.db.app_currencyfx.Remove(_app_currency.app_currencyfx.First());
                    dataCurrencyfx.IsEnabled = true;
                }
                app_currencyViewSource.View.Refresh();
                app_currencyapp_currencyfxViewSource.View.Refresh();
                filter_fx();
            }
            else
            {
                if (chkIsPriority.IsChecked == true)
                {
                    dataCurrencyfx.IsEnabled = false;
                }
                else
                {
                    dataCurrencyfx.IsEnabled = true;
                }
            }
        }
Exemplo n.º 5
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (CurrencyId > 0)
         {
             MessageBoxResult res = MessageBox.Show("Are you sure want to Delete?", "Cognitivo", MessageBoxButton.YesNo, MessageBoxImage.Question);
             if (res == MessageBoxResult.Yes)
             {
                 app_currency app_currency = entity.db.app_currency.Where(a => a.id_currency == CurrencyId).First();
                 app_currency.is_active = false;
                 btnSave_Click(sender, e);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
        public void get_ActiveRateXContact(ref contact contact)
        {
            app_currencyfx app_currencyfx = null;

            if (contact.app_currency != null && contact.app_currency.app_currencyfx != null && contact.app_currency.app_currencyfx.Count > 0)
            {
                app_currencyfx = contact.app_currency.app_currencyfx.Where(a => a.is_active == true).FirstOrDefault();
            }

            if (app_currencyfx != null && app_currencyfx.id_currencyfx > 0)
            {
                SelectedValue = Convert.ToInt32(app_currencyfx.id_currencyfx);
            }
            else
            {
                app_currency app_currency = CurrentSession.Currency_Default;
                SelectedValue = app_currency.app_currencyfx.FirstOrDefault().id_currencyfx;
                // cbCurrency.SelectedValue = -1;
            }
        }
Exemplo n.º 7
0
        private void sync_Currency()
        {
            DataTable dt = exeDT("SELECT * FROM MONEDA");

            foreach (DataRow row in dt.Rows)
            {
                app_currency app_currency = new app_currency();
                if (!(row["DESMONEDA"] is DBNull))
                {
                    app_currency.name        = (string)row["DESMONEDA"];
                    app_currency.id_company  = id_company;
                    app_currency.is_priority = Convert.ToBoolean(row["PRIORIDAD"]);
                    DataTable dtfx = exeDT("SELECT * FROM COTIZACION where CODMONEDA=" + Convert.ToInt32(row["CODMONEDA"]));
                    if (dtfx.Rows.Count > 0)
                    {
                        app_currencyfx app_currencyfx = new app_currencyfx();
                        app_currencyfx.buy_value  = Convert.ToInt32(dtfx.Rows[0]["FACTORVENTA"]);
                        app_currencyfx.sell_value = Convert.ToInt32(dtfx.Rows[0]["FACTORCOBRO"]);
                        app_currencyfx.is_active  = true;
                        app_currency.app_currencyfx.Add(app_currencyfx);
                    }
                    else
                    {
                        app_currencyfx app_currencyfx = new app_currencyfx();
                        app_currencyfx.buy_value  = 0;
                        app_currencyfx.sell_value = 0;
                        app_currencyfx.is_active  = true;
                        app_currency.app_currencyfx.Add(app_currencyfx);
                    }

                    app_currency.is_active = true;
                    //app_currency.id_country = id_country;
                    if (app_currency.Error == null)
                    {
                        dbContext.app_currency.Add(app_currency);
                    }
                }
            }
            dt.Clear();
            dbContext.SaveChanges();
        }
Exemplo n.º 8
0
        private void _SaveChanges()
        {
            app_currency _app_currency = app_currencyViewSource.View.CurrentItem as app_currency;

            if (_app_currency.is_priority == true)
            {
                List <app_currency> list_app_currency = entity.db.app_currency.Where(a => a.id_currency != _app_currency.id_currency).ToList();
                foreach (var item in list_app_currency)
                {
                    item.is_priority = false;
                }
            }

            if (_app_currency.app_currencyfx.Any(x => x.is_active) == false && _app_currency.app_currencyfx.Count > 0)
            {
                app_currencyfx app_currencyfx;
                app_currencyfx            = _app_currency.app_currencyfx.OrderBy(x => x.timestamp).FirstOrDefault();
                app_currencyfx.is_active  = true;
                app_currencyfx.is_reverse = false;
            }

            entity.db.SaveChanges();
        }
Exemplo n.º 9
0
        public void product()
        {
            string sql = " SELECT dbo.FAMILIA.DESFAMILIA, dbo.LINEA.DESLINEA, dbo.RUBRO.DESRUBRO, dbo.IVA.DESIVA, dbo.CODIGOS.DESCODIGO1, dbo.CODIGOS.CODIGO, dbo.CODIGOS.PESABLE, dbo.CODIGOS.VENCIMIENTO, dbo.CODIGOS.BALANZA, dbo.PRODUCTOS.DESPRODUCTO, dbo.PRODUCTOS.STOCKMINIMO, dbo.PRODUCTOS.STOCKMAXIMO, "
                         + " dbo.PRODUCTOS.SERVICIO, dbo.PRODUCTOS.ESTADO, dbo.PRODUCTOS.ESPECIFICACIONES, dbo.PRODUCTOS.PRODUCTO, dbo.UNIDADMEDIDA.DESMEDIDA, dbo.CODIGOS.CODCODIGO"
                         + " FROM dbo.CODIGOS LEFT OUTER JOIN"
                         + " dbo.PRODUCTOS ON dbo.CODIGOS.CODPRODUCTO = dbo.PRODUCTOS.CODPRODUCTO LEFT OUTER JOIN"
                         + " dbo.UNIDADMEDIDA ON dbo.PRODUCTOS.CODMEDIDA = dbo.UNIDADMEDIDA.CODMEDIDA LEFT OUTER JOIN"
                         + " dbo.RUBRO ON dbo.PRODUCTOS.CODRUBRO = dbo.RUBRO.CODRUBRO LEFT OUTER JOIN"
                         + " dbo.FAMILIA ON dbo.PRODUCTOS.CODFAMILIA = dbo.FAMILIA.CODFAMILIA LEFT OUTER JOIN"
                         + " dbo.LINEA ON dbo.PRODUCTOS.CODLINEA = dbo.LINEA.CODLINEA LEFT OUTER JOIN"
                         + " dbo.IVA ON dbo.PRODUCTOS.CODIVA = dbo.IVA.CODIVA";

            SqlConnection conn = new SqlConnection(_connString);
            //Counts Total number of Rows we have to process
            SqlCommand cmd = new SqlCommand();

            conn.Open();
            cmd.Connection  = conn;
            cmd.CommandText = "SELECT COUNT(*) FROM CODIGOS";
            cmd.CommandType = CommandType.Text;
            int count = (int)cmd.ExecuteScalar();

            //cmd.Dispose();
            conn.Close();

            int value = 0;

            Dispatcher.BeginInvoke((Action)(() => progItem.Maximum = count));
            Dispatcher.BeginInvoke((Action)(() => progItem.Value += value));
            Dispatcher.BeginInvoke((Action)(() => itemMaximum.Text = count.ToString()));
            Dispatcher.BeginInvoke((Action)(() => itemValue.Text = value.ToString()));

            string sql_price = " SELECT dbo.TIPOCLIENTE.DESTIPOCLIENTE, dbo.PRECIO.CANTIDAD, dbo.PRECIO.PRECIOVENTA, dbo.MONEDA.DESMONEDA, dbo.PRODUCTOS.DESPRODUCTO"
                               + " FROM  dbo.PRECIO LEFT OUTER JOIN"
                               + " dbo.MONEDA ON dbo.PRECIO.CODMONEDA = dbo.MONEDA.CODMONEDA LEFT OUTER JOIN"
                               + " dbo.PRODUCTOS ON dbo.PRECIO.CODPRODUCTO = dbo.PRODUCTOS.CODPRODUCTO LEFT OUTER JOIN"
                               + " dbo.TIPOCLIENTE ON dbo.PRECIO.CODTIPOCLIENTE = dbo.TIPOCLIENTE.CODTIPOCLIENTE";
            DataTable dt_Price = exeDT(sql_price);

            conn.Open();
            cmd.Connection  = conn;
            cmd.CommandText = sql;
            cmd.CommandType = CommandType.Text;
            DataTable dt_product = exeDT(sql);

            foreach (DataRow reader in dt_product.Rows)
            {
                using (db db = new db())
                {
                    db.Configuration.AutoDetectChangesEnabled = false;

                    item item = new item();
                    item.id_company = id_company;

                    if (!(reader[9] is DBNull))
                    {
                        item.name = reader[9].ToString();
                    }
                    else
                    {
                        continue;
                    }

                    item.code        = (reader[5] is DBNull) ? string.Empty : reader[5].ToString();
                    item.variation   = (reader[9] is DBNull) ? string.Empty : reader[9].ToString();
                    item.is_active   = (reader[13] is DBNull) ? false : true;
                    item.description = (reader[14] is DBNull) ? string.Empty : reader[14].ToString();

                    string name = (reader[16] is DBNull) ? string.Empty : reader[16].ToString();
                    if (db.app_measurement.Where(x => x.name == name && x.id_company == id_company).FirstOrDefault() != null)
                    {
                        item.id_measurement = db.app_measurement.Where(x => x.name == name && x.id_company == id_company).FirstOrDefault().id_measurement;
                    }

                    //string FAMILIA;
                    if (!(reader[0] is DBNull))
                    {
                        string          tagname       = reader[0].ToString();
                        item_tag        item_tagFam   = db.item_tag.Where(x => x.name == tagname && x.id_company == id_company).FirstOrDefault();
                        item_tag_detail tag_detailFam = new item_tag_detail();
                        tag_detailFam.id_tag = item_tagFam.id_tag;
                        item.item_tag_detail.Add(tag_detailFam);
                    }

                    //string LINEA;
                    if (!(reader[1] is DBNull))
                    {
                        string          tagLinname    = reader[1].ToString();
                        item_tag        item_tagLin   = db.item_tag.Where(x => x.name == tagLinname && x.id_company == id_company).FirstOrDefault();
                        item_tag_detail tag_detailLin = new item_tag_detail();
                        tag_detailLin.id_tag = item_tagLin.id_tag;
                        item.item_tag_detail.Add(tag_detailLin);
                    }

                    //string RUBRO;
                    if (!(reader[2] is DBNull))
                    {
                        string          tagrubro      = reader[2].ToString();
                        item_tag        item_tagRub   = db.item_tag.Where(x => x.name == tagrubro && x.id_company == id_company).FirstOrDefault();
                        item_tag_detail tag_detailRub = new item_tag_detail();
                        tag_detailRub.id_tag = item_tagRub.id_tag;
                        item.item_tag_detail.Add(tag_detailRub);
                    }

                    if (!(reader[15] is DBNull))
                    {
                        if (Convert.ToInt32(reader[15]) == 1)
                        {
                            //Product
                            item.id_item_type = item.item_type.Product;

                            item_product product = new item_product();
                            product.id_company = id_company;
                            product.can_expire = (reader[7] is DBNull || Convert.ToInt32(reader[7]) == 0) ? false : true;
                            product.is_weigted = (reader[6] is DBNull || Convert.ToInt32(reader[6]) == 0) ? false : true;
                            product.stock_max  = (reader[11] is DBNull) ? 0M : (decimal)reader[11];
                            product.stock_min  = (reader[10] is DBNull) ? 0M : (decimal)reader[10];
                            item.item_product.Add(product);
                        }
                        else
                        {
                            item.id_item_type = item.item_type.Task; //Generic Service
                            //item_service service
                        }
                    }
                    else
                    {
                        item.id_item_type = item.item_type.Task; //Generic Service
                        //item_service service
                    }
                    decimal _vat_coeficient = 0;

                    if (!(reader[3] is DBNull))
                    {
                        string        vatname       = reader[3].ToString();
                        app_vat_group app_vat_group = db.app_vat_group.Where(x => x.name == vatname && x.id_company == id_company).FirstOrDefault();
                        item.id_vat_group = app_vat_group.id_vat_group;
                    }

                    decimal coefficient = 0;
                    List <app_vat_group_details> app_vat_group_details = db.app_vat_group_details.Where(x => x.id_vat_group == item.id_vat_group).ToList();

                    foreach (app_vat_group_details app_vat_group in app_vat_group_details)
                    {
                        coefficient = coefficient + app_vat_group.app_vat.coefficient;
                    }

                    string _DESPRODUCTO = reader["DESPRODUCTO"].ToString();
                    _DESPRODUCTO = _DESPRODUCTO.Replace("'", "");
                    try
                    {
                        foreach (DataRow price_row in dt_Price.Select("DESPRODUCTO = '" + _DESPRODUCTO + "'"))
                        {
                            string _desTipoCliente = (price_row.IsNull("DESTIPOCLIENTE")) ? string.Empty : price_row["DESTIPOCLIENTE"].ToString();
                            string _desMoneda      = (price_row.IsNull("DESMONEDA")) ? string.Empty : price_row["DESMONEDA"].ToString();

                            if (_desTipoCliente != string.Empty && _desMoneda != string.Empty)
                            {
                                item_price_list item_price_list = db.item_price_list.Where(x => x.name == _desTipoCliente && x.id_company == id_company).FirstOrDefault();
                                app_currency    app_currency    = db.app_currency.Where(x => x.name == _desMoneda && x.id_company == id_company).FirstOrDefault();

                                if (item_price_list != null && app_currency != null && _vat_coeficient != -1)
                                {
                                    item_price item_price = new item_price();
                                    item_price.item = item;
                                    if (price_row["PRECIOVENTA"] is DBNull)
                                    {
                                        item_price.value = 0;
                                    }
                                    else
                                    {
                                        if (coefficient != -1)
                                        {
                                            item_price.value = ((decimal)price_row["PRECIOVENTA"] / (1 + coefficient));
                                        }
                                    }
                                    item_price.min_quantity  = (price_row.IsNull("CANTIDAD")) ? 0 : Convert.ToDecimal(price_row["CANTIDAD"]);
                                    item_price.id_currency   = app_currency.id_currency;
                                    item_price.id_price_list = item_price_list.id_price_list;
                                    item.item_price.Add(item_price);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }

                    try
                    {
                        if (item.Error == null)
                        {
                            db.items.Add(item);
                            db.SaveChanges();
                            value += 1;
                            Dispatcher.BeginInvoke((Action)(() => progItem.Value = value));
                            Dispatcher.BeginInvoke((Action)(() => itemValue.Text = value.ToString()));
                        }
                    }
                    catch { }
                }
            }


            //cmd.Dispose();
            conn.Close();

            _product_Current = _product_Max;
        }
Exemplo n.º 10
0
        public void supplier()
        {
            string sql = " SELECT dbo.PROVEEDOR.NUMPROVEEDOR, dbo.PROVEEDOR.NOMBRE, dbo.PROVEEDOR.RUC_CIN, dbo.PROVEEDOR.DIRECCION, dbo.PROVEEDOR.TELEFONO, dbo.PROVEEDOR.EMAIL, dbo.PROVEEDOR.observacion, dbo.PROVEEDOR.CLIENTE_ID, dbo.PROVEEDOR.CONTACTO1, dbo.PROVEEDOR.CONTACTO2, dbo.PROVEEDOR.EMAILCONT1,"
                         + " dbo.PROVEEDOR.EMAILCONT2, dbo.PROVEEDOR.TELCONT1, dbo.PROVEEDOR.TELCONT2, dbo.PROVEEDOR.CELCONT1, dbo.PROVEEDOR.CELCONT2, dbo.PROVEEDOR.DIRECCIONCONT1, dbo.PROVEEDOR.DIRECCIONCONT2, dbo.PROVEEDOR.FORMAPAGO,"
                         + " dbo.PROVEEDOR.ESTADO, dbo.PROVEEDOR.DIASVENCIMIENTO, "
                         + " dbo.CATEGORIAPROVEEDOR.DESCATEGORIAPROVEEDOR, dbo.CENTROCOSTO.DESCENTRO, dbo.MONEDA.DESMONEDA,"
                         + " (select DESZONA from ZONA where ZONA.CODZONA=PROVEEDOR.CODZONA) as DESZONA,(select DESCIUDAD from CIUDAD where CIUDAD.CODCIUDAD=PROVEEDOR.CODCIUDAD) as DESCIUDAD,(select DESPAIS from PAIS where PAIS.CODPAIS=PROVEEDOR.CODPAIS) as DESPAIS"
                         + " FROM  dbo.PROVEEDOR LEFT OUTER JOIN"
                         + " dbo.CENTROCOSTO ON dbo.PROVEEDOR.CODCENTRO = dbo.CENTROCOSTO.CODCENTRO LEFT OUTER JOIN"
                         + " dbo.MONEDA ON dbo.PROVEEDOR.CODMONEDA = dbo.MONEDA.CODMONEDA LEFT OUTER JOIN"
                         + " dbo.CATEGORIAPROVEEDOR ON dbo.PROVEEDOR.CODCATEGORIAPROVEEDOR = dbo.CATEGORIAPROVEEDOR.CODCATEGORIAPROVEEDOR";

            SqlConnection conn = new SqlConnection(_connString);
            //Counts Total number of Rows we have to process
            SqlCommand cmd = new SqlCommand(sql, conn);

            conn.Open();
            cmd.CommandText = "SELECT COUNT(*) FROM PROVEEDOR";
            cmd.CommandType = CommandType.Text;
            int count = (int)cmd.ExecuteScalar();

            conn.Close();

            int value = 0;

            Dispatcher.BeginInvoke((Action)(() => progSupplier.Maximum = count));
            Dispatcher.BeginInvoke((Action)(() => progSupplier.Value = value));
            Dispatcher.BeginInvoke((Action)(() => supplierMaximum.Text = count.ToString()));
            Dispatcher.BeginInvoke((Action)(() => supplierValue.Text = value.ToString()));

            cmd = new SqlCommand(sql, conn);
            conn.Open();
            cmd.CommandType = CommandType.Text;
            //  SqlDataReader reader = cmd.ExecuteReader();
            DataTable dt_supplier = exeDT(sql);

            foreach (DataRow reader in dt_supplier.Rows)
            {
                using (entity.db db = new entity.db())
                {
                    db.Configuration.AutoDetectChangesEnabled = false;

                    contact contacts = new contact();
                    contacts.id_company = id_company;

                    if (!(reader[1] is DBNull))
                    {
                        contacts.name = reader[1].ToString();
                    }
                    else
                    {
                        continue;
                    }

                    if (!(reader[0] is DBNull))
                    {
                        string str = reader[0].ToString();
                        contacts.code = str;
                    }
                    else
                    {
                        contacts.code = "0";
                    }

                    contacts.gov_code    = ((reader[2] is DBNull) || reader[2].ToString() == string.Empty) ? "xxx" : reader[2].ToString();
                    contacts.is_active   = true;
                    contacts.is_customer = false;
                    contacts.is_supplier = true;
                    contacts.is_employee = false;
                    contacts.address     = (reader[3] is DBNull) ? null : reader[3].ToString();
                    contacts.telephone   = (reader[4] is DBNull) ? null : reader[4].ToString();
                    contacts.email       = (reader[5] is DBNull) ? null : reader[5].ToString();


                    int    _dias        = Convert.ToInt32((reader["DIASVENCIMIENTO"] is DBNull) ? 0 : reader["DIASVENCIMIENTO"]);
                    string contrat_name = _dias + " " + "Días";
                    if (db.app_contract.Where(x => x.name == contrat_name).FirstOrDefault() != null)
                    {
                        app_contract app_contract = db.app_contract.Where(x => x.name == contrat_name).FirstOrDefault();
                        contacts.id_contract  = app_contract.id_contract;
                        contacts.app_contract = app_contract;
                    }
                    //db Related Insertion.
                    if (!(reader[22] is DBNull))
                    {
                        string          CdC             = reader[22].ToString();
                        app_cost_center app_cost_center = db.app_cost_center.Where(x => x.name == CdC && x.id_company == id_company).FirstOrDefault();
                        contacts.id_cost_center = app_cost_center.id_cost_center;
                    }

                    contacts.id_contact_role = db.contact_role.Where(x => x.is_principal == true && x.id_company == id_company).FirstOrDefault().id_contact_role;

                    if (!(reader[23] is DBNull))
                    {
                        string       fx           = reader[23].ToString();
                        app_currency app_currency = db.app_currency.Where(x => x.name == fx && x.id_company == id_company).FirstOrDefault();
                        contacts.id_currency = (int)app_currency.id_currency;
                    }

                    if (!(reader["DESZONA"] is DBNull))
                    {
                        string        name           = (string)reader["DESZONA"];
                        app_geography _app_geography = db.app_geography.Where(x => x.name == name).FirstOrDefault();
                        if (_app_geography != null)
                        {
                            contacts.app_geography = _app_geography;
                            contacts.id_geography  = _app_geography.id_geography;
                        }
                    }
                    else if (!(reader["DESCIUDAD"] is DBNull))
                    {
                        string        name           = (string)reader["DESCIUDAD"];
                        app_geography _app_geography = db.app_geography.Where(x => x.name == name).FirstOrDefault();
                        if (_app_geography != null)
                        {
                            contacts.app_geography = _app_geography;
                            contacts.id_geography  = _app_geography.id_geography;
                        }
                    }
                    else if (!(reader["DESPAIS"] is DBNull))
                    {
                        string        name           = (string)reader["DESPAIS"];
                        app_geography _app_geography = db.app_geography.Where(x => x.name == name).FirstOrDefault();
                        if (_app_geography != null)
                        {
                            contacts.app_geography = _app_geography;
                            contacts.id_geography  = _app_geography.id_geography;
                        }
                    }

                    if (contacts.Error == null)
                    {
                        try
                        {
                            db.contacts.Add(contacts);
                            db.SaveChanges();
                            value += 1;
                            Dispatcher.BeginInvoke((Action)(() => progSupplier.Value = value));
                            Dispatcher.BeginInvoke((Action)(() => supplierValue.Text = value.ToString()));
                        }
                        catch
                        {
                            throw;
                        }
                    }
                    //db.Dispose();
                }
            }

            //cmd.Dispose();
            conn.Close();

            _supplier_Current = _supplier_Max;
        }