Пример #1
0
        public static void EditIssue(DataStructureClass.DataStructure EditedData)
        {
            Console.WriteLine(DateTime.Now + ": ServerClass.EditIssue");
            IssueUpdate.Project = new IdentifiableName {
                Id = EditedData._projectId
            };
            IssueUpdate.Subject   = EditedData._subjectName;
            IssueUpdate.DoneRatio = EditedData._percentDone;
            IssueUpdate.Priority  = new IdentifiableName {
                Id = EditedData._priorityId
            };
            IssueUpdate.AssignedTo = new IdentifiableName {
                Id = EditedData._assignedToId
            };
            IssueUpdate.Description = EditedData._description;
            IssueUpdate.Status      = new IdentifiableName {
                Id = EditedData._statusId
            };
            IssueUpdate.Tracker = new IdentifiableName {
                Id = EditedData._trackerId
            };
            if (EditedData._startDateCh)
            {
                IssueUpdate.StartDate = EditedData._startDate;
            }
            if (EditedData._dueDateCh)
            {
                IssueUpdate.DueDate = EditedData._dueDate;
            }
            IssueUpdate.EstimatedHours = EditedData._estimHours;

            redmine.UpdateObject(Convert.ToString(EditedData._id), IssueUpdate);
        }
Пример #2
0
        public static DataStructureClass.DataStructure GetOneIssue(int IssueId)
        {
            Console.WriteLine(DateTime.Now + ": ServerClass.GetOneIssue: " + IssueId);
            DataStructureClass.DataStructure oneIssue = new DataStructureClass.DataStructure();

            return(oneIssue);
        }
Пример #3
0
        private void SetIssueList()
        {
            GridContents   = BuisinessLogicClass.GetAllIssues();
            AmountOfIssues = GridContents.Length;
            Issue_list_GridView.Rows.Clear();
            DataStructureClass.DataStructure GridLine = new DataStructureClass.DataStructure();
            for (int x = 0; x < AmountOfIssues; x++)  //adding rows into GridView
            {
                GridLine = GridContents[x];
                string startDate = "";
                string dueDate   = "";
                if (GridLine._startDateCh)
                {
                    startDate = BuisinessLogicClass.ConvertDate(GridLine._startDate);
                }
                if (GridLine._dueDateCh)
                {
                    dueDate = BuisinessLogicClass.ConvertDate(GridLine._dueDate);
                }

                string donePercent = Convert.ToString(GridLine._percentDone + "%");

                Issue_list_GridView.Rows.Add(GridLine._id, GridLine._subjectName, startDate, dueDate, donePercent);

                if (GridLine._description != null)
                {
                    Issue_list_GridView.Rows[x].Cells[1].ToolTipText = GridLine._subjectName + "\r\n" + BuisinessLogicClass.NormalizeText(GridLine._description, 120);
                }
                Issue_list_GridView.Rows[x].Cells[0].ToolTipText = "double click opens the edit window.";
            }
            try { Issue_list_GridView.Rows[0].Cells[0].Selected = true; } catch { }
            Selection_changed();
        }
Пример #4
0
 private void Selection_changed()
 {
     try {
         Start_timer_button.Enabled = true;
         if (NewIssueSelectionAvailability)
         {
             CurrentIssueName = Convert.ToString(Issue_list_GridView.SelectedRows[0].Cells[1].Value);
             CurrentIssueId   = Convert.ToInt32(Issue_list_GridView.SelectedRows[0].Cells[0].Value);
             BuisinessLogicClass.SuperIssueId = CurrentIssueId;
             CurrentIssueDataGridRowId        = Issue_list_GridView.SelectedRows[0].Index;
             DataStructureClass.DataStructure data = BuisinessLogicClass.GetOneIssue(CurrentIssueId);
             TimerTicks = data._notCommittedWorkingTime;
             UpdateTimerLabel();
         }
         for (int i = 0; i < 5; i++)
         {
             Issue_list_GridView.Rows[MouseSelectedRow].Cells[i].Style.BackColor = Color.WhiteSmoke;
         }
         MouseSelectedRow = Issue_list_GridView.SelectedRows[0].Index;
         Issue_list_GridView.BackgroundColor = Color.WhiteSmoke;
         for (int i = 0; i < 5; i++)
         {
             Issue_list_GridView.Rows[CurrentIssueDataGridRowId].Cells[i].Style.BackColor = Color.DarkGray;
         }
     }
     catch { }
 }
