コード例 #1
0
        public int DeleteMessage(int messageId)
        {
            int i = 0;

            using (SqlCommand command = new SqlCommand())
            {
                i = ExecuteNonQuery(MessageStringsSql.DeleteMessage(messageId));
            }
            return(i);
        }
コード例 #2
0
        public int DeleteMessageByUser(string userId)
        {
            int i = 0;

            using (SqlCommand command = new SqlCommand())
            {
                i = ExecuteNonQuery(MessageStringsSql.DeleteMessageByUser(userId));
            }
            return(i);
        }
コード例 #3
0
        public List <MessageModel> GetAllMessages()
        {
            DataTable           dt         = new DataTable();
            List <MessageModel> arrMessage = new List <MessageModel>();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(MessageStringsSql.GetAllMessages());
            }
            foreach (DataRow ms in dt.Rows)
            {
                arrMessage.Add(MessageModel.ToObject(ms));
            }

            return(arrMessage);
        }
コード例 #4
0
        public MessageModel GetOneMessageById(int messageId)
        {
            DataTable    dt      = new DataTable();
            MessageModel message = new MessageModel();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(MessageStringsSql.GetOneMessageById(messageId));
            }
            foreach (DataRow ms in dt.Rows)
            {
                message = MessageModel.ToObject(ms);
            }

            return(message);
        }