Esempio n. 1
0
        public User userLogin(User u)
        {
            dbCon.SqlQuery("userLogin");
            dbCon.cmd.CommandType = CommandType.StoredProcedure;

            dbCon.cmd.Parameters.AddWithValue("@Email", u.email);
            dbCon.cmd.Parameters.AddWithValue("@Password", u.password);

            if (dbCon.cmd.ExecuteScalar() == null)
            {
                return(null);
            }
            else
            {
                DataTable dt = new DataTable();
                dt = dbCon.ExQuery();
                DataRow dr   = dbCon.dt.Rows[0];
                User    temp = new User();
                temp.id       = (int)dr["id"];
                temp.email    = dr["Email"].ToString();
                temp.password = dr["Password"].ToString();
                temp.role     = dr["role"].ToString();
                return(temp);
            }
        }
        public bool createBug(Bug bBug)
        {
            try
            {
                dbCon.SqlQuery("insert into bugs (title,description,deadline,status,assignTime,priority,userID_FK) values (@title,@description,@deadline,@status,@assignTime,@priority,@userID_FK)");
                dbCon.cmd.Parameters.AddWithValue("@title", bBug.title);
                dbCon.cmd.Parameters.AddWithValue("@deadline", bBug.deadline);
                dbCon.cmd.Parameters.AddWithValue("@description", bBug.description);
                dbCon.cmd.Parameters.AddWithValue("@status", "Open");
                dbCon.cmd.Parameters.AddWithValue("@assignTime", bBug.assignTime);
                dbCon.cmd.Parameters.AddWithValue("@priority", bBug.priority);
                dbCon.cmd.Parameters.AddWithValue("@userID_FK", bBug.userID_FK);

                dbCon.ExQuery();
                return(true);
            }

            catch (Exception)
            {
                return(false);

                throw;
            }
        }
        public void addMemberToTeam(int team_id, int user_id)
        {
            try
            {
                dbCon.SqlQuery("insert into user_team_junc (userID_FK,teamID_FK)  values (@userID_FK,@teamID_FK)");
                dbCon.cmd.Parameters.AddWithValue("@teamID_FK", team_id);
                dbCon.cmd.Parameters.AddWithValue("@userID_FK", user_id);
                dbCon.ExQuery();
            }

            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        public bool createProject(Project dProject)
        {
            try
            {
                dbCon.SqlQuery("insert into projects (title,category,description,postDate) values (@title,@category,@description,@postDate)");
                dbCon.cmd.Parameters.AddWithValue("@title", dProject.title);
                dbCon.cmd.Parameters.AddWithValue("@category", dProject.category);
                dbCon.cmd.Parameters.AddWithValue("@description", dProject.description);
                dbCon.cmd.Parameters.AddWithValue("@postDate", dProject.postDate);
                dbCon.ExQuery();
                return(true);
            }

            catch (Exception)
            {
                return(false);

                throw;
            }
        }