Example #1
0
 public static void EditIssue(DataStructureClass.DataStructure EditedData)
 {
     if (Properties.Settings.Default.Connection)
     {
         ServerClass.EditIssue(EditedData);
     }
     else
     {
         LocalClass.EditIssue(EditedData);
         LocalClass.EditIssueCommit(EditedData);
     }
 }
Example #2
0
 public static void OldCommits(bool OperationType)
 {
     Console.WriteLine(DateTime.Now + ": BuisinessLogicClass.OldCommits");
     if (OperationType)
     {
         foreach (string line in LocalClass.GetLocalCommits())
         {
             try
             {
                 if (line.Substring(0, 5) == "Time:")
                 {
                     string    newLine = line.Substring(5);
                     TimeEntry Entry   = JsonConvert.DeserializeObject <TimeEntry>(newLine);
                     DataStructureClass.DataStructure IssueData = new DataStructureClass.DataStructure()
                     {
                         _notCommittedWorkingTime = Convert.ToInt32(Entry.Hours * 3600),
                         _id           = Entry.Issue.Id,
                         _projectId    = Entry.Project.Id,
                         _assignedToId = Entry.User.Id
                     };
                     ServerClass.CommitTime(Entry.Issue.Id, Entry.Comments, Entry.Activity.Id, Convert.ToDateTime(Entry.SpentOn), IssueData);
                 }
                 if (line.Substring(0, 5) == "Edit:")
                 {
                     string newLine = line.Substring(5);
                     DataStructureClass.DataStructure IssueData = JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(newLine);
                     ServerClass.EditIssue(IssueData);
                 }
                 if (line.Substring(0, 5) == "NewI:")
                 {
                     string    newLine = line.Substring(5);
                     TimeEntry Entry   = JsonConvert.DeserializeObject <TimeEntry>(newLine);
                     DataStructureClass.DataStructure IssueData = JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(newLine);
                     ServerClass.CreateIssue(IssueData);
                 }
             }
             catch
             {
                 MessageBox.Show("The" + line.Substring(0, 4) + "failed to get to the server.", "Send data to server fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         LocalClass.DeleteLocalCommits();
     }
 }