示例#1
0
 public Task addTask(string Name, DateTime CreatedDate, DateTime Enddate, string Description)
 {
     if (mID == "") return null;
     else{
         Task t = new Task();
         t.WorkPackageID = mID;
         t.Name = Name;
         t.CreatedDate = CreatedDate;
         t.EndDate = Enddate;
         t.Description = Description;
         t.Save();
         return t;
     }
 }
示例#2
0
文件: User.cs 项目: hotmike49/PM
        /************************************************************************************************************
        STATISCHE METHODEN
        internal bedeutet, dass sie nur von Klassen aus BOKunden (aus dem eigenem Namespace) aufgerufen werden können
        - also nicht direkt aus dem PL

        Die Methoden sind im BOKunde-Objekt, damit der BO-Programmierer alle SQL-Statements, die Kunden betreffen, an einer Stelle hat
        Der PL-Programmierer sieht diese Implementation aber nicht. Er sieht die Methoden, von wo aus er diese Objekte "bekommt"
        (also entsprechend der Navigability). Man hätte diese Methoden technisch aber problemlos auch in die cMain geben können!
        */
        // Laden aller Tasks die einem User zugeordnet sind
        internal static Users LoadTaskUsers(Task t)
        {
            if (t.ID != "")
            {
                SqlCommand cmd = new SqlCommand("select u.Firstname, u.Lastname, u.Username, u.Email from UserTask as ut inner join User as t on ut.Username = u.Username where TaskID = @tid", Main.GetConnection());
                cmd.Parameters.Add(new SqlParameter("tid", t.ID));
                SqlDataReader reader = cmd.ExecuteReader();
                Users taskUsers = new Users();
                while (reader.Read())
                {
                    User u = new User();
                    u.Firstname = reader.GetString(0);
                    u.Lastname = reader.GetString(1);
                    u.Username = reader.GetString(2);
                    u.Email = reader.GetString(3);
                    taskUsers.Add(u);
                }
                return taskUsers;
            }
            else return null;
        }
示例#3
0
文件: Task.cs 项目: hotmike49/PM
        // Laden aller Tasks die einem User zugeordnet sind
        internal static Tasks LoadUserTasks(User u)
        {
            SqlCommand cmd = new SqlCommand("select t.TaskID, t.WorkPackageID, t.Name, t.CreatedDate, t.EndDate, t.Description  from UserTask as ut inner join Task as t on ut.TaskID = t.TaskID where Username = @username and t.status = '0'", Main.GetConnection());
            cmd.Parameters.Add(new SqlParameter("username", u.Username));
            SqlDataReader reader = cmd.ExecuteReader();
            Tasks userTasks = new Tasks();
            while (reader.Read()) {
                Task t = new Task();
                t.ID = reader.GetString(0);
                t.WorkPackageID = reader.GetString(1);
                t.Name = reader.GetString(2);
                t.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
                t.EndDate = Convert.ToDateTime(reader["EndDate"]);
                t.Description = reader.GetString(5);

                userTasks.Add(t);
            }
            return userTasks;
        }
示例#4
0
 public Tasks loadWorkPackageTasks()
 {
     if (mID != "")
     {
         SqlCommand cmd = new SqlCommand("select t.Name, t.Description, t.CreatedDate, t.EndDate, t.TaskID, t.WorkpackageID, t.Status from Task as t where WorkpackageID = @id", Main.GetConnection());
         cmd.Parameters.Add(new SqlParameter("id", mID));
         SqlDataReader reader = cmd.ExecuteReader();
         Tasks ts = new Tasks();
         while (reader.Read())
         {
             Task t = new Task();
             t.Name = reader.GetString(0);
             t.Description = reader.GetString(1);
             t.ID = reader.GetString(4);
             t.WorkPackageID = reader.GetString(5);
             t.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
             t.EndDate = Convert.ToDateTime(reader["EndDate"]);
             t.Status = reader.GetString(6);
             ts.Add(t);
         }
         return ts;
     }
     else return null;
 }
示例#5
0
文件: Task.cs 项目: hotmike49/PM
        internal static Task load(string ID)
        {
            if (ID != ""){
                SqlCommand cmd = new SqlCommand("select TaskID, WorkPackageID, Name, CreatedDate, EndDate from Task where ID = @id", Main.GetConnection());
                cmd.Parameters.Add(new SqlParameter("id", ID));
                SqlDataReader reader = cmd.ExecuteReader();

                Task t = new Task();
                t.ID = reader.GetString(0);
                t.WorkPackageID = reader.GetString(1);
                t.Name = reader.GetString(2);
                t.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
                t.EndDate = Convert.ToDateTime(reader["EndDate"]);
                return t;
            }
            else return null;
        }