Пример #5
0
        public static void CommitTime(int Id, string CommentText, int Activity)
        {
            Console.WriteLine(DateTime.Now + ": LocalClass.CommitTime " + Id);
            DataStructureClass.DataStructure IssueData = GetOneIssue(Id);
            TimeEntry entry = new TimeEntry();

            entry.Comments = CommentText;
            entry.Activity = new IdentifiableName {
                Id = Activity
            };
            entry.Hours   = (decimal)IssueData._notCommittedWorkingTime / 3600;
            entry.SpentOn = DateTime.Now;
            entry.Issue   = new IdentifiableName {
                Id = IssueData._id
            };
            entry.Project = new IdentifiableName {
                Id = IssueData._projectId
            };
            entry.User = new IdentifiableName {
                Id = IssueData._assignedToId
            };

            FileInfo     fl = new FileInfo(CommitPath);
            StreamWriter sw = fl.AppendText();

            sw.WriteLine("Time:" + JsonConvert.SerializeObject(entry));
            sw.Close();
        }
Пример #6
0
        public static void EditIssueCommit(DataStructureClass.DataStructure NewData)
        {
            Console.WriteLine(DateTime.Now + ": LocalClass.AutomaticSaveTime");
            // add a local commit message
            FileInfo     fi = new FileInfo(CommitPath);
            StreamWriter si = fi.AppendText();

            si.WriteLine("Edit:" + JsonConvert.SerializeObject(NewData));
            si.Close();
        }
Пример #7
0
        public static void AddIssue(int IssueId)
        {
            Console.WriteLine(DateTime.Now + ": ServerClass.AddIssue");
            try
            {
                string[] readText = File.ReadAllLines(CurrentModificationPath);
                for (int x = 0; x < readText.Length; x++)
                {
                    if (JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(readText[x])._id == IssueId)
                    {
                        MessageBox.Show("Issue is already in the list!"); return;
                    }
                }

                IssueAdd = redmine.GetObject <Issue>(Convert.ToString(IssueId), parameters3);
                DataStructureClass.DataStructure newDataStructure = new DataStructureClass.DataStructure();
                FileInfo     fl = new FileInfo(CurrentModificationPath);
                StreamWriter sw = fl.AppendText();

                newDataStructure._projectName = Convert.ToString(IssueAdd.Project.Name);

                newDataStructure._projectId   = Convert.ToInt32(IssueAdd.Project.Id);
                newDataStructure._id          = Convert.ToInt32(IssueAdd.Id);
                newDataStructure._subjectName = Convert.ToString(IssueAdd.Subject);

                try { newDataStructure._percentDone = Convert.ToInt32(IssueAdd.DoneRatio); }
                catch { newDataStructure._percentDone = 0; }
                newDataStructure._priority = Convert.ToString(IssueAdd.Priority.Name);
                try { newDataStructure._assignedTo = Convert.ToString(IssueAdd.AssignedTo.Name); newDataStructure._assignedToId = IssueAdd.AssignedTo.Id; }
                catch { newDataStructure._assignedTo = ""; newDataStructure._assignedToId = 0; }
                newDataStructure._status      = Convert.ToString(IssueAdd.Status.Name);
                newDataStructure._trackerId   = IssueAdd.Tracker.Id;
                newDataStructure._description = Convert.ToString(IssueAdd.Description);
                newDataStructure._notes       = Convert.ToString(IssueAdd.Notes);
                try { newDataStructure._estimHours = Convert.ToInt32(IssueAdd.EstimatedHours); }
                catch { newDataStructure._estimHours = 0; }

                newDataStructure._startDate   = Convert.ToDateTime(IssueAdd.StartDate);
                newDataStructure._dueDate     = Convert.ToDateTime(IssueAdd.DueDate);
                newDataStructure._startDateCh = false;
                newDataStructure._dueDateCh   = false;
                if (Convert.ToInt32(Convert.ToString(newDataStructure._startDate).Substring(6, 4)) > 2000)
                {
                    newDataStructure._startDateCh = true;
                }
                if (Convert.ToInt32(Convert.ToString(newDataStructure._dueDate).Substring(6, 4)) > 2000)
                {
                    newDataStructure._dueDateCh = true;
                }

                sw.WriteLine(JsonConvert.SerializeObject(newDataStructure));
                sw.Close();
            }
            catch {}
        }
