示例#1
0
 /* ****************************************************************** */
 /* Constructors                                                       */
 /* ****************************************************************** */
 public ContributionBE()
 {
     contributor = null;
     project = null;
     amount = 0.0f;
     date = new DateTime();
 }
示例#2
0
 /// <summary>
 /// Auxiliary Constructor.
 /// Creates a new contribution business entity filling the fields
 /// with the provided ones.
 /// </summary>
 /// <param name="contributor">The user that performed the contribution.</param>
 /// <param name="project">The destination project of the contribution</param>
 /// <param name="amount">The amount of credits contributed.</param>
 /// <param name="date">The date when the contribution was made.</param>
 public ContributionBE(UserBE contributor, ProjectBE project, int amount, DateTime date)
 {
     this.contributor = contributor;
     this.project = project;
     this.amount = amount;
     this.date = date;
 }
示例#3
0
 /// <summary>
 /// Copy Constructor.
 /// Creates a new contribution business entity by copying the fields
 /// of another contribution BE.
 /// </summary>
 /// <param name="contribution">The source contribution.</param>
 public ContributionBE(ContributionBE contribution)
 {
     this.contributor = contribution.contributor;
     this.project = contribution.project;
     this.amount = contribution.amount;
     this.date = contribution.date;
 }
        protected void developing(object sender, EventArgs e)
        {
            //Get the query string parameters.
            string projectTitle = Session["ProjectTitle"].ToString();
            int projectCode = Int32.Parse(Session["ProjectCode"].ToString());

            //Create a project and look for the one we are being asked.
            ProjectBE project = new ProjectBE();
            project.Code = projectCode;
            project = project.getByCode();

            //We get the user who wants to develop.
            UserBE user = new UserBE();
            user.Email = Session["UserEmail"].ToString();
            user = user.getUserByEmail();

            DateTime date = DateTime.Now;
            String gitUrl = "none";
            int votes = 0;

            DevelopmentBE develop = new DevelopmentBE(project, user, date, gitUrl, votes);

            develop.create();

            developFeedback.ForeColor = System.Drawing.Color.Red;
            developFeedback.Text = "Accepted";
        }
示例#5
0
 // /////////////////////////////////////////////////////////////////////
 // Constructors ////////////////////////////////////////////////////////
 // /////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Default Constructor.
 /// Creates a new contribution business entity with "empty" values.
 /// </summary>
 public ContributionBE()
 {
     contributor = new UserBE();
     project = new ProjectBE();
     amount = 0;
     date = DateTime.Now;
 }
示例#6
0
        public ProjectBE getProject(string code)
        {
            ProjectBE project = new ProjectBE();

            SqlConnection c = new SqlConnection(connection);
            c.Open();

            SqlCommand com = new SqlCommand("SELECT * FROM projects WHERE code='" + code + "'", c);

            SqlDataReader dr = com.ExecuteReader();

            while (dr.Read())
            {
                project.Code = dr["code"].ToString();
                project.Title = dr["title"].ToString();
                project.Description = dr["description"].ToString();
                //project.ExpirationDate DEALING WITH DATETIMES
                //more datetimes
                project.State = (ProjectState)Int32.Parse(dr["state"].ToString());
                project.Credit = Int32.Parse(dr["total_bank"].ToString());
                project.GitDir = dr["gitdir"].ToString();
                project.Creator = new UserBE();
                project.Creator.Email = dr["creator"].ToString();
            }

            c.Close();
            return project;
        }
示例#7
0
 // /////////////////////////////////////////////////////////////////////
 // Constructors ////////////////////////////////////////////////////////
 // /////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Default Constructor.
 /// Creates a new comment business entity with "empty" values.
 /// </summary>
 public CommentBE()
 {
     writer = new UserBE();
     project = new ProjectBE();
     date = DateTime.Now;
     content = "";
 }
示例#8
0
 /// <summary>
 /// Copy Constructor.
 /// Creates a new development business entity by copying the fields
 /// of another development BE.
 /// </summary>
 /// <param name="development"></param>
 public DevelopmentBE(DevelopmentBE development)
 {
     this.project = development.project;
     this.user = development.user;
     this.date = development.date;
     this.gitBranch = development.gitBranch;
     this.ups = development.ups;
 }
