public ActionResult Comment(int id, FormCollection collection)
        {
            try
            {
               // Admin.Models.Project.Project user = new Admin.Models.Project.Project();
                 Admin.Models.Project.Project proj = new Admin.Models.Project.Project();
                 Admin.Models.Project.Project com = new Admin.Models.Project.Project();
                var CommentList = new List<Admin.Models.Project.Project>();
                proj=model.GetUsernameByMemberID(Int32.Parse(Session["SelectedMemberID"].ToString()));
                var name =proj.UserName;
               // model.GetAllComments(id);
               //user=model.GetUsernameByMemberID(proj.MemberID);
               // var name=user.UserName;
                var selectedDiscussionID = Int32.Parse(Session["SelectedDiscussionID"].ToString());
                model.CreateComments(selectedDiscussionID, collection.Get("Comments"),name);
                ViewData["DiscussionID"] = id;
                Session["SelectedDiscussionID"] = id;
                com = model.GetCommentIDByDiscussionID(id);
                Session["SelectedCommentID"] = com.CommentedBy;
                return View("CommentList");

            }
            catch
            {
                return View();
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            try
            {

                Admin.Models.Project.Project proj = new Admin.Models.Project.Project();
                var projectList = new List<Admin.Models.Project.Project>();
                var mems = collection.Get("members");
                //    var file = collection.Get("");

                model.CreateProject(collection.Get("ProjectTitle"), collection.Get("ProjectDescription"), collection.Get("FirstName"), collection.Get("LastName"), Convert.ToString(mems));

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Example #3
0
        public Project Comments(int did)
        {
            Project data = new Project();
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select DiscussionID,CommentedBy,Comment from tbl_Comment where DiscussionID=@ID";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@ID", did);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        data.DiscussionID = Int32.Parse(sqlConn.Reader["DiscussionID"].ToString());
                        data.Comments = sqlConn.Reader["Comment"].ToString();
                        data.CommentedBy = sqlConn.Reader["CommentedBy"].ToString();

                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return data;
        }
 //////////////////////// comments here //////////////
 //public ActionResult Comment(int id)
 //{
 //    ProjectLab.Areas.Admin.Models.Project.Project data = new ProjectLab.Areas.Admin.Models.Project.Project();
 //    var commList = new List<Admin.Models.Project.Peroject>();
 //    var disList = new List<Admin.Models.Project.Project>();
 //    ViewData["DiscussionID"] = Session["SelectedDiscussionID"];
 //    Session["SelectedDiscussionID"] = id;
 //    return View("CreateComments");
 //}
 public ActionResult ListComment(int id)
 {
     Admin.Models.Project.Project data = new Admin.Models.Project.Project();
     ViewData["DiscussionID"] = Session["SelectedDiscussionID"];
     return View("CommentList");
 }
        public ActionResult Discussion(int id, FormCollection collection)
        {
            try
            {

                Admin.Models.Project.Project proj = new Admin.Models.Project.Project();
                Admin.Models.Project.Project discuss = new Admin.Models.Project.Project();
                var discussList = new List<Admin.Models.Project.Project>();
                // var id = collection.Get("ProjectID");
                ViewData["ProjectID"] = id;
                proj = model.GetUsernameByMemberID(Int32.Parse(Session["SelectedMemberID"].ToString()));
                var mid = proj.UserName;
                var selectedProjectID = Int32.Parse(Session["SelectedProjectID"].ToString());
                model.CreateDiscussion(selectedProjectID, collection.Get("DiscussionTitle"), collection.Get("DiscussionDescription"),mid);
                discuss = model.GetDiscussionIdByProjectId(id);
                Session["SelectedDiscussionID"] = discuss.DiscussionID;
                 return View("Listed");

            }
            catch
            {
                return View();
            }
        }
Example #6
0
        /// <summary>
        /// //////////////////////////////get only comments start here.....
        /// </summary>
        /// <param name="did"></param>
        /// <returns></returns>
        public List<Project> GetOnlyComments(int did)
        {
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            Project comm = new Project();
            var commlist = new List<Project>();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select DiscussionID,Comment from tbl_Comment where DiscussionID=@id";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@id", did);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        commlist.Add(new Admin.Models.Project.Project
                        {

                            ProjectID = Int32.Parse(sqlConn.Reader["DiscussionID"].ToString()),
                            ProjectTitle = sqlConn.Reader["Comment"].ToString(),
                            CreatedAt=DateTime.Parse(sqlConn.Reader["CreatedAt"].ToString()),
                        });
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return commlist;
        }
Example #7
0
        public Project GetMembersByProjectID(int pid)
        {
            Project data = new Project();
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select Members from tbl_Projects where ProjectID=@ID";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@ID", pid);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                       // data.ProjectID = Int32.Parse(sqlConn.Reader["ProjectID"].ToString());
                        data.ProjectMembers = sqlConn.Reader["Members"].ToString();

                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return data;
        }
Example #8
0
        public Project GetData(int projectID)
        {
            Project proj = new Project();
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select * from tbl_Projects where ProjectID=@projectID";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@projectID", projectID);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        proj.ProjectID = Int32.Parse(sqlConn.Reader["ProjectID"].ToString());
                        proj.ProjectTitle = sqlConn.Reader["ProjectTitle"].ToString();
                        proj.ProjectDescription = sqlConn.Reader["ProjectDescription"].ToString();
                        proj.ProjectMembers = sqlConn.Reader["Members"].ToString();
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return proj;
        }
Example #9
0
        public Project GetDiscussionTitleByDiscussionID(int ID)
        {
            {
                Project proj = new Project();
                SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
                try
                {
                    sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                    sqlConn.Query = "select DiscussionTitle from tbl_discussion where DiscussionID=@disID";
                    sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                    sqlConn.Command.Parameters.AddWithValue("@disID", ID);
                    sqlConn.Connection.Open();

                    using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                    {
                        while (sqlConn.Reader.Read())
                        {

                            // proj.DiscussionID = Int32.Parse(sqlConn.Reader["DiscussionID"].ToString());
                            proj.DiscussionTitle = sqlConn.Reader["DiscussionTitle"].ToString();

                          //  proj.CreatedAt = DateTime.Parse(sqlConn.Reader["CreatedAt"].ToString());

                        }
                    }

                }
                catch (Exception ex)
                {

                    throw ex;
                }
                finally
                {
                    if (sqlConn.Reader != null)
                        sqlConn.Reader.Close();
                    sqlConn.Connection.Close();
                    sqlConn.Connection.Dispose();

                }

                return proj;
            }
        }
Example #10
0
        /////////////////////////////////start for the discussion list////////////////
        public List<Project> GetAllDiscussion(int pid)
        {
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            Project Discuss = new Project();
            var discussList = new List<Project>();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select * from tbl_discussion where ProjectID=@pid";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@pid", pid);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        discussList.Add(new Admin.Models.Project.Project
                        {
                            ProjectID = Int32.Parse(sqlConn.Reader["ProjectID"].ToString()),
                           // DiscussionID = Int32.Parse(sqlConn.Reader["DiscussionID"].ToString()),
                            DiscussionTitle = sqlConn.Reader["DiscussionTitle"].ToString(),
                            DiscussionDescription = sqlConn.Reader["DiscussionDescription"].ToString(),
                            CreatedAt = DateTime.Parse(sqlConn.Reader["CreatedAt"].ToString()),
                            CreatedBy=sqlConn.Reader["CreatedBy"].ToString(),

                        });
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return discussList;
        }
Example #11
0
        public List<Project> GetAllProjects()
        {
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            Project proj = new Project();
            var projectList = new List<Project>();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select p.ProjectID,p.ProjectTitle,p.ProjectDescription,p.Members from tbl_Projects as p";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        projectList.Add(new Admin.Models.Project.Project
                        {
                            ProjectID = Int32.Parse(sqlConn.Reader["ProjectID"].ToString()),
                            ProjectTitle = sqlConn.Reader["ProjectTitle"].ToString(),
                            ProjectDescription = sqlConn.Reader["ProjectDescription"].ToString(),
                            ProjectMembers = sqlConn.Reader["Members"].ToString(),

                        });
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return projectList;
        }