Пример #8
0
 public static void CreateIssue(DataStructureClass.DataStructure NewData)
 {
     if (Properties.Settings.Default.Connection)
     {
         ServerClass.CreateIssue(NewData);
     }
     else
     {
         LocalClass.CreateIssue(NewData);
     }
 }
Пример #9
0
        public static void GetAllIssues()
        {
            Console.WriteLine(DateTime.Now + ": ServerClass.GetAllIssues");
            parameters.Clear();
            //parameters.Add(RedmineKeys.ASSIGNED_TO_ID, "me");
            parameters.Add(RedmineKeys.PROJECT_ID, "79");  // 79 - forpay
            IList <Issue> Issues = redmine.GetObjects <Issue>(parameters);

            DataStructureClass.DataStructure newDataStructure = new DataStructureClass.DataStructure();

            File.Delete(CurrentModificationPath);
            FileInfo     fl = new FileInfo(CurrentModificationPath);
            StreamWriter sw = fl.AppendText();

            for (int x = 0; x < Issues.Count; x++)
            {
                newDataStructure._projectName = Issues[x].Project.Name;
                newDataStructure._projectId   = Issues[x].Project.Id;

                newDataStructure._subjectName = Issues[x].Subject;
                newDataStructure._id          = Issues[x].Id;

                try { newDataStructure._percentDone = Convert.ToInt32(Issues[x].DoneRatio); }
                catch { newDataStructure._percentDone = 0; }
                newDataStructure._priority = Convert.ToString(Issues[x].Priority.Name);
                try { newDataStructure._assignedTo = Convert.ToString(Issues[x].AssignedTo.Name); newDataStructure._assignedToId = Issues[x].AssignedTo.Id; }
                catch { newDataStructure._assignedTo = ""; newDataStructure._assignedToId = 0; }
                newDataStructure._status      = Issues[x].Status.Name;
                newDataStructure._statusId    = Issues[x].Status.Id;
                newDataStructure._tracker     = Issues[x].Tracker.Name;
                newDataStructure._trackerId   = Issues[x].Tracker.Id;
                newDataStructure._description = Issues[x].Description;
                newDataStructure._notes       = Issues[x].Notes;
                try { newDataStructure._estimHours = Issues[x].EstimatedHours; }
                catch { newDataStructure._estimHours = 0; }

                newDataStructure._startDate   = Convert.ToDateTime(Issues[x].StartDate);
                newDataStructure._dueDate     = Convert.ToDateTime(Issues[x].DueDate);
                newDataStructure._startDateCh = false;
                newDataStructure._dueDateCh   = false;
                if (Convert.ToInt32(Convert.ToString(newDataStructure._startDate).Substring(6, 4)) > 2000)
                {
                    newDataStructure._startDateCh = true;
                }
                if (Convert.ToInt32(Convert.ToString(newDataStructure._dueDate).Substring(6, 4)) > 2000)
                {
                    newDataStructure._dueDateCh = true;
                }

                sw.WriteLine(JsonConvert.SerializeObject(newDataStructure));
            }
            sw.Close();
        }
Пример #10
0
 public static void EditIssue(DataStructureClass.DataStructure EditedData)
 {
     if (Properties.Settings.Default.Connection)
     {
         ServerClass.EditIssue(EditedData);
     }
     else
     {
         LocalClass.EditIssue(EditedData);
         LocalClass.EditIssueCommit(EditedData);
     }
 }
Пример #11
0
        public static DataStructureClass.DataStructure[] GetAllIssues()
        {
            Console.WriteLine(DateTime.Now + ": LocalClass.GetAllIssues");
            string[] readText = File.ReadAllLines(CurrentModificationPath);
            DataStructureClass.DataStructure[] allIssues = new DataStructureClass.DataStructure[readText.Length];

            for (int x = 0; x < readText.Length; x++)
            {
                allIssues[x] = JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(readText[x]);
            }
            return(allIssues);
        }