示例#9
0
 /// <summary>
 /// Auxiliary Constructor.
 /// Creates a new development business entity initializing its fields with
 /// the provided ones.
 /// </summary>
 /// <param name="project">The project of the development.</param>
 /// <param name="user">The user that makes the development.</param>
 /// <param name="date">The date when the development was submitted.</param>
 /// <param name="gitBranch">The git branch URL of the development.</param>
 /// <param name="ups">The number of upvotes (positive reviews).</param>
 public DevelopmentBE(ProjectBE project, UserBE user, DateTime date, string gitBranch, int ups)
 {
     this.project = project;
     this.user = user;
     this.date = date;
     this.gitBranch = gitBranch;
     this.ups = ups;
 }
示例#10
0
 /// <summary>
 /// Auxiliary Constructor.
 /// Creates a new comment business entity initializing its fields with
 /// the provided ones.
 /// </summary>
 /// <param name="writer">The writer of the comment.</param>
 /// <param name="project">The project which is being commented.</param>
 /// <param name="creation_date">The date when the comment was submitted.</param>
 /// <param name="content">The comment body.</param>
 public CommentBE(UserBE writer, ProjectBE project, DateTime creation_date,
     string content)
 {
     this.writer = writer;
     this.project = project;
     this.date = creation_date;
     this.content = content;
 }
示例#11
0
 public CommentBE()
 {
     code = "";
     writer = new UserBE();
     project = new ProjectBE();
     title = "";
     content = "";
     projectAssessment = -1;
 }
示例#12
0
 /* ****************************************************************** */
 /* Constructors                                                       */
 /* ****************************************************************** */
 public NewsBE()
 {
     title = "";
     content = "";
     author = new UserBE();
     code = -1;
     publicationDate = new DateTime();
     topic = new DevelopmentBE();
     project = new ProjectBE();
 }
示例#13
0
        /*
         * Default constructor. We do not receive a commentAssesment because
         * it is a new comment so it can not have assessments before being created.
         * The date is also not necesary. We will assign it.
         */
        public CommentBE(UserBE writer, ProjectBE project, string title, 
            string content, int projectAssessment)
        {
            code = generateCode();

                this.writer = writer;
                this.project = project;
                this.title = title;
                this.content = content;
                this.projectAssessment = projectAssessment;
        }
示例#14
0
 public NewsBE(string title, string content, int code,
     UserBE author, DateTime publicationDate,
     DevelopmentBE topic, ProjectBE project)
 {
     this.code = code;
     this.title = title;
     this.content = content;
     this.author = author;
     this.publicationDate = publicationDate;
     this.topic = topic;
     this.project = project;
 }
示例#15
0
        /// <summary>
        /// Project Comments getter.
        /// This method get the comments written in a given project.
        /// Those comments are returned in a data set in order to ease the
        /// task of showing it in gridviews.
        /// </summary>
        /// <param name="project">The project we want to get comments from.</param>
        /// <returns>A data set with the comments.</returns>
        public static DataSet getProjectComments(ProjectBE project)
        {
            DataSet d = new DataSet();
            String s = ConfigurationManager.ConnectionStrings["ShodeDDBB"].ToString();
            SqlConnection c = new SqlConnection(s);
            SqlDataAdapter da = new SqlDataAdapter("Select nickname, date, comment from users, comments" +
                " where project=" + project.Code + " and comments.usr=users.email", c);
            da.Fill(d, "comments");
            c.Close();

            return d;
        }
