public bool milestonesAreOrdered(Dictionary <int, Milestone> milestoneDict, bool isNewList) { int milestoneNum = 0; int prevNum = 0; int initialCount = 0; if (milestoneDict.Count != 0) { if (milestoneDict.Keys.Min() != 1 && isNewList == true) { return(false); } foreach (var milestone in milestoneDict.OrderBy(i => i.Key)) { Milestone currMilestone = milestone.Value; if (currMilestone.getCommand() == "Add") { milestoneNum = currMilestone.getNumber(); if (milestoneNum != prevNum + 1 && initialCount != 0) { return(false); } Console.WriteLine("the milestone order is milestonenum with: " + milestoneNum + " and prevnum with: " + prevNum); prevNum = currMilestone.getNumber(); initialCount++; } } } return(true); }
public void milestoneCommandHandler(List projList, ListItem oItem, Milestone currMilestone) { string command = currMilestone.getCommand().Trim(); string comment = currMilestone.getComment().Trim(); int number = currMilestone.getNumber(); if (command == "Add") //adding milestone that already exists. ERROR { if (this.mEmailError.getErrorCheck()) { this.mEmailError.setErrorCheck(true); string mailboxAddress = mProg.getMailItem().mMailboxAddress; mEmailError.sendMilestoneAlreadyExistsErrorEmail(mailboxAddress); this.mEmailError.setErrorCode(1); } else { //explain why i have this counter?.. if (this.mInitialMilestoneRowCount != 0) { Console.WriteLine("in Add if statement"); ListItemCreationInformation itemCreateMilestone = new ListItemCreationInformation(); ListItem milestoneListItem = projList.AddItem(itemCreateMilestone); //int milestoneNum = Convert.ToInt32(currMilestone.getNumber()); Console.WriteLine("milestone integer number converted now is: " + number); milestoneListItem["Milestone_x0020_Number"] = number; milestoneListItem["Milestone_x0020_Comment"] = comment; milestoneListItem.Update(); } else { Console.WriteLine("milestone integer number converted now is: " + number); oItem["Milestone_x0020_Number"] = number; oItem["Milestone_x0020_Comment"] = comment; //oItem.Update(); this.mInitialMilestoneRowCount++; } } } //remove milestone - just removes the comment //sets errors code to 0 meaning success else if (command == "Remove") //removing milestone comment { Console.WriteLine("MUST CHANGE COMMENT & REMOVE! -- the key is: " + number); oItem["Milestone_x0020_Comment"] = ""; this.mEmailError.setErrorCode(0); } else if (command == "Update") //updating milestone { string newComment = comment; oItem["Milestone_x0020_Comment"] = newComment; this.mEmailError.setErrorCode(0); } oItem.Update(); }
public void inputMilestoneAddCommands(Dictionary <int, Milestone> milestoneDict) { foreach (var milestone in milestoneDict.OrderBy(i => i.Key)) { Milestone currMilestone = milestone.Value; if (currMilestone.getCommand().Trim() == "Add") { this.milestonesWithAddCommands.Add(currMilestone.getNumber()); } } }
public void milestoneAddHandler(List projList, ListItem oItem, Milestone currMilestone) { string command = currMilestone.getCommand().Trim(); string comment = currMilestone.getComment().Trim(); int number = currMilestone.getNumber(); if (command == "Add") { if (this.mEmailError.getErrorCheck()) { this.mEmailError.setErrorCheck(true); string mailboxAddress = mProg.getMailItem().mMailboxAddress; mEmailError.sendMilestoneAlreadyExistsErrorEmail(mailboxAddress); this.mEmailError.setErrorCode(1); } else { //explain why i have this counter?.. if (this.mInitialMilestoneRowCount != 0) { Console.WriteLine("in Add if statement"); ListItemCreationInformation itemCreateMilestone = new ListItemCreationInformation(); ListItem milestoneListItem = projList.AddItem(itemCreateMilestone); //int milestoneNum = Convert.ToInt32(currMilestone.getNumber()); Console.WriteLine("milestone integer number converted now is: " + number); milestoneListItem["Milestone_x0020_Number"] = number; milestoneListItem["Milestone_x0020_Comment"] = comment; milestoneListItem.Update(); } else { Console.WriteLine("milestone integer number converted now is: " + number); oItem["Milestone_x0020_Number"] = number; oItem["Milestone_x0020_Comment"] = comment; //oItem.Update(); this.mInitialMilestoneRowCount++; } } } oItem.Update(); }