Пример #12
0
 public static void CommitOneTimeEntry(int Id, string CommentText, int Activity)
 {
     Console.WriteLine(DateTime.Now + ": BuisinessLogicClass.CommitOneTimeEntry: " + Id);
     if (Properties.Settings.Default.Connection)
     {
         ServerClass.CommitTime(Id, CommentText, Activity, DateTime.Now, GetOneIssue(Id));
     }
     else
     {
         LocalClass.CommitTime(Id, CommentText, Activity);
     }
     DataStructureClass.DataStructure IssueData = LocalClass.GetOneIssue(Id);
     IssueData._notCommittedWorkingTime = 0;
     LocalClass.EditIssue(IssueData);
 }
Пример #13
0
        public static void CreateIssue(DataStructureClass.DataStructure NewData)
        {
            Console.WriteLine(DateTime.Now + ": local.createIssue");
            FileInfo     fl = new FileInfo(CurrentModificationPath); // save data to current modification file.
            StreamWriter sw = fl.AppendText();

            sw.WriteLine(JsonConvert.SerializeObject(NewData));
            sw.Close();

            FileInfo     fi = new FileInfo(CommitPath); // save data to commit file to send it to server.
            StreamWriter si = fi.AppendText();

            si.WriteLine("NewI:" + JsonConvert.SerializeObject(NewData));
            si.Close();
        }
Пример #14
0
        public static DataStructureClass.DataStructure GetOneIssue(int IssueId)
        {
            Console.WriteLine(DateTime.Now + ": LocalClass.GetOneIssue: " + IssueId);

            DataStructureClass.DataStructure oneIssue = new DataStructureClass.DataStructure();
            string[] readText = File.ReadAllLines(CurrentModificationPath);
            for (int x = 0; x < readText.Length; x++)
            {
                if (IssueId == JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(readText[x])._id)
                {
                    oneIssue = JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(readText[x]);
                }
            }
            return(oneIssue);
        }
Пример #15
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();
     }
 }
Пример #16
0
        public static void EditIssue(DataStructureClass.DataStructure EditedData)
        {
            Console.WriteLine(DateTime.Now + ": LocalClass.AutomaticSaveTime" + EditedData._id);
            string[] readText = File.ReadAllLines(CurrentModificationPath);
            int      linesAmount = readText.Length, LineId = 0;

            foreach (string line in readText)
            {
                DataStructureClass.DataStructure data = JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(line);
                if (JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(line)._id == EditedData._id)
                {
                    readText[LineId] = JsonConvert.SerializeObject(EditedData);
                    LineId++;
                    break;
                }
            }
            File.Delete(CurrentModificationPath);
            File.AppendAllLines(CurrentModificationPath, readText);
        }
Пример #17
0
        public static void AutomaticSaveTime(int IssueId, int TimeAmount)
        {
            Console.WriteLine(DateTime.Now + ": LocalClass.AutomaticSaveTime" + TimeAmount);
            string[] readText = File.ReadAllLines(CurrentModificationPath);
            int      linesAmount = readText.Length, LineId = 0;

            foreach (string line in readText)
            {
                DataStructureClass.DataStructure data = JsonConvert.DeserializeObject <DataStructureClass.DataStructure>(line);
                if (data._id == IssueId)
                {
                    //data._commitStatus = true;
                    data._notCommittedWorkingTime += TimeAmount;
                    readText[LineId] = JsonConvert.SerializeObject(data);
                    break;
                }
                LineId++;
            }
            File.Delete(CurrentModificationPath);
            File.AppendAllLines(CurrentModificationPath, readText);
        }