示例#16
0
        protected void create_Project(object sender, EventArgs e)
        {
            bool correct = true;

            if (creditsTextboxProject.Text.Length == 0 ||
                Int32.Parse(creditsTextboxProject.Text) > Int32.Parse(Session["UserCredit"].ToString()))
            {
                creditsFeedback.Visible = true;
                correct = false;
            }
            else
                creditsFeedback.Text = "";

            if (correct)
            {
                //Project information.
                String tittle = tittleProjectTextbox.Text;
                String description = descriptionTextbox.Text;
                UserBE user1 = new UserBE("", 0, "", "", Session["UserNickname"].ToString(), "");
                UserBE creator = new UserBE(user1.getUserByNick());
                int code = -1;
                DateTime creation = DateTime.Now;
                DateTime expires = DateTime.MinValue;
                int credit = Int32.Parse(creditsTextboxProject.Text);
                DateTime version = DateTime.Now;
                String gitDir = "There";

                //Update the UserBE credits and also the Sessión value.
                String currentCredits = Session["UserCredit"].ToString();
                Session["UserCredit"] = Int32.Parse(currentCredits) - credit;
                creator.Credit = Int32.Parse(currentCredits) - credit;
                creator.update();

                //Project creation.
                ProjectBE crProject = new ProjectBE(tittle, description, creator, code,
                    creation, expires, credit, credit, version, gitDir);
                crProject.create();
                crProject.Code = crProject.getLastCode();

                //When you create a project, you are contributing to it.
                ContributionBE contribution = new ContributionBE(creator, crProject, credit, DateTime.Now);
                contribution.create();

                creationFeedback.Text = "Project created successfully!";
                creationFeedback.ForeColor = System.Drawing.Color.Green;
            }
        }
        protected void contribute(object sender, EventArgs e)
        {
            if (creditsBox.Text.Length > 2)
            {
                if (Int32.Parse(creditsBox.Text) <= Int32.Parse(Session["UserCredit"].ToString()))
                {
                    //Get the query string parameters.
                    string projectTitle = Session["ProjectTitle"].ToString();
                    int projectCode = Int32.Parse(Session["ProjectCode"].ToString());
                    int credits = Int32.Parse(creditsBox.Text);

                    //Create a project and look for the one we are being asked.
                    ProjectBE project = new ProjectBE();
                    project.Code = projectCode;
                    project = project.getByCode();

                    project.Credit = project.Credit + credits;
                    project.PartitionCredit = project.PartitionCredit + credits;

                    project.update();

                    //We need the user, so we update its credits.
                    UserBE usuario = new UserBE();
                    usuario.Email = Session["UserEmail"].ToString();
                    usuario = usuario.getUserByEmail();
                    usuario.Credit = usuario.Credit - credits;
                    usuario.update();
                    Session["UserCredit"] = usuario.Credit;

                    //And we must also create the contribution entry.
                    ContributionBE contr = new ContributionBE(usuario, project, Int32.Parse(creditsBox.Text), DateTime.Now);
                    contr.create();

                    FeedbackCredit.Text = "Done!";
                    projectProfileLabelCredits.Text = project.Credit.ToString();
                    FeedbackCredit.Visible = true;
                }
                else
                {
                    FeedbackCredit.Text = "Wrong quantity.";
                    FeedbackCredit.Visible = true;
                }
            }
        }
示例#18
0
        // /////////////////////////////////////////////////////////////////////
        // Methods /////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Project Insertion.
        /// Inserts the given project in the database building the adequate
        /// query and handling the possible SQL errors that can occur when
        /// performing the query. 
        /// </summary>
        /// <param name="project">The project to be inserted.</param>
        /// <returns>A string which contains an error/success message.</returns>
        public string insert(ProjectBE project)
        {
            string result = "The project has been created!";

            SqlConnection c = new SqlConnection(connection);

            try
            {
                c.Open();

                SqlParameter title = new SqlParameter();
                title.ParameterName = "@title";
                title.Value = project.Title;
                SqlParameter description = new SqlParameter();
                description.ParameterName = "@description";
                description.Value = project.Description;
                SqlParameter total_bank = new SqlParameter();
                total_bank.ParameterName = "@total_bank";
                total_bank.Value = project.Credit.ToString();
                SqlParameter gitdir = new SqlParameter();
                gitdir.ParameterName = "@gitdir";
                gitdir.Value = project.GitDir;
                SqlParameter creator = new SqlParameter();
                creator.ParameterName = "@creator";
                creator.Value = project.Creator.Email;
                SqlParameter code = new SqlParameter();
                code.ParameterName = "@code";
                code.Value = project.Code.ToString();
                SqlParameter expiration_date = new SqlParameter();
                expiration_date.ParameterName = "@expiration_date";
                expiration_date.Value = project.ExpirationDate.ToString("dd/MM/yyyy");
                SqlParameter creation_date = new SqlParameter();
                creation_date.ParameterName = "@creation_date";
                creation_date.Value = project.CreationDate.ToString("dd/MM/yyyy");
                SqlParameter last_partition = new SqlParameter();
                last_partition.ParameterName = "@last_partition";
                last_partition.Value = project.LastVersion.ToString("dd/MM/yyyy");
                SqlParameter partition_bank = new SqlParameter();
                partition_bank.ParameterName = "@partition_bank";
                partition_bank.Value = project.PartitionCredit.ToString();

                SqlCommand com = new SqlCommand("INSERT INTO projects (title, description, deadline," +
                    "creation_date, state, total_bank, last_partition, partition_bank, gitdir, creator)" +
                    "VALUES (@title , @description , @expiration_date , @creation_date , 1 , @total_bank , @last_partition , @partition_bank , @gitdir , @creator)", c);

                com.Parameters.Add(title);
                com.Parameters.Add(description);
                com.Parameters.Add(expiration_date);
                com.Parameters.Add(creation_date);
                com.Parameters.Add(total_bank);
                com.Parameters.Add(last_partition);
                com.Parameters.Add(partition_bank);
                com.Parameters.Add(gitdir);
                com.Parameters.Add(creator);

                com.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                if (ex.Message.Contains("PRIMARY KEY"))
                    result = "ERROR: A project has already that code.";
            }
            catch (Exception ex)
            {
                result = "ERROR: Unknown error, try it again later...";
            }
            finally
            {
                c.Close();
            }

            return result;
        }
        protected void pageChanging(object sender, GridViewPageEventArgs e)
        {
            //Get the query string parameters.
            string projectTitle = Session["ProjectTitle"].ToString();
            int projectCode = Int32.Parse(Session["ProjectCode"].ToString());

            //Create a project and look for the one we are being asked.
            ProjectBE project = new ProjectBE();
            project.Code = projectCode;
            project = project.getByCode();

            DataSet d = new DataSet();
            String s = ConfigurationManager.ConnectionStrings["ShodeDDBB"].ToString();
            SqlConnection c = new SqlConnection(s);
            SqlDataAdapter da = new SqlDataAdapter("Select nickname, date, comment from users, comments" +
                " where project=" + project.Code + " and comments.usr=users.email", c);
            da.Fill(d, "comments");

            gridComments.PageIndex = e.NewPageIndex;
            gridComments.DataSource = d;
            gridComments.DataBind();
        }
