Exemplo n.º 1
0
        /// <summary>
        /// returns all Descendant or OffSpring Items
        /// </summary>
        /// <param name="CategoryId"></param>
        /// <returns></returns>
        public DataTable GetAllDescendantItems(int CategoryId)
        {
            SqlCommand procedure = DBUtils.StoredProcedure("Items_GetCategoryDescendants", cte.lib);

            DBUtils.AddProcedureParameter(procedure, "@CategoryId", SqlDbType.Int, CategoryId, ParameterDirection.Input);

            return(DBUtils.GetDataSet(procedure, cte.lib).Tables[0]);
        }
Exemplo n.º 2
0
        public void UpdateConversationStatus(int ConversationId, int UserId, ConversationStatus Status)
        {
            SqlCommand command = DBUtils.StoredProcedure("Chat_UpdateConversationStatus", cte.lib);

            DBUtils.AddProcedureParameter(command, "@ConversationId", SqlDbType.Int, ConversationId, ParameterDirection.Input);
            DBUtils.AddProcedureParameter(command, "@UserId", SqlDbType.Int, UserId, ParameterDirection.Input);
            DBUtils.AddProcedureParameter(command, "@Status", SqlDbType.Int, (int)Status, ParameterDirection.Input);

            command.Connection.Open();
            command.ExecuteNonQuery();
            command.Connection.Close();
        }
Exemplo n.º 3
0
        public int LeaveUser(int userId2, int convId)
        {
            SqlCommand command = DBUtils.StoredProcedure("Chat_LeaveUser", cte.lib);

            DBUtils.AddProcedureParameter(command, "@convId", SqlDbType.Int, convId, ParameterDirection.Input);
            DBUtils.AddProcedureParameter(command, "@userTo", SqlDbType.Int, userId2, ParameterDirection.Input);
            DBUtils.AddProcedureParameter(command, "@ConversationId", SqlDbType.Int, -1, ParameterDirection.Output);

            command.Connection.Open();
            command.ExecuteNonQuery();
            int conversationId = (int)command.Parameters["@ConversationId"].Value;

            command.Connection.Close();

            return(conversationId);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sends a message to the conversation opening all pending conversation for receiptions
        /// </summary>
        /// <param name="UserFrom">User Id</param>
        /// <param name="ConversationId">ConversationId</param>
        /// <param name="Message">Chat Message</param>
        /// <returns>MessageId can be used to communicate with client messageid</returns>
        public int SendMessage(int UserFrom, int ConversationId, string Message)
        {
            SqlCommand command = DBUtils.StoredProcedure("Chat_SendMessage", cte.lib);

            DBUtils.AddProcedureParameter(command, "@UserFrom", SqlDbType.Int, UserFrom, ParameterDirection.Input);
            DBUtils.AddProcedureParameter(command, "@ConversationId", SqlDbType.Int, ConversationId, ParameterDirection.Input);
            DBUtils.AddProcedureParameter(command, "@Message", SqlDbType.NText, Message, ParameterDirection.Input);

            DBUtils.AddProcedureParameter(command, "@MessageId", SqlDbType.Int, -1, ParameterDirection.Output);

            command.Connection.Open();
            command.ExecuteNonQuery();
            int MessageId = (int)command.Parameters["@MessageId"].Value;

            command.Connection.Close();

            return(MessageId);
        }