Ejemplo n.º 1
0
        public int Update(Task updatedTask)
        {
            conn.Open();
            string     query       = "update Task set Name = '" + updatedTask.Name + "', Description='" + updatedTask.Description + "', MinEstDuration='" + updatedTask.MinDuration + "', MaxEstDuration='" + updatedTask.MaxDuration + "', MostLikelyeEstDuration='" + updatedTask.MostLikelyDuration + "', EndDate='" + updatedTask.CompletedDate + "', ModifiedDate='" + updatedTask.ModifiedDate + "', StatusId='" + updatedTask.Status + "', UserId='" + updatedTask.Owner.Id + "', ProjectId='" + updatedTask.Project.Id + "' Where TaskId=" + updatedTask.Id;
            SqlCommand cmd         = new SqlCommand(query, conn);
            int        effectedIds = cmd.ExecuteNonQuery();

            conn.Close();
            return(effectedIds);
        }
Ejemplo n.º 2
0
        public int Insert(Task newTask)
        {
            conn.Open();
            string     query       = "insert into Task(Name, Description, MinEstDuration, MaxEstDuration, MostLikelyeEstDuration, StartDate, EndDate, ModifiedDate, StatusId, UserId, ProjectId) values('" + newTask.Name + "', '" + newTask.Description + "', '" + newTask.MinDuration + "', '" + newTask.MaxDuration + "', '" + newTask.MostLikelyDuration + "', '" + newTask.StartedDate + "', '" + newTask.CompletedDate + "', '" + newTask.ModifiedDate + "', '" + newTask.Status + "', '" + newTask.Owner.Id + "', '" + newTask.Project.Id + "')'";
            SqlCommand cmd         = new SqlCommand(query, conn);
            int        effectedIds = cmd.ExecuteNonQuery();

            conn.Close();
            return(effectedIds);
        }