protected void Page_Load(object sender, EventArgs e) { lblDate.Text = DateTime.Now.ToString("dd MMM yyyy"); lblDay.Text = DateTime.Now.ToString("dddd"); lblTime.Text = DateTime.Now.ToString("hh:mm:ss tt"); serialPort1.PortName = "COM6"; serialPort1.BaudRate = 9600; SqlOperation op = new SqlOperation(); MySqlDataReader dr = op.getInterval(int.Parse(Session["userid"].ToString())); dr.Read(); interval = int.Parse(dr.GetValue(8).ToString()); Timer3.Interval = interval * 1000; serialPort1.Open(); temp = serialPort1.ReadLine(); reading = serialPort1.ReadLine(); description = serialPort1.ReadLine(); serialPort1.Close(); lblTemp.Text = temp; lblReading.Text = reading; }
protected void Timer3_Tick(object sender, EventArgs e) { SqlOperation op = new SqlOperation(); op.insertTempReading(Double.Parse(temp), int.Parse(Session["userid"].ToString())); op.insertMoistureReading(int.Parse(reading), 1); Debug.Print("inserted"); Timer3.Interval = interval * 1000; }
public SqlOperation GetRetriveAllStatement() { var operation = new SqlOperation() { ProcedureName = "CRUD_PERMISOS" }; operation.Parameters = new List <SqlParameter>(); operation.AddIntParam(DbCrudAction, (int)CrudActionEnum.RetrieveAll); return(operation); }
public SqlOperation GetRetriveAllById(BaseEntity entity) { var operation = new SqlOperation() { ProcedureName = "CRUD_PERMISOS" }; var permiso = (Permisos)entity; operation.AddIntParam(DbColId, permiso.IdPermiso); operation.AddIntParam(DbCrudAction, (int)CrudActionEnum.RetrieveAllById); return(operation); }
public SqlOperation TranslateWordsStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "sp_traducir_palabra" }; var t = (Traductor)entity; operation.AddVarcharParam(DB_COL_EXISTENCIA_PALABRA, t.PO); operation.AddIntParam(DB_COL_COD_IDIOMA, t.Cod_Idioma); return(operation); }
public SqlOperation GetRetriveByTerminalStatement(BaseEntity entity) { var Operation = new SqlOperation { ProcedureName = "RetrieveRouteByTerminal" }; var C = (Terminal)entity; Operation.AddIntParam(IDTERMINAL, C.IdTerminal); return(Operation); }
public SqlOperation GetRetriveStatement(BaseEntity entity) { var Operation = new SqlOperation { ProcedureName = "RetrieveRouteById" }; var C = (Route)entity; Operation.AddIntParam(IDROUTE, C.IdRoute); return(Operation); }
public SqlOperation GetCreateStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "CRE_TIPO_TARJETA" }; var tipoTarjeta = (TipoTarjeta)entity; operation.AddVarcharParam(DB_COL_NOMBRE_TARJETA, tipoTarjeta.Nombre); operation.AddIntParam(DB_COL_DISCOUNT, tipoTarjeta.DiscountPercentage); return(operation); }
/// <summary> /// 新建语句。 /// </summary> /// <typeparam name="TEntity">模型类型。</typeparam> /// <param name="instance">对象实例。</param> /// <returns>返回迁移实例。</returns> public virtual OperationBuilder <SqlOperation> SqlCreate <TEntity>(TEntity instance) { Check.NotNull(instance, nameof(instance)); var operation = new SqlOperation { Instance = instance, EntityType = typeof(TEntity) }; Operations.Add(operation); return(new OperationBuilder <SqlOperation>(operation)); }
/// <summary> /// SQL语句。 /// </summary> /// <param name="sql">SQL语句。</param> /// <returns>返回迁移实例。</returns> public virtual OperationBuilder <SqlOperation> Sql(string sql) { Check.NotEmpty(sql, nameof(sql)); var operation = new SqlOperation { Sql = sql }; Operations.Add(operation); return(new OperationBuilder <SqlOperation>(operation)); }
public SqlOperation GetRetriveAllById(BaseEntity entity) { var operation = new SqlOperation() { ProcedureName = "CRUD_INSCRIPCION" }; var inscripcion = (Inscripcion)entity; operation.AddIntParam(DbColIdInscripcion, inscripcion.IdInscripcion); operation.AddIntParam(DbCrudAction, (int)CrudActionEnum.RetrieveAllById); return(operation); }
public SqlOperation GetRetriveByStateStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "RET_STORE_ADMINISTRATOR_STATE_PR" }; var storeAdmin = (StoreAdministrator)entity; operation.AddVarcharParam(DB_COL_EMAIL, storeAdmin.Email); operation.AddBooleanParam(DB_COL_ACTIVE, storeAdmin.Active); return(operation); }
public SqlOperation GetDeleteStatement(BaseEntity entity) { var operation = new SqlOperation() { ProcedureName = "CRUD_PRODUCTO" }; var producto = (Producto)entity; operation.Parameters = new List <SqlParameter>(); operation.AddIntParam(DbColIdProducto, producto.IdProducto); operation.AddIntParam(DbCrudAction, (int)CrudActionEnum.Delete); return(operation); }
public SqlOperation GetUpdateContrasennaStatement(Entity entity) { var operation = new SqlOperation { ProcedureName = "UPD_CONTRASENNA_USUARIO_PR" }; var u = (Usuario)entity; operation.AddVarcharParam(DB_COL_CORREO, u.Correo); operation.AddVarcharParam(DB_COL_CONTRASENNA, u.Contrasenna); return(operation); }
public SqlOperation GetDeleteStatement(BaseEntity entity) { var operation = new SqlOperation() { ProcedureName = "CRUD_PERMISOS" }; var permiso = (Permisos)entity; operation.AddIntParam(DbColId, permiso.IdPermiso); operation.AddIntParam(DbCrudAction, (int)CrudActionEnum.Delete); return(operation); }
public SqlOperation GetExistsStatement(Entity entity) { var operation = new SqlOperation { ProcedureName = "RET_USUARIO_CORREO_ID_PR" }; var u = (Usuario)entity; operation.AddVarcharParam(DB_COL_IDENTIFICACION, u.Identificacion); operation.AddVarcharParam(DB_COL_CORREO, u.Correo); return(operation); }
/// <summary> /// 删除语句。 /// </summary> /// <typeparam name="TEntity">模型类型。</typeparam> /// <param name="expression">条件表达式。</param> /// <returns>返回迁移实例。</returns> public virtual OperationBuilder <SqlOperation> SqlDelete <TEntity>(Expression <Predicate <TEntity> > expression) { Check.NotNull(expression, nameof(expression)); var operation = new SqlOperation { EntityType = typeof(TEntity), Expression = expression }; Operations.Add(operation); return(new OperationBuilder <SqlOperation>(operation)); }
public SqlOperation GetRetriveStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "RET_TIPO_TARJETA_BY_ID" }; var tipoTarjeta = (TipoTarjeta)entity; operation.AddIntParam(DB_COL_TIPOTARJETA_ID, tipoTarjeta.TipoTarjetaId); operation.AddVarcharParam(DB_COL_NOMBRE_TARJETA, tipoTarjeta.Nombre); return(operation); }
public SqlOperation GetCreateStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "[dbo].[CRE_ANIMALES_PR]" }; var c = (Animal)entity; operation.AddVarcharParam(DB_COL_NOMBRE, c.nombre); operation.AddDateParam(DB_COL_FECHA_NACIMIENTO, c.fechaNacimiento); operation.AddVarcharParam(DB_COL_CATEGORIA, c.categoria); operation.AddVarcharParam(DB_COL_ALIMENTO_FAVORITO, c.AlimentoFavorito); return(operation); }
public SqlOperation GetRetriveByCompanyStatement(BaseEntity entity) { var Operation = new SqlOperation { ProcedureName = "RetrieveRouteByCompany" }; var C = (Route)entity; Operation.AddIntParam(IDCOMPANY, C.RouteCompany.IdCompany); return(Operation); }
public static void DeleteDefaultConstraint(this IDbMigration migration, string tableName, string colName, bool suppressTransaction = false) { var sql = new SqlOperation( $"DECLARE @SQL varchar(1000) " + $"SET @SQL='ALTER TABLE {tableName} DROP CONSTRAINT ['+(SELECT name FROM sys.default_constraints WHERE parent_object_id = object_id('{tableName}') AND col_name(parent_object_id, parent_column_id) = '{colName}')+']'; " + $"PRINT @SQL; " + $"EXEC(@SQL);") { SuppressTransaction = suppressTransaction }; migration.AddOperation(sql); }
public SqlOperation GetUpdateStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "sp_modificar_popularidad" }; var t = (Traductor)entity; operation.AddIntParam(DB_COL_COD_IDIOMA, t.Cod_Idioma); operation.AddVarcharParam(DB_COL_EXISTENCIA_PALABRA, t.PO); return(operation); }
public SqlOperation GetRetriveByName(BaseEntity entity) { var operation = new SqlOperation() { ProcedureName = "CRUD_PERMISOS" }; var permiso = (Permisos)entity; operation.AddVarcharParam(DbColNombre, permiso.Nombre); operation.AddIntParam(DbCrudAction, (int)CrudActionEnum.RetrieveByName); return(operation); }
public SqlOperation GetUpdateEstadoStatement(Entity entity) { var operation = new SqlOperation { ProcedureName = "UPD_ESTADO_USUARIO_PR" }; var u = (Usuario)entity; operation.AddVarcharParam(DB_COL_IDENTIFICACION, u.Identificacion); operation.AddVarcharParam(DB_COL_ESTADO, u.ValorEstado); return(operation); }
protected override void Generate(SqlOperation operation, IModel model, MigrationCommandListBuilder builder) { Check.NotNull(operation, nameof(operation)); Check.NotNull(builder, nameof(builder)); var batches = Regex.Split( Regex.Replace( operation.Sql, @"\\\r?\n", string.Empty, default(RegexOptions), TimeSpan.FromMilliseconds(1000.0)), @"^\s*(GO[ \t]+[0-9]+|GO)(?:\s+|$)", RegexOptions.IgnoreCase | RegexOptions.Multiline, TimeSpan.FromMilliseconds(1000.0)); for (var i = 0; i < batches.Length; i++) { if (batches[i].StartsWith("GO", StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(batches[i])) { continue; } var count = 1; if (i != batches.Length - 1 && batches[i + 1].StartsWith("GO", StringComparison.OrdinalIgnoreCase)) { var match = Regex.Match( batches[i + 1], "([0-9]+)", default(RegexOptions), TimeSpan.FromMilliseconds(1000.0)); if (match.Success) { count = int.Parse(match.Value); } } for (var j = 0; j < count; j++) { builder.Append(batches[i]); if (i == batches.Length - 1) { builder.AppendLine(); } EndStatement(builder, operation.SuppressTransaction); } } }
public SqlOperation GetCreateStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "PA_REGISTRAR_CONSULTA" }; var c = (Consulta)entity; operation.AddIntParam(DB_COL_ID_CONSULTA, c.Id_Consulta); operation.AddIntParam(DB_COL_ID_TRADUCCION, c.Id_traduccion); operation.AddVarcharParam(DB_COL_NAME, c.Nombre_usuario); return(operation); }
public SqlOperation GetCreateStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "CREAR_HORARIO_PR" }; var h = (Horario)entity; operation.AddDateParam(DB_COL_FECHA, h.fecha); operation.AddVarcharParam(DB_COL_TIPO_HORARIO, h.tipo_horario); operation.AddDateParam(DB_COL_HORA_INICIO, h.hora_inicio); operation.AddDateParam(DB_COL_HORA_FIN, h.hora_fin); operation.AddIntParam(DB_COL_ID_SUCURSAL, h.id_sucursal); return(operation); }
public SqlOperation GetCreateStatement(BaseEntity entity, string CedulaJuridica) { var operation = new SqlOperation { ProcedureName = "CREAR_ARCHIVO_COMERCIO" }; var a = (Archivo)entity; operation.AddVarcharParam(DB_COL_NOMBRE, a.Nombre); operation.AddVarcharParam(DB_COL_ENLACE, a.Enlace); operation.AddVarcharParam(DB_COL_TIPO, a.Tipo); operation.AddVarcharParam(DB_COL_CEDULA_JURIDICA_COMERCIO, CedulaJuridica); return(operation); }
public SqlOperation ModificarArchivoItem(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "MODIFICAR_ARCHIVO_ITEM" }; var a = (Archivo)entity; operation.AddIntParam(DB_COL_ID, a.Id); operation.AddVarcharParam(DB_COL_NOMBRE, a.Nombre); operation.AddVarcharParam(DB_COL_ENLACE, a.Enlace); operation.AddVarcharParam(DB_COL_TIPO, a.Tipo); return(operation); }
public SqlOperation GetUpdateStatement(BaseEntity entity) { var operation = new SqlOperation { ProcedureName = "MODIFICAR_ARCHIVO_COMERCIO" }; var a = (Archivo)entity; operation.AddIntParam(DB_COL_ID, a.Id); operation.AddVarcharParam(DB_COL_NOMBRE, a.Nombre); operation.AddVarcharParam(DB_COL_ENLACE, a.Enlace); operation.AddVarcharParam(DB_COL_TIPO, a.Tipo); return(operation); }
public void Get_set_suppress_transaction() { var sqlOperation = new SqlOperation("MySql"); Assert.False(sqlOperation.SuppressTransaction); sqlOperation.SuppressTransaction = true; Assert.True(sqlOperation.SuppressTransaction); sqlOperation.SuppressTransaction = false; Assert.False(sqlOperation.SuppressTransaction); }
public SqlOperation GetUpdateStatement(EntidadBase entidad) { var operation = new SqlOperation { ProcedureName = "UPD_TIPO_TIQUETE_PR" }; var c = (TipoTiquete)entidad; operation.AddIntParam(DB_COL_ID, c.Id); operation.AddVarcharParam(DB_COL_TIPO, c.Tipo); operation.AddDecimalParam(DB_COL_PRECIO, c.Precio); return(operation); }
protected void btnLogin_Click(object sender, EventArgs e) { string username = txtUsername.Text; string password = txtPassword.Text; SqlOperation op = new SqlOperation(); MySqlDataReader dr = op.login(username, password); if (dr.HasRows) { //Successful login dr.Read(); Session.Add("userid", dr.GetValue(0)); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Log in successful.');window.location.href ='index.aspx';</script>"); } else { //Unsuccessful login ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Log in failed. Please try again.');</script>"); } }