public PartialViewResult DetailTableView(string tableid, string id)
        {
            // Define the base SQL query
            string SQLString = "SELECT tblorder_event_queue.*, c_status.name FROM tblorder_event_queue, c_status WHERE tblorder_event_queue.EventID = c_status.StatusID and tblorder_event_queue.OrderID IN (" + id + ") and tblorder_event_queue.CategoryID=2";

            // Add the group by clause
            SQLString += " ORDER BY tblorder_event_queue.UpdateDate";

            // Create a list of our result class to hold the data from the query
            // Please ensure you instatiate the class for this controller and not a different controller
            List <PurchaseEventQuene> result = new List <PurchaseEventQuene>();

            // Execute the SQL query and get the results
            using (MySqlDataAdapter adapter = new MySqlDataAdapter(SQLString, new MySqlConnection(Helpers.Helpers.GetERPConnectionString())))
            {
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                DataTable tb = (DataTable)ds.Tables[0];
                if (tb != null && tb.Rows.Count > 0)
                {
                    for (int i = 0; i < tb.Rows.Count; i++)
                    {
                        DataRow dr = tb.Rows[i];
                        result.Add(PurchaseEventQuene.fillInObject(dr));
                    }
                }
            }
            ViewBag.tableid = tableid;
            return(PartialView("DetailTableView", result));
        }
        public static PurchaseEventQuene fillInObject(DataRow dr)
        {
            PurchaseEventQuene account = new PurchaseEventQuene();

            account.OrderEventQueueID = Int32.Parse(dr["OrderEventQueueID"].ToString());
            if (dr["OrderID"] != DBNull.Value)
            {
                account.OrderID = Int32.Parse(dr["OrderID"].ToString());
            }
            if (dr["EventID"] != DBNull.Value)
            {
                account.EventID = Int32.Parse(dr["EventID"].ToString());
            }
            account.Note = dr["Note"].ToString();
            if (dr["UpdateDate"] != DBNull.Value)
            {
                account.UpdateDate = DateTime.Parse(dr["UpdateDate"].ToString());
            }
            account.name = dr["name"].ToString();
            return(account);
        }