/// <summary> Method to for OnClick of ListView Items. </summary>
        /// <returns>void.</returns>
        protected void lvProducts_OnItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (user.UserId != 0)
            {
                if (String.Equals(e.CommandName, "Enquiry"))
                {
                    // Verify that the employee ID is not already in the list. If not, add the
                    // employee to the list.
                    /// <summary> Store the ListViewDataItem. </summary>
                    ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                    /// <summary> Store the Product ID. </summary>
                    //tblProductDetails[dataItem.DataItemIndex];
                    int ProductId =
                        int.Parse(lvProducts.DataKeys[dataItem.DisplayIndex].Value.ToString());
                    /// <summary> Store the Product User ID. </summary>
                    int ProductUserId = int.Parse(e.CommandArgument.ToString());
                    tblMessageProductUser = adpMessageProductUser.GetMessages(ProductUserId, ProductId);
                    if (tblMessageProductUser.Count > 0)
                    {
                        Response.Redirect("~/Messages.aspx");
                    }
                    else
                    {
                        adpMessage.Insert("Hey, I am interesterd in this product. Is it still available?", user.UserId, ProductUserId, ProductId);
                    }
                    //System.Diagnostics.Debug.WriteLine("Parameter" + param);
                }
                else if (String.Equals(e.CommandName, "Buy"))
                {
                    /// <summary> Store the ListViewDataItem. </summary>
                    ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                    //tblProductDetails[dataItem.DataItemIndex];
                    /// <summary> Store the Product ID. </summary>
                    int ProductId =
                        int.Parse(lvProducts.DataKeys[dataItem.DisplayIndex].Value.ToString());
                    /// <summary> Store the Product User ID. </summary>
                    int ProductUserId = int.Parse(e.CommandArgument.ToString());

                    /// <summary> Store the ROW object. </summary>
                    FinalProjectDataset.ProductDetailRow row = tblProductDetails[dataItem.DisplayIndex];
                    if (string.Equals(row.ProductType, "Available"))
                    {
                        adpUserProduct.Insert(user.UserId, ProductId, 1);
                        if (adpUserProduct.GetTotalQtyByProduct(ProductId) == row.ProductQty)
                        {
                            //row.ProductType = "Sold";
                            adpProduct.UpdateProductType("Sold", row.ProductId);
                            tblProductDetails[dataItem.DisplayIndex].ProductType = "Sold";
                            //Response.Redirect("");
                        }
                    }
                }
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }
        }
        /// <summary> Method to Get Messages. </summary>
        /// <returns>Return list of messages.</returns>
        /// <param name="UserId"> User ID.</param>
        /// <param name="ProductId"> Product ID</param>
        /// <param name="user"> User Object</param>
        public List <Message> GetMessages(int UserId, int ProductId, User user)
        {
            /// <summary>  Store the Message List. </summary>
            List <Message> messages = new List <Message>();

            tblMessageProductUser = adpMessageProductUser.GetMessages(UserId, ProductId);

            System.Diagnostics.Debug.WriteLine(tblMessageProductUser.GetErrors());

            if (tblMessageProductUser.Count > 0)
            {
                foreach (var row in tblMessageProductUser)
                {
                    /// <summary>  Store the Message object. </summary>
                    Message message;
                    if (row.MessageFromUserId == user.UserId)
                    {
                        message = new Message(row.MessageText, row.UserImage, row.MessageCreationDateTime, row.MessageFromUserId, false);
                    }
                    else
                    {
                        message = new Message(row.MessageText, row.UserImage, row.MessageCreationDateTime, row.MessageFromUserId, true);
                    }
                    messages.Add(message);
                    //string senderName = row.UserFirstName.ToString();
                    //System.Diagnostics.Debug.WriteLine(row.);
                }
            }
            return(messages);
        }