示例#20
0
 // /////////////////////////////////////////////////////////////////////
 // Constructors ////////////////////////////////////////////////////////
 // /////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Default Constructor.
 /// Creates a new development business entity with "empty" values.
 /// </summary>
 public DevelopmentBE()
 {
     project = new ProjectBE();
     user = new UserBE();
     date = DateTime.Now;
 }
        protected void uploadComment(object sender, EventArgs e)
        {
            //Get the query string parameters.
            string projectTitle = Session["ProjectTitle"].ToString();
            int projectCode = Int32.Parse(Session["ProjectCode"].ToString());

            //Create a project and look for the one we are being asked.
            ProjectBE project = new ProjectBE();
            project.Code = projectCode;
            project = project.getByCode();

            //If we get something different from the database, or nothing: error.
            //They could have change since we opened the page.
            if (project.Code != projectCode || project.Title != projectTitle)
                Response.Redirect("Error.aspx");

            //We need this so we get the nickname and we do not show the user's email to the public.
            UserBE writer = new UserBE();
            writer.Email = Session["UserEmail"].ToString();
            writer = writer.getUserByEmail();

            //Now we get the dateTime
            DateTime creationDate = DateTime.Now;

            //And the message content.
            String message = commentProjectText.Text;

            //Comment creation
            CommentBE crComment = new CommentBE(writer, project, creationDate, message);

            crComment.create();

            //Reload the page with the added comment.
            Response.Redirect(Request.RawUrl);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //We need the title and the code. Otherwise the user must be playing with the URL.
            if (Request.QueryString["ProTitle"] == null || Request.QueryString["ProTitle"]==""
                || Request.QueryString["Code"] == null || Request.QueryString["Code"]=="")
                Response.Redirect("Error.aspx");

            HttpCookie userCookie = Request.Cookies["UserNickname"];

            if (userCookie != null)
                SiteMaster.loadCookie(userCookie);

            if (Session["UserNickname"] == null)
            {
                GiveLabel.Visible = false;
                creditsBox.Visible = false;
                sendCredits.Visible = false;
                checkCredtisProfile.Visible = false;

                developButton.Visible = false;

                commentProjectLabel.Visible = false;
                commentProjectText.Visible = false;
                sendCommentProject.Visible = false;
                commentTextRequired.Visible = false;
                commentCorrectness.Visible = false;
            }

            FeedbackCredit.Visible = false;

            //Get the query string parameters.
            string projectTitle = Request.QueryString["ProTitle"].ToString();
            Session["ProjectTitle"] = projectTitle;
            int projectCode = Int32.Parse(Request.QueryString["Code"].ToString());
            Session["ProjectCode"] = projectCode;

            //Create a project and look for the one we are being asked.
            ProjectBE project = new ProjectBE();
            project.Code = projectCode;
            project = project.getByCode();

            //If we get something different from the database, or nothing: error.
            //The code and the title must match. Otherwise, the user is playing with the URL.
            if (project.Code != projectCode || project.Title != projectTitle)
            {
                Session["ProjectTitle"] = null;
                Session["ProjectCode"] = null;
                Response.Redirect("Error.aspx");
            }

            //We need this so we get the nickname and we do not show the user's email to the public.
            UserBE usuario = new UserBE();
            usuario.Email = project.Creator.Email;
            usuario = usuario.getUserByEmail();

            profileTittleLabel.Text = project.Title;
            projectProfileDescription.Text = project.Description;
            projectProfileLabelUser.Text = usuario.Nickname;
            projectProfileLabelDate.Text = project.CreationDate.ToString();
            projectProfileLabelState.Text = project.State.ToString();
            projectProfileLabelCredits.Text = project.Credit.ToString();

            //Project comments
            gridComments.DataSource = project.getComments();
            gridComments.DataBind();

            Page.Title = project.Title;
        }