Пример #18
0
        public static void CreateIssue(DataStructureClass.DataStructure NewData)
        {
            Console.WriteLine(DateTime.Now + ": ServerClass.CreateIssue");
            IssueCreate.Project = new IdentifiableName {
                Id = NewData._projectId
            };
            IssueCreate.Subject   = NewData._subjectName;
            IssueCreate.DoneRatio = NewData._percentDone;
            IssueCreate.Priority  = new IdentifiableName {
                Id = NewData._priorityId
            };
            IssueCreate.AssignedTo = new IdentifiableName {
                Id = NewData._assignedToId
            };
            IssueCreate.Description = NewData._description;
            IssueCreate.Status      = new IdentifiableName {
                Id = NewData._statusId
            };
            IssueCreate.Tracker = new IdentifiableName {
                Id = NewData._trackerId
            };
            if (NewData._startDateCh)
            {
                IssueCreate.StartDate = NewData._startDate;
            }
            if (NewData._dueDateCh)
            {
                IssueCreate.DueDate = NewData._dueDate;
            }
            IssueCreate.EstimatedHours = NewData._estimHours;

            // Does the issue ID need to be created
            //IssueCreate.Id = NewData._id;

            redmine.CreateObject(IssueCreate);
        }
Пример #19
0
        public EditIssueForm()
        {
            InitializeComponent();
            if (BuisinessLogicClass.EditIssueId == -1234)
            {
                TypeCreate = true;
                Text       = "Creat issue";
            }
            OldStructure = BuisinessLogicClass.GetOneIssue(BuisinessLogicClass.EditIssueId);

            {
                string[,] projects = BuisinessLogicClass.GetVariables(1);
                ProjectSelectComboBox.Items.Clear();

                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < projects.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(projects[x, 0], Convert.ToInt32(projects[x, 1])));
                    x++;
                }
                ProjectSelectComboBox.DisplayMember = "Key";
                ProjectSelectComboBox.ValueMember   = "Value";
                ProjectSelectComboBox.DataSource    = items;
                ProjectSelectComboBox.Text          = OldStructure._projectName;
            } // projects

            {
                string[,] trackers = BuisinessLogicClass.GetVariables(2);
                TrackerComboBox.Items.Clear();

                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < trackers.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(trackers[x, 0], Convert.ToInt32(trackers[x, 1])));
                    x++;
                }
                TrackerComboBox.DisplayMember = "Key";
                TrackerComboBox.ValueMember   = "Value";
                TrackerComboBox.DataSource    = items;
                TrackerComboBox.Text          = OldStructure._tracker;
            } // trackers

            {
                // сделать зависимость от типа пользователя.
                string[,] statuses = BuisinessLogicClass.GetVariables(3);
                StatusComboBox.Items.Clear();
                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();
                if ((OldStructure._statusId != 7 || OldStructure._statusId != 2) & OldStructure._statusId != 0)
                {
                    items.Add(new KeyValuePair <string, int>(OldStructure._status, OldStructure._statusId));
                }
                else if (OldStructure._statusId == 7 || OldStructure._statusId == 2)
                {
                    int x = 0;
                    while (x < statuses.GetLength(0))
                    {
                        if (OldStructure._status == statuses[x, 0])
                        {
                            items.Add(new KeyValuePair <string, int>(statuses[x, 0], Convert.ToInt32(statuses[x, 1])));
                            items.Add(new KeyValuePair <string, int>(statuses[x + 1, 0], Convert.ToInt32(statuses[x + 1, 1])));
                        }
                        x++;
                    }
                }
                else
                {
                    items.Add(new KeyValuePair <string, int>(statuses[0, 0], Convert.ToInt32(statuses[0, 1])));
                    items.Add(new KeyValuePair <string, int>(statuses[1, 0], Convert.ToInt32(statuses[1, 1])));
                }

                StatusComboBox.DisplayMember = "Key";
                StatusComboBox.ValueMember   = "Value";
                StatusComboBox.DataSource    = items;
                TrackerComboBox.Text         = OldStructure._tracker;
            } // statuses

            {
                string[,] prioritys = BuisinessLogicClass.GetVariables(4);
                PrioritycomboBox.Items.Clear();
                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < prioritys.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(prioritys[x, 0], Convert.ToInt32(prioritys[x, 1])));
                    x++;
                }
                PrioritycomboBox.DisplayMember = "Key";
                PrioritycomboBox.ValueMember   = "Value";
                PrioritycomboBox.DataSource    = items;
                PrioritycomboBox.Text          = OldStructure._priority;
            } // prioritys

            {
                string[,] users = BuisinessLogicClass.GetVariables(6);
                AssignedToComboBox.Items.Clear();

                BindingList <KeyValuePair <string, int> > items = new BindingList <KeyValuePair <string, int> >();

                int x = 0;
                while (x < users.GetLength(0))
                {
                    items.Add(new KeyValuePair <string, int>(users[x, 0], Convert.ToInt32(users[x, 1])));
                    x++;
                }
                AssignedToComboBox.DisplayMember = "Key";
                AssignedToComboBox.ValueMember   = "Value";
                AssignedToComboBox.DataSource    = items;
                AssignedToComboBox.Text          = OldStructure._assignedTo;

                AssignedToComboBox.Text = OldStructure._assignedTo;
            } // users

            if (!TypeCreate)
            {
                Fill_data();
            }
        }
