Example #1
0
        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();
        }
Example #2
0
        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();
        }