Exemplo n.º 1
0
 public static int Insert(APMInfo _APMInfo)
 {
     //Execute the query and return the new Guid
     object retval= _AdoHelper.ExecuteScalar(ConnectionString,"APMInsert",
         new SqlParameter("@Cod_Delegacion", _APMInfo.Cod_Delegacion),
         new SqlParameter("@Codigo_Completo", _APMInfo.Codigo_Completo),
         new SqlParameter("@Numero_APM", _APMInfo.Numero_APM),
         new SqlParameter("@Apellido", _APMInfo.Apellido),
         new SqlParameter("@Nombre", _APMInfo.Nombre),
         new SqlParameter("@Fecha_Nacimiento", _APMInfo.Fecha_Nacimiento),
         new SqlParameter("@Cod_Nacionalidad", _APMInfo.Cod_Nacionalidad),
         new SqlParameter("@Cod_Direccion", _APMInfo.Cod_Direccion),
         new SqlParameter("@Cod_Modelo", _APMInfo.Cod_Modelo),
         new SqlParameter("@Fecha_Ingreso", _APMInfo.Fecha_Ingreso),
         new SqlParameter("@Fecha_Egreso", _APMInfo.Fecha_Egreso),
         new SqlParameter("@Ultima_Conexion", _APMInfo.Ultima_Conexion),
         new SqlParameter("@Ultimo_Proceso", _APMInfo.Ultimo_Proceso),
         new SqlParameter("@Skip", _APMInfo.Skip),
         new SqlParameter("@Foto", _APMInfo.Foto),
         new SqlParameter("@Blocking_Days", _APMInfo.Blocking_Days),
         new SqlParameter("@Proc_Id", _APMInfo.Proc_Id),
         new SqlParameter("@UserName", _APMInfo.UserName),
         new SqlParameter("@Password", _APMInfo.Password),
         new SqlParameter("@Email", _APMInfo.Email),
         new SqlParameter("@Download", _APMInfo.Download),
         new SqlParameter("@External_Code", _APMInfo.External_Code),
         new SqlParameter("@Action", _APMInfo.Action),
         new SqlParameter("@Change_Del", _APMInfo.Change_Del),
         new SqlParameter("@SyncID", _APMInfo.SyncID)
     );
     return Int32.Parse(retval.ToString());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of the APM class and populates it with data from the specified SqlDataReader.
        /// </summary>
        private static APMInfo MakeAPM(SqlDataReader dataReader)
        {
            APMInfo aPM = new APMInfo();

            if (dataReader.IsDBNull(Cod_APM) == false)
                aPM.Cod_APM = dataReader.GetInt32(Cod_APM);
            if (dataReader.IsDBNull(Cod_Delegacion) == false)
                aPM.Cod_Delegacion = dataReader.GetInt32(Cod_Delegacion);
            if (dataReader.IsDBNull(Codigo_Completo) == false)
                aPM.Codigo_Completo = dataReader.GetString(Codigo_Completo);
            if (dataReader.IsDBNull(Numero_APM) == false)
                aPM.Numero_APM = dataReader.GetString(Numero_APM);
            if (dataReader.IsDBNull(Apellido) == false)
                aPM.Apellido = dataReader.GetString(Apellido);
            if (dataReader.IsDBNull(Nombre) == false)
                aPM.Nombre = dataReader.GetString(Nombre);
            if (dataReader.IsDBNull(Fecha_Nacimiento) == false)
                aPM.Fecha_Nacimiento = dataReader.GetDateTime(Fecha_Nacimiento);
            if (dataReader.IsDBNull(Cod_Nacionalidad) == false)
                aPM.Cod_Nacionalidad = dataReader.GetInt32(Cod_Nacionalidad);
            if (dataReader.IsDBNull(Cod_Direccion) == false)
                aPM.Cod_Direccion = dataReader.GetInt32(Cod_Direccion);
            if (dataReader.IsDBNull(Cod_Modelo) == false)
                aPM.Cod_Modelo = dataReader.GetInt32(Cod_Modelo);
            if (dataReader.IsDBNull(Fecha_Ingreso) == false)
                aPM.Fecha_Ingreso = dataReader.GetDateTime(Fecha_Ingreso);
            if (dataReader.IsDBNull(Fecha_Egreso) == false)
                aPM.Fecha_Egreso = dataReader.GetDateTime(Fecha_Egreso);
            if (dataReader.IsDBNull(Ultima_Conexion) == false)
                aPM.Ultima_Conexion = dataReader.GetDateTime(Ultima_Conexion);
            if (dataReader.IsDBNull(Ultimo_Proceso) == false)
                aPM.Ultimo_Proceso = dataReader.GetDateTime(Ultimo_Proceso);
            if (dataReader.IsDBNull(Skip) == false)
                aPM.Skip = dataReader.GetInt16(Skip);
            if (dataReader.IsDBNull(Foto) == false)
                aPM.Foto = new Byte[Convert.ToInt32(dataReader.GetBytes(0, 0, null, 0, Int32.MaxValue))];
                dataReader.GetBytes(0, 0, aPM.Foto, 0, aPM.Foto.Length);
            if (dataReader.IsDBNull(Blocking_Days) == false)
                aPM.Blocking_Days = dataReader.GetInt16(Blocking_Days);
            if (dataReader.IsDBNull(Proc_Id) == false)
                aPM.Proc_Id = dataReader.GetInt32(Proc_Id);
            if (dataReader.IsDBNull(UserName) == false)
                aPM.UserName = dataReader.GetString(UserName);
            if (dataReader.IsDBNull(Password) == false)
                aPM.Password = dataReader.GetString(Password);
            if (dataReader.IsDBNull(Email) == false)
                aPM.Email = dataReader.GetString(Email);
            if (dataReader.IsDBNull(Download) == false)
                aPM.Download = dataReader.GetDateTime(Download);
            if (dataReader.IsDBNull(External_Code) == false)
                aPM.External_Code = dataReader.GetString(External_Code);
            if (dataReader.IsDBNull(Action) == false)
                aPM.Action = dataReader.GetString(Action);
            if (dataReader.IsDBNull(Change_Del) == false)
                aPM.Change_Del = dataReader.GetBoolean(Change_Del);
            if (dataReader.IsDBNull(SyncID) == false)
                aPM.SyncID = dataReader.GetGuid(SyncID);
            if (dataReader.IsDBNull(SyncTimeStamp) == false)
                aPM.SyncTimeStamp = DateTime.MinValue;

            return aPM;
        }
Exemplo n.º 3
0
 public static void Delete(APMInfo _APMInfo)
 {
     _AdoHelper.ExecuteNonQuery(ConnectionString,CommandType.StoredProcedure, "APMDelete",
         new SqlParameter("@Cod_APM", _APMInfo.Cod_APM)
     );
 }
Exemplo n.º 4
0
 public static void Update(APMInfo _APMInfo)
 {
     _AdoHelper.ExecuteNonQuery(ConnectionString,CommandType.StoredProcedure, "APMUpdate",
         new SqlParameter("@Cod_APM", _APMInfo.Cod_APM),
         new SqlParameter("@Cod_Delegacion", _APMInfo.Cod_Delegacion),
         new SqlParameter("@Codigo_Completo", _APMInfo.Codigo_Completo),
         new SqlParameter("@Numero_APM", _APMInfo.Numero_APM),
         new SqlParameter("@Apellido", _APMInfo.Apellido),
         new SqlParameter("@Nombre", _APMInfo.Nombre),
         new SqlParameter("@Fecha_Nacimiento", _APMInfo.Fecha_Nacimiento),
         new SqlParameter("@Cod_Nacionalidad", _APMInfo.Cod_Nacionalidad),
         new SqlParameter("@Cod_Direccion", _APMInfo.Cod_Direccion),
         new SqlParameter("@Cod_Modelo", _APMInfo.Cod_Modelo),
         new SqlParameter("@Fecha_Ingreso", _APMInfo.Fecha_Ingreso),
         new SqlParameter("@Fecha_Egreso", _APMInfo.Fecha_Egreso),
         new SqlParameter("@Ultima_Conexion", _APMInfo.Ultima_Conexion),
         new SqlParameter("@Ultimo_Proceso", _APMInfo.Ultimo_Proceso),
         new SqlParameter("@Skip", _APMInfo.Skip),
         new SqlParameter("@Foto", _APMInfo.Foto),
         new SqlParameter("@Blocking_Days", _APMInfo.Blocking_Days),
         new SqlParameter("@Proc_Id", _APMInfo.Proc_Id),
         new SqlParameter("@UserName", _APMInfo.UserName),
         new SqlParameter("@Password", _APMInfo.Password),
         new SqlParameter("@Email", _APMInfo.Email),
         new SqlParameter("@Download", _APMInfo.Download),
         new SqlParameter("@External_Code", _APMInfo.External_Code),
         new SqlParameter("@Action", _APMInfo.Action),
         new SqlParameter("@Change_Del", _APMInfo.Change_Del),
         new SqlParameter("@SyncID", _APMInfo.SyncID)
     );
 }