Пример #20
0
        private void AcceptButton_Click(object sender, EventArgs e)
        {
            try
            {
                NewStructure = OldStructure;

                if (ProjectSelectComboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Project");
                }
                NewStructure._projectName = ProjectSelectComboBox.Text;
                NewStructure._projectId   = Convert.ToInt32(ProjectSelectComboBox.SelectedValue);

                if (SubjectNameTextBox.Text.Length < 1)
                {
                    throw new ArgumentException("Subject");
                }
                NewStructure._subjectName = SubjectNameTextBox.Text;

                NewStructure._percentDone = PercentDonecomboBox.SelectedIndex * 10;

                if (PrioritycomboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Priority");
                }
                NewStructure._priority   = PrioritycomboBox.Text;
                NewStructure._priorityId = Convert.ToInt32(PrioritycomboBox.SelectedValue);

                NewStructure._assignedTo   = AssignedToComboBox.Text;
                NewStructure._assignedToId = Convert.ToInt32(AssignedToComboBox.SelectedValue);

                if (StatusComboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Status");
                }
                NewStructure._status   = StatusComboBox.Text;
                NewStructure._statusId = Convert.ToInt32(StatusComboBox.SelectedValue);

                if (TrackerComboBox.Text.Length < 2)
                {
                    throw new ArgumentException("Tracker");
                }
                NewStructure._tracker   = TrackerComboBox.Text;
                NewStructure._trackerId = Convert.ToInt32(TrackerComboBox.SelectedValue);

                NewStructure._description = DescriptionRichTextBox.Text;
                NewStructure._notes       = NotesRichTextBox.Text;

                if (EstimTimeTextBox.Text.Length > 0)
                {
                    NewStructure._estimHours = Convert.ToInt32(EstimTimeTextBox.Text);
                }

                if (StartDateCheckBox.Checked)
                {
                    NewStructure._startDate   = StartDateDateTimePicker.Value;
                    NewStructure._startDateCh = true;
                }
                else
                {
                    NewStructure._startDate   = new DateTime(1, 1, 1);
                    NewStructure._startDateCh = false;
                }
                if (DueDateCheckBox.Checked)
                {
                    NewStructure._dueDate   = DueDateDateTimePicker.Value;
                    NewStructure._dueDateCh = true;
                }
                else
                {
                    NewStructure._dueDate   = new DateTime(1, 1, 1);
                    NewStructure._dueDateCh = false;
                }
            }
            catch (ArgumentException err)
            {
                MessageBox.Show($"{err.Message} should be selected.", "Wrong values", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (TypeCreate)
            {
                BuisinessLogicClass.CreateIssue(NewStructure);
            }
            else
            {
                BuisinessLogicClass.EditIssue(NewStructure);
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Пример #21
0
        public static void CommitTime(int Id, string CommentText, int Activity, DateTime SpentOn, DataStructureClass.DataStructure IssueData)
        {
            Console.WriteLine(DateTime.Now + ": ServerClass.CommitTime");
            TimeEntry entry = new TimeEntry()
            {
                Comments = CommentText,
                Activity = new IdentifiableName {
                    Id = Activity
                },
                Hours   = (decimal)IssueData._notCommittedWorkingTime / 3600,
                SpentOn = SpentOn,
                Issue   = new IdentifiableName {
                    Id = IssueData._id
                },
                Project = new IdentifiableName {
                    Id = IssueData._projectId
                },
                User = new IdentifiableName {
                    Id = IssueData._assignedToId
                }
            };

            redmine.CreateObject(entry);
        }