Пример #1
0
        public void modificarRol(int rol, string nombre, DataTable funciones)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().modificarRol(rol, nombre, funciones, conexion);

            command.ExecuteNonQuery();
        }
Пример #2
0
        public ServerSQL ConstructorTest()
        {
            ServerSQL target = new ServerSQL();

            return(target);
            // TODO: add assertions to method ServerSQLTest.ConstructorTest()
        }
Пример #3
0
        private void FetchBaseAsync(object argument, BackgroundWorker worker,
                                    System.ComponentModel.DoWorkEventArgs e)
        {
            IDictionary <string, List <Draw> > fetchList =
                (IDictionary <string, List <Draw> >)argument;

            using (ServerSQL dataSQL = new ServerSQL(DatabaseFrom.Database, true))       // чтение
            {
                using (ServerSQL fetchSQL = new ServerSQL(DatabaseFrom.Fetchbase, true)) // чтение
                {
                    if (dataSQL.Connected && fetchSQL.Connected)
                    {
                        int i = 0;
                        foreach (KeyValuePair <string, List <Draw> > item in fetchList)
                        {
                            if (worker.CancellationPending)
                            {
                                e.Cancel = true; break;
                            }
                            string ptname = item.Key;
                            // получение данных
                            IDictionary <string, string> realvals =
                                Data.GetRealValues(ptname, fetchSQL, dataSQL);
                            worker.ReportProgress(i,
                                                  new Tuple <List <Draw>,
                                                             IDictionary <string, string>, string>(
                                                      item.Value, realvals, ptname));
                            i++;
                        }
                    }
                }
            }
        }
Пример #4
0
        public void deshabilitarRol(int rol)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().deshabilitarRol(rol, conexion);

            command.ExecuteNonQuery();
        }
Пример #5
0
        public void habilitarProveedor(string p)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().habilitarProveedor(p, conexion);

            command.ExecuteNonQuery();
        }
Пример #6
0
        public frmTables(Form host, Form panelhost, string table, int curgroup)
        {
            string grdesc;

            InitializeComponent();
            currGroup = curgroup;
            viewTable = table;
            DataHost  = host;
            PanelHost = panelhost;
            updater   = panelhost as IUpdatePanel;
            bool anyGroupExists = false;
            int  j           = 1;
            int  n           = 20;
            int  GroupsCount = Properties.Settings.Default.TableGroupsCount;

            using (ServerSQL mySQL = new ServerSQL(DatabaseFrom.Database, false)) // чтение удалённо
            {
                if (mySQL.Connected)
                {
                    for (int i = 1; i <= GroupsCount / n; i++)
                    {
                        ToolStripDropDownItem item = (ToolStripDropDownItem)tsbGroupSelect.DropDownItems.Add(
                            String.Format("Группы с {0} по {1}", j, j + n - 1));
                        for (int k = j; k < j + n; k++)
                        {
                            if (!Data.GroupIsEmpty(k, mySQL, ParamGroup.Table))
                            {
                                grdesc = Data.GetGroupDesc(k, mySQL, ParamGroup.Table);
                                ToolStripItem groupItem = item.DropDownItems.Add(
                                    String.Format("Группа {0}{1}", k,
                                                  String.IsNullOrWhiteSpace(grdesc) ? String.Empty : " - " + grdesc),
                                    null, miGroup_Click);
                                groupItem.ImageIndex = k;
                                anyGroupExists       = true;
                            }
                        }
                        j += n;
                    }
                    tsbNextGroup.Enabled = anyGroupExists;
                    for (int i = 1; i <= Data.PlaceCount(ParamGroup.Table); i++)
                    {
                        ColumnHeader header = new ColumnHeader();
                        headers.Add(header);
                        header.TextAlign = HorizontalAlignment.Right;
                        header.Width     = 80;
                        header.Text      = String.Empty;
                        lvTableView.Columns.Add(header);
                    }
                    grdesc = Data.GetGroupDesc(currGroup, mySQL, ParamGroup.Table);
                    lbGroupCaption.Text = String.Format("Группа {0} {1}", currGroup,
                                                        String.IsNullOrWhiteSpace(grdesc) ? "(без названия)" : " - " + grdesc);
                }
            }
            if (!Data.GroupIsEmpty(currGroup, ParamGroup.Table))
            {
                updater.UpdateCurrentGroupNo(currGroup);
                UpdateGroupCaptions();
            }
            tsbPrevGroup.Enabled = currGroup > 1;
        }
Пример #7
0
        public int DeleteRowTest01([PexAssumeUnderTest] ServerSQL target, string cmd)
        {
            int result = target.DeleteRow(cmd);

            return(result);
            // TODO: add assertions to method ServerSQLTest.DeleteRowTest01(ServerSQL, String)
        }
Пример #8
0
        public void crearCliente(Cliente cli)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().crearCliente(cli, conexion);

            command.ExecuteNonQuery();
        }
Пример #9
0
        public List <Cupon> traerCuponesPropios(int userID)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();

            SqlCommand command = QueryFactory.instance().traerCuponesPropios(userID, conexion);

            List <Cupon> listaCupones = new List <Cupon>();

            try
            {
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        listaCupones.Add(new Cupon(Convert.ToInt32(reader["cupo_id"].ToString()), DateTime.Parse(reader["cupo_fecha"].ToString()), reader["cupo_oferta"].ToString(), Convert.ToInt32(reader["cupo_cliente"]), Convert.ToInt32(reader["cupo_compra"]), reader["ofer_descripcion"].ToString()));//,Convert.ToInt32(reader["cupo_compra"].ToString())));
                    }
                }
                conexion.Close();
                return(listaCupones);
            }
            catch (SqlException e)
            {
                // throw e;
                MessageBox.Show(e.Message);
                return(listaCupones);
            }
        }
Пример #10
0
        public SqlDataReader ExecuteQueryTest01([PexAssumeUnderTest] ServerSQL target, string cmd)
        {
            SqlDataReader result = target.ExecuteQuery(cmd);

            return(result);
            // TODO: add assertions to method ServerSQLTest.ExecuteQueryTest01(ServerSQL, String)
        }
Пример #11
0
        public int connectTest([PexAssumeUnderTest] ServerSQL target, string address)
        {
            int result = target.connect(address);

            return(result);
            // TODO: add assertions to method ServerSQLTest.connectTest(ServerSQL, String)
        }
Пример #12
0
        public void agregarOferta(Oferta oferta)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().agregarOferta(oferta.ofer_id, oferta.ofer_descripcion, oferta.ofer_fechaDesde, oferta.ofer_fechaHasta, oferta.ofer_precioOferta, oferta.ofer_precioLista, oferta.ofer_proveedor, oferta.ofer_disponible, oferta.ofer_maxDisponible, conexion);

            command.ExecuteNonQuery();
        }
Пример #13
0
        public void habilitarUsuario(string idUsuario)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().habilitarUsuario(idUsuario, conexion);

            command.ExecuteNonQuery();
        }
Пример #14
0
        public void deshabilitarCliente(String clie_id)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().deshabilitarCliente(clie_id, conexion);

            command.ExecuteNonQuery();
        }
Пример #15
0
        public List <Oferta> traerOfertasDisponibles()
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();

            SqlCommand command = QueryFactory.instance().traerOfertasDisponibles(conexion);


            try
            {
                List <Oferta> listaOfertas = new List <Oferta>();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        listaOfertas.Add(new Oferta((reader["ofer_id"]).ToString(), reader["ofer_descripcion"].ToString(), DateTime.Parse(reader["ofer_fechaDesde"].ToString()), DateTime.Parse(reader["ofer_fechaHasta"].ToString()), Convert.ToDouble(reader["ofer_precioOferta"]), Convert.ToDouble(reader["ofer_precioLista"]), Convert.ToInt32(reader["ofer_proveedor"]), Convert.ToInt32(reader["ofer_disponible"]), Convert.ToInt32(reader["ofer_maxDisponible"])));
                    }
                }
                conexion.Close();
                return(listaOfertas);
            }
            catch (SqlException e)
            {
                throw e;
            }
        }
Пример #16
0
        public void eliminarOferta(string idOferta)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().eliminarOferta(idOferta, conexion);

            command.ExecuteNonQuery();
        }
Пример #17
0
        public int ExecuteNonQueryTest01([PexAssumeUnderTest] ServerSQL target, string cmd)
        {
            int result = target.ExecuteNonQuery(cmd);

            return(result);
            // TODO: add assertions to method ServerSQLTest.ExecuteNonQueryTest01(ServerSQL, String)
        }
Пример #18
0
        public int executeScalarTest([PexAssumeUnderTest] ServerSQL target, string cmd)
        {
            int result = target.executeScalar(cmd);

            return(result);
            // TODO: add assertions to method ServerSQLTest.executeScalarTest(ServerSQL, String)
        }