示例#23
0
        /// <summary>
        /// All Projects Getter.
        /// Gets a list with all the projects in the database.
        /// </summary>
        /// <returns>The project list.</returns>
        public List<ProjectBE> getAllProjects()
        {
            List<ProjectBE> projects = new List<ProjectBE>();

            ProjectBE project = new ProjectBE();

            SqlConnection c = new SqlConnection(connection);

            try
            {
                c.Open();

                SqlCommand com = new SqlCommand("SELECT * FROM projects", c);

                SqlDataReader dr = com.ExecuteReader();

                while (dr.Read())
                {
                    project.Code = Int32.Parse(dr["code"].ToString());
                    project.Title = dr["title"].ToString();
                    project.Description = dr["description"].ToString();
                    project.CreationDate = DateTime.ParseExact(dr["creation_date"].ToString(), "dd/MM/yyyy", null);
                    project.ExpirationDate = DateTime.ParseExact(dr["deadline"].ToString(), "dd/MM/yyyy", null);
                    project.State = (ProjectState)Int32.Parse(dr["state"].ToString());
                    project.Credit = Int32.Parse(dr["total_bank"].ToString());
                    project.GitDir = dr["gitdir"].ToString();
                    project.Creator = new UserBE();
                    project.Creator.Email = dr["creator"].ToString();
                    projects.Add(project);
                }
            }
            catch (Exception ex)
            {
                // Show message box
            }
            finally
            {
                c.Close();
            }

            return projects;
        }
示例#24
0
        public void updateProject(ProjectBE project)
        {
            SqlConnection c = new SqlConnection(connection);
            c.Open();

            SqlCommand com = new SqlCommand("UPDATE projects " +
                "SET code='" + project.Code + "', title='" + project.Title + "', description='" + project.Description +
                "', state=" + project.State + ", total_bank=" + project.Credit + ", gitdir='" + project.GitDir + "', creator='" + project.Creator.Email + "' " +
                " WHERE code='" + project.Code + "'", c);

            com.ExecuteNonQuery();
            c.Close();
        }
示例#25
0
        /// <summary>
        /// Project Getter.
        /// Fetchs a determined project from the database given its project code.
        /// </summary>
        /// <param name="projectCode">The code of the project to be fetched.</param>
        /// <returns>The fetched project if found, an empty one if not.</returns>
        public ProjectBE getProject(int projectCode)
        {
            ProjectBE project = new ProjectBE();

            SqlConnection c = new SqlConnection(connection);

            try
            {
                c.Open();

                SqlParameter code = new SqlParameter();
                code.ParameterName = "@code";
                code.Value = projectCode.ToString();

                SqlCommand com = new SqlCommand("SELECT * FROM projects WHERE code=@code", c);

                com.Parameters.Add(code);

                SqlDataReader dr = com.ExecuteReader();

                while (dr.Read())
                {
                    project.Code = Int32.Parse(dr["code"].ToString());
                    project.Title = dr["title"].ToString();
                    project.Description = dr["description"].ToString();
                    project.CreationDate = DateTime.ParseExact(dr["creation_date"].ToString(), "dd/MM/yyyy", null);
                    project.ExpirationDate = DateTime.ParseExact(dr["deadline"].ToString(), "dd/MM/yyyy", null);
                    project.State = (ProjectState)Int32.Parse(dr["state"].ToString());
                    project.Credit = Int32.Parse(dr["total_bank"].ToString());
                    project.GitDir = dr["gitdir"].ToString();
                    project.Creator = new UserBE();
                    project.Creator.Email = dr["creator"].ToString();
                }
            }
            catch (Exception ex)
            {
                // Show message box
            }
            finally
            {
                c.Close();
            }

            return project;
        }
