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(); }
public ServerSQL ConstructorTest() { ServerSQL target = new ServerSQL(); return(target); // TODO: add assertions to method ServerSQLTest.ConstructorTest() }
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++; } } } } }
public void deshabilitarRol(int rol) { SqlConnection conexion = ServerSQL.instance().levantarConexion(); SqlCommand command = QueryFactory.instance().deshabilitarRol(rol, conexion); command.ExecuteNonQuery(); }
public void habilitarProveedor(string p) { SqlConnection conexion = ServerSQL.instance().levantarConexion(); SqlCommand command = QueryFactory.instance().habilitarProveedor(p, conexion); command.ExecuteNonQuery(); }
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; }
public int DeleteRowTest01([PexAssumeUnderTest] ServerSQL target, string cmd) { int result = target.DeleteRow(cmd); return(result); // TODO: add assertions to method ServerSQLTest.DeleteRowTest01(ServerSQL, String) }
public void crearCliente(Cliente cli) { SqlConnection conexion = ServerSQL.instance().levantarConexion(); SqlCommand command = QueryFactory.instance().crearCliente(cli, conexion); command.ExecuteNonQuery(); }
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); } }
public SqlDataReader ExecuteQueryTest01([PexAssumeUnderTest] ServerSQL target, string cmd) { SqlDataReader result = target.ExecuteQuery(cmd); return(result); // TODO: add assertions to method ServerSQLTest.ExecuteQueryTest01(ServerSQL, String) }
public int connectTest([PexAssumeUnderTest] ServerSQL target, string address) { int result = target.connect(address); return(result); // TODO: add assertions to method ServerSQLTest.connectTest(ServerSQL, String) }
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(); }
public void habilitarUsuario(string idUsuario) { SqlConnection conexion = ServerSQL.instance().levantarConexion(); SqlCommand command = QueryFactory.instance().habilitarUsuario(idUsuario, conexion); command.ExecuteNonQuery(); }
public void deshabilitarCliente(String clie_id) { SqlConnection conexion = ServerSQL.instance().levantarConexion(); SqlCommand command = QueryFactory.instance().deshabilitarCliente(clie_id, conexion); command.ExecuteNonQuery(); }
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; } }
public void eliminarOferta(string idOferta) { SqlConnection conexion = ServerSQL.instance().levantarConexion(); SqlCommand command = QueryFactory.instance().eliminarOferta(idOferta, conexion); command.ExecuteNonQuery(); }
public int ExecuteNonQueryTest01([PexAssumeUnderTest] ServerSQL target, string cmd) { int result = target.ExecuteNonQuery(cmd); return(result); // TODO: add assertions to method ServerSQLTest.ExecuteNonQueryTest01(ServerSQL, String) }
public int executeScalarTest([PexAssumeUnderTest] ServerSQL target, string cmd) { int result = target.executeScalar(cmd); return(result); // TODO: add assertions to method ServerSQLTest.executeScalarTest(ServerSQL, String) }
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); }
public ServerSQL ConstructorTest01(string address) { ServerSQL target = new ServerSQL(address); return(target); // TODO: add assertions to method ServerSQLTest.ConstructorTest01(String) }
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++; } }
public void modificarCliente(String clie_id, Cliente cli) { SqlConnection conexion = ServerSQL.instance().levantarConexion(); SqlCommand command = QueryFactory.instance().modificarCliente(clie_id, cli, conexion); command.ExecuteNonQuery(); }
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); }
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); }
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()); }
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()); }
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); }
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()); }
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"])); }
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); }