Пример #19
0
        public int traerSaldo(int userId)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();

            SqlCommand command = QueryFactory.instance().saldoUsuario(userId, conexion);


            try
            {
                SqlDataReader reader = command.ExecuteReader();
                {
                    if (reader.Read())
                    {
                        return(Convert.ToInt32(reader["clie_saldo"]));
                    }
                }
            }
            catch (SqlException e)
            {
                //throw e;
                MessageBox.Show(e.Message);
            }

            return(0);
        }
Пример #20
0
        public ServerSQL ConstructorTest01(string address)
        {
            ServerSQL target = new ServerSQL(address);

            return(target);
            // TODO: add assertions to method ServerSQLTest.ConstructorTest01(String)
        }
Пример #21
0
        private static void DecodeFD(ref Entity ent, List <byte> results, ServerSQL fetchSQL, ServerSQL dataSQL, ref List <string> childs)
        {
            if (results[7] * 8 + 9 != results.Count)
            {
                return;
            }
            int    n;
            UInt32 values = (UInt32)BitConverter.ToSingle(results.ToArray(), 12);

            childs = GetChilds(ent, true);
            n      = 0;
            foreach (string childname in childs)
            {
                bool   boolval = (values & (UInt32)(1 << n)) > 0;
                Entity child   = Data.GetEntity(childname, dataSQL);
                if (!child.Empty && (bool)child.Values["Actived"])
                {
                    child.Reals = Data.GetRealValues(childname, fetchSQL, dataSQL);
                    Single raw = (boolval) ? 1f : 0f;
                    child.SetRealProp("Raw", raw.ToString());
                    child.SetRealProp("Quality", "GOOD");
                    child.Reals = child.Plugin.Fetch(childname, child);
                    Data.WriteRealVals(child, fetchSQL);
                }
                n++;
            }
        }
Пример #22
0
        public void modificarCliente(String clie_id, Cliente cli)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().modificarCliente(clie_id, cli, conexion);

            command.ExecuteNonQuery();
        }
Пример #23
0
        public DataTable getCuponesNoCanjeados(int proveedor, int cliente, DateTime fecha)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().traerCuponesDeProveedor(proveedor, cliente, fecha, conexion);
            SqlDataReader reader   = command.ExecuteReader();

            return((reader.HasRows) ? this.cargarCuponesNoCanjeados(reader) : null);
        }
Пример #24
0
        public DataTable getProveedores()
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().traerProveedores(conexion);
            SqlDataReader reader   = command.ExecuteReader();

            return((reader.HasRows) ? this.cargarProveedores(reader) : null);
        }
Пример #25
0
        public DataTable buscarPorFunciones(DataTable funcion)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().busquedaRol_Funcion(funcion, conexion);
            SqlDataReader reader   = command.ExecuteReader();

            return((reader.HasRows) ? this.cargarRolesBusqueda(reader) : new DataTable());
        }
Пример #26
0
        public DataTable buscarPorIdYNombre(decimal id, string nombre)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().busquedaRol_IdYNombre(id, nombre, conexion);
            SqlDataReader reader   = command.ExecuteReader();

            return((reader.HasRows) ? this.cargarRolesBusqueda(reader) : new DataTable());
        }
Пример #27
0
        public DataTable traerOfertasFiltradas(string descripcion, DateTime fecha, int proveedor)

        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().busquedaOferta(descripcion, fecha, proveedor, conexion);
            SqlDataReader reader   = command.ExecuteReader();

            return((reader.HasRows) ? this.cargarOfertaBusqueda(reader) : null);
        }
Пример #28
0
        private string getRubro(string rubrId)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().getNombreRubro(rubrId, conexion);
            SqlDataReader reader   = command.ExecuteReader();

            reader.Read();
            return(reader[0].ToString());
        }
Пример #29
0
        public int getIdRol(string rolNombre)
        {
            SqlConnection conexion = ServerSQL.instance().levantarConexion();
            SqlCommand    command  = QueryFactory.instance().getIdRol(rolNombre, conexion);
            SqlDataReader reader   = command.ExecuteReader();

            reader.Read();
            return(Convert.ToInt32(reader["rol_id"]));
        }
Пример #30
0
        public void ExecuteNonQueryTest821()
        {
            ServerSQL serverSQL;
            int       i;

            serverSQL = new ServerSQL((string)null);
            i         = this.ExecuteNonQueryTest(serverSQL, ";ﳤ=", ";ﳤ=");
            Assert.AreEqual <int>(0, i);
            Assert.IsNotNull((object)serverSQL);
        }