예제 #1
0
 private static SqlParameter[] CreateSqlParameter(PhoneSetup model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@Id", model.Id),
         new SqlParameter("@Port", model.Port),
         new SqlParameter("@PhoneNo", model.PhoneNo),
         new SqlParameter("@Active", model.Active),
     });
 }
예제 #2
0
        public static PhoneSetup UpdateItem(PhoneSetup model)
        {
            Int32 result = 0;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblPhoneSetup_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (Int32)reader[0];
                }
            }
            return(GetItemByID(result));
        }
예제 #3
0
        private static PhoneSetup GetItemFromReader(IDataReader dataReader)
        {
            PhoneSetup objItem = new PhoneSetup();

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

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

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

            objItem.Active = SqlHelper.GetBoolean(dataReader, "Active");
            return(objItem);
        }
예제 #4
0
        public static PhoneSetupCollection GetAllItem()
        {
            PhoneSetupCollection collection = new PhoneSetupCollection();

            using (var reader = SqlHelper.ExecuteReader("tblPhoneSetup_GetAll", null))
            {
                while (reader.Read())
                {
                    PhoneSetup obj = new PhoneSetup();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
예제 #5
0
        public static PhoneSetup GetItemByID(Int32 id)
        {
            PhoneSetup item      = new PhoneSetup();
            var        sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@Id", id);
            using (var reader = SqlHelper.ExecuteReader("tblPhoneSetup_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
예제 #6
0
        public static PhoneSetupCollection GetSimPort()
        {
            PhoneSetupCollection collection = new PhoneSetupCollection();

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