示例#26
0
 /*
  * Obtain the top three commentarties in a given project.
  */
 public List<CommentBE> getTopCommentsProject(ProjectBE project)
 {
     List<CommentBE> topComments = new List<CommentBE>();
     //TODO
     return topComments;
 }
示例#27
0
        /// <summary>
        /// Project Update.
        /// Updates the database register which matches the given
        /// project replacing all the database fields with
        /// the ones of the provided contribution.
        /// </summary>
        /// <param name="project">The "source" project that will be updated.</param>
        public void update(ProjectBE project)
        {
            SqlConnection c = new SqlConnection(connection);

            try
            {
                c.Open();

                SqlParameter title = new SqlParameter();
                title.ParameterName = "@title";
                title.Value = project.Title;
                SqlParameter description = new SqlParameter();
                description.ParameterName = "@description";
                description.Value = project.Description;
                SqlParameter total_bank = new SqlParameter();
                total_bank.ParameterName = "@total_bank";
                total_bank.Value = project.Credit.ToString();
                SqlParameter gitdir = new SqlParameter();
                gitdir.ParameterName = "@gitdir";
                gitdir.Value = project.GitDir;
                SqlParameter creator = new SqlParameter();
                creator.ParameterName = "@creator";
                creator.Value = project.Creator.Email;
                SqlParameter code = new SqlParameter();
                code.ParameterName = "@code";
                code.Value = project.Code.ToString();
                SqlParameter deadline = new SqlParameter();
                deadline.ParameterName = "@deadline";
                deadline.Value = project.ExpirationDate.ToString("dd/MM/yyyy");
                SqlParameter creation_date = new SqlParameter();
                creation_date.ParameterName = "@creation_date";
                creation_date.Value = project.CreationDate.ToString("dd/MM/yyyy");
                SqlParameter last_partition = new SqlParameter();
                last_partition.ParameterName = "@last_partition";
                last_partition.Value = project.LastVersion.ToString("dd/MM/yyyy");
                SqlParameter partition_bank = new SqlParameter();
                partition_bank.ParameterName = "@partition_bank";
                partition_bank.Value = project.PartitionCredit.ToString();

                SqlCommand com = new SqlCommand("UPDATE projects " +
                    "SET title=@title , description=@description , state=1, total_bank=@total_bank , creation_date=@creation_date ," +
                    "deadline=@deadline , last_partition=@last_partition , partition_bank=@partition_bank , gitdir=@gitdir , creator=@creator" +
                    " WHERE code=@code", c);

                com.Parameters.Add(title);
                com.Parameters.Add(description);
                com.Parameters.Add(total_bank);
                com.Parameters.Add(creation_date);
                com.Parameters.Add(deadline);
                com.Parameters.Add(last_partition);
                com.Parameters.Add(partition_bank);
                com.Parameters.Add(gitdir);
                com.Parameters.Add(creator);
                com.Parameters.Add(code);

                com.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                c.Close();
            }
        }
示例#28
0
 /*
  * Method for obtaining all the comments a given user has written in
  * a determined project.
  */
 public List<CommentBE> getCommentsInProjectBy(ProjectBE project, UserBE user)
 {
     List<CommentBE> comments = new List<CommentBE>();
     //TODO
     return comments;
 }
示例#29
0
        public string insertProject(ProjectBE project)
        {
            string code = GenerateCode().ToString();

            SqlConnection c = new SqlConnection(connection);
            c.Open();

            SqlCommand com = new SqlCommand("INSERT INTO projects (code, title, description, deadline, creation_date, state, total_bank, last_partition, gitdir, creator)" +
                " VALUES ('" + code + "','" + project.Title + "','" + project.Description + "','" + project.ExpirationDate.ToString() + "','" + project.CreationDate.ToString() + "'," +
                project.State + ", " + project.Credit + ",'" + project.LastVersion.ToString() + "','" + project.GitDir + "','" + project.Creator.Email + "')", c);

            com.ExecuteNonQuery();
            c.Close();

            return code;
        }