Ejemplo n.º 1
0
 private static SqlParameter[] CreateSqlParameter(ContactsBackup model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@Id", model.Id),
         new SqlParameter("@PhoneNumber", model.PhoneNumber),
         new SqlParameter("@ComPort", model.ComPort),
         new SqlParameter("@CreatedDate", model.CreatedDate),
         new SqlParameter("@SimNumber", model.SimNumber),
     });
 }
Ejemplo n.º 2
0
        public static ContactsBackup UpdateItem(ContactsBackup model)
        {
            Int32 result = 0;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "ContactsBackup_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (Int32)reader[0];
                }
            }
            return(GetItemByID(result));
        }
Ejemplo n.º 3
0
        public static ContactsBackup GetItemByID(Int32 id)
        {
            ContactsBackup item      = new ContactsBackup();
            var            sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@Id", id);
            using (var reader = SqlHelper.ExecuteReader("ContactsBackup_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Ejemplo n.º 4
0
        private static ContactsBackup GetItemFromReader(IDataReader dataReader)
        {
            ContactsBackup objItem = new ContactsBackup();

            objItem.Id = SqlHelper.GetInt(dataReader, "Id");

            objItem.PhoneNumber = SqlHelper.GetString(dataReader, "PhoneNumber");

            objItem.ComPort = SqlHelper.GetString(dataReader, "ComPort");

            objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate");

            objItem.SimNumber = SqlHelper.GetString(dataReader, "SimNumber");
            return(objItem);
        }
Ejemplo n.º 5
0
        public static ContactsBackupCollection GetSimPort()
        {
            ContactsBackupCollection collection = new ContactsBackupCollection();

            using (var reader = SqlHelper.ExecuteReader("ContactsBackup_GetComPort", null))
            {
                while (reader.Read())
                {
                    ContactsBackup obj = new ContactsBackup();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }