コード例 #1
0
        public contactComms getContactCommId(Guid contactCommId)
        {
            contactComms data = new contactComms();

            if (contactCommId == Guid.Empty)
            {
                return(null);
            }

            using (contactCommDatabaseLogicLayer contactCommDatabase = new contactCommDatabaseLogicLayer())
            {
                SqlDataReader reader = contactCommDatabase.getContactCommId(contactCommId);
                while (reader.Read())
                {
                    data.id        = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0);
                    data.contactId = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1);
                    data.commType  = reader.IsDBNull(2) ? 0 : reader.GetInt32(2);
                    data.commValue = reader.IsDBNull(3) ? string.Empty : reader.GetString(3);
                }
                reader.Close();
                contactCommDatabase.connectionWizard();
            }

            return(data);
        }
コード例 #2
0
        public List <contactComms> getContactAllComm(Guid contactId)
        {
            List <contactComms> dataList = new List <contactComms>();

            if (contactId == Guid.Empty)
            {
                return(null);
            }

            using (contactCommDatabaseLogicLayer commDatabaseLogicLayer = new contactCommDatabaseLogicLayer())
            {
                SqlDataReader reader = commDatabaseLogicLayer.getContactAllComm(contactId);
                while (reader.Read())
                {
                    dataList.Add(new contactComms()
                    {
                        id         = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0),
                        contactId  = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1),
                        commType   = reader.IsDBNull(2) ? 0 : reader.GetInt32(2),
                        commValue  = reader.IsDBNull(3) ? string.Empty : reader.GetString(3),
                        createDate = reader.IsDBNull(4) ? DateTime.MinValue : reader.GetDateTime(4)
                    });
                }
                reader.Close();
                commDatabaseLogicLayer.connectionWizard();
            }
            return(dataList);
        }