public TracksManagerGUI(Manager database)
 {
     localization = new System.ComponentModel.ComponentResourceManager(typeof(WorkerTimeStrings));
     this.database = database;
     InitializeComponent();
     this.Text = localization.GetString("String18") + " " + localization.GetString("String19");
 }
 public TrackManagerEdit(Manager database, Track track)
 {
     localization = new System.ComponentModel.ComponentResourceManager(typeof(WorkerTimeStrings));
     this.database = database;
     this.track = track;
     this.Text = localization.GetString("String18") + " " + localization.GetString("String20");
     InitializeComponent();
 }
 public GenericManagerGUI(Manager database, String title, String table, String fields)
 {
     localization = new System.ComponentModel.ComponentResourceManager(typeof(WorkerTimeStrings));
     this.database = database;
     this.table = table;
     this.fields = fields;
     InitializeComponent();
     this.Text = localization.GetString("String18") + " " + title.ToLower();
 }
Beispiel #4
0
 public static void PopulateComboBoxProjects(Manager database, ComboBox comboBoxProject)
 {
     comboBoxProject.Items.Clear();
     comboBoxProject.Text = "";
     DbDataReader reader = database.ExecuteReader("SELECT ID,Name FROM Projects");
     while (reader.Read())
     {
         ComboListItem temp = new ComboListItem();
         temp.ShortName = reader[0].ToString();
         temp.LongName = (String)reader[1];
         comboBoxProject.Items.Add(temp);
     }
     reader.Close();
     if (comboBoxProject.Items.Count > 0)
         comboBoxProject.SelectedIndex = 0;
 }
Beispiel #5
0
 public static Track GetTrack(Manager database, Int32 ID)
 {
     Track track;
     DbDataReader reader = database.ExecuteReader("SELECT * FROM Tracks WHERE ID='" + ID + "'");
     reader.Read();
     if (reader.HasRows)
     {
         track = new Track(Int32.Parse(reader["ProjectID"].ToString()), Int32.Parse(reader["ActivityID"].ToString()));
         track.ID = Int32.Parse(reader["ID"].ToString());
         track.startTime = (DateTime)reader["Start"];
         track.endTime = (DateTime)reader["End"];
     }
     else
     {
         throw new ApplicationException("Contagem não encontrada na base de dados");
     }
     reader.Close();
     return track;
 }
Beispiel #6
0
 public static void PopulateComboBoxProjects(Manager database, ComboBox comboBoxProject, String projectId)
 {
     PopulateComboBoxProjects(database,comboBoxProject);
     SelectComboBoxProjectItem(database,comboBoxProject, projectId);
 }
Beispiel #7
0
 public static void PopulateComboBoxActivities(Manager database, ComboBox comboBoxProject, ComboBox comboBoxActivity, String activityId)
 {
     PopulateComboBoxActivities(database, comboBoxProject, comboBoxActivity);
     SelectComboBoxActivityItem(database, comboBoxActivity, activityId);
 }
Beispiel #8
0
 public static void SelectComboBoxProjectItem(Manager database, ComboBox comboBoxProject, String projectId)
 {
     for (int i = 0; i < comboBoxProject.Items.Count; i++)
     {
         if (((ComboListItem)comboBoxProject.Items[i]).ShortName == projectId)
         {
             comboBoxProject.SelectedIndex = i;
         }
     }
 }
Beispiel #9
0
 public static void SelectComboBoxActivityItem(Manager database, ComboBox comboBoxActivity, String activityId)
 {
     for (int i = 0; i < comboBoxActivity.Items.Count; i++)
     {
         if (((ComboListItem)comboBoxActivity.Items[i]).ShortName == activityId)
         {
             comboBoxActivity.SelectedIndex = i;
         }
     }
 }
Beispiel #10
0
 public void Save(Manager database)
 {
     if (ID == 0)
         database.ExecuteNonQuery("INSERT INTO Tracks (ProjectID, ActivityID, Start, End, Duration) VALUES('" + projectId.ToString() + "','" + activityId.ToString() + "','" + startTime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "','" + endTime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "','" + ElapsedTime().Ticks + "')");
     else
         database.ExecuteNonQuery("UPDATE Tracks SET ProjectID='" + projectId.ToString() + "', ActivityID='" + activityId.ToString() + "', Start='" + startTime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "', End='" + endTime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "', Duration='" + ElapsedTime().Ticks + "' WHERE ID='" + ID + "'");
 }
Beispiel #11
0
 public void Delete(Manager database)
 {
     database.ExecuteNonQuery("DELETE FROM Tracks WHERE ID = '" + this.ID + "'");
     ID = new Int32();
     projectId = new Int32();
     activityId = new Int32();
     startTime = new DateTime();
     endTime = new DateTime();
 }