Example #12
0
        //////////////////////////////////////////for discussion ////////////////////////////
        public Project Discussion(int pid)
        {
            Project data = new Project();
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select DiscussionID,DiscussionTitle,DiscussionDescription from tbl_discussion where ProjectID=@ID";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@ID", pid);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        data.DiscussionID = Int32.Parse(sqlConn.Reader["DiscussionID"].ToString());
                        data.ProjectID = Int32.Parse(sqlConn.Reader["ProjectID"].ToString());
                        data.DiscussionTitle = sqlConn.Reader["DiscussionTitle"].ToString();
                        data.DiscussionDescription = sqlConn.Reader["DiscussionDescription"].ToString();

                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return data;
        }
Example #13
0
        public Project GetUsernameByMemberID(int memID)
        {
            Project proj = new Project();
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select MemberID,UserName from tbl_member where MemberID=@ID";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@ID",memID);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        proj.MemberID = Int32.Parse(sqlConn.Reader["MemberID"].ToString());
                        proj.UserName = sqlConn.Reader["UserName"].ToString();
                        // proj.ProjectDescription = sqlConn.Reader["ProjectDescription"].ToString();

                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return proj;
        }
Example #14
0
        public List<Project> getProjectmembersfromProjects()
        {
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            Project pro = new Project();
            var onlymemberlist = new List<Project>();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = " select * from tbl_Projects";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        onlymemberlist.Add(new Admin.Models.Project.Project
                        {
                            MemberID = Int32.Parse(sqlConn.Reader["MemberID"].ToString()),
                            ProjectMembers=sqlConn.Reader["Members"].ToString(),
                            FirstName = sqlConn.Reader["FirstName"].ToString(),
                            LastName = sqlConn.Reader["LastName"].ToString()
                        });
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return onlymemberlist;
        }
Example #15
0
        public Project GetProjectByToDoID(int todoid)
        {
            Project data = new Project();
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select ProjectID from tbl_ToDo where ToDoID=@ID";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@ID", todoid);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        data.ProjectID = Int32.Parse(sqlConn.Reader["ProjectID"].ToString());
                        //    data.Comments = sqlConn.Reader["Comment"].ToString();
                        //  data.CommentedBy = Int32.Parse(sqlConn.Reader["CommentedBy"].ToString());
                        //  data.DiscussionDescription = sqlConn.Reader["DiscussionDescription"].ToString();

                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return data;
        }
Example #16
0
        public List<Project> GetOnlyProjectTitle(int id)
        {
            SQLManager.SQLManager sqlConn = new SQLManager.SQLManager();
            Project title = new Project();
            var titleList = new List<Project>();
            try
            {
                sqlConn.Connection = new SqlConnection(sqlConn.ConnectionString);
                sqlConn.Query = "select ProjectID,ProjectTitle,ProjectDescription,Members from tbl_Projects where ProjectID=@pid";
                sqlConn.Command = new SqlCommand(sqlConn.Query, sqlConn.Connection);
                sqlConn.Command.Parameters.AddWithValue("@pid", id);
                sqlConn.Connection.Open();

                using (sqlConn.Reader = sqlConn.Command.ExecuteReader())
                {
                    while (sqlConn.Reader.Read())
                    {
                        titleList.Add(new Admin.Models.Project.Project
                        {

                            ProjectID = Int32.Parse(sqlConn.Reader["ProjectID"].ToString()),
                            ProjectTitle = sqlConn.Reader["ProjectTitle"].ToString(),
                            ProjectDescription = sqlConn.Reader["ProjectDescription"].ToString(),
                            ProjectMembers = sqlConn.Reader["Members"].ToString(),
                        });
                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                if (sqlConn.Reader != null)
                    sqlConn.Reader.Close();
                sqlConn.Connection.Close();
                sqlConn.Connection.Dispose();

            }

            return titleList;
        }