コード例 #1
0
        private bool DBIRejected()
        {
            if (_dbihelper.State == DBIHelper.DBIStates.Rejected &&
                _dbihelper.StateChangeType == WIStateChangeType.New &&
               (!_dbihelper.EventChanges.ContainsKey("HIC Deployment Approver") ||
               !_dbihelper.EventChanges["HIC Deployment Approver"][WIFieldChangeType.NewValue].Equals("Submission-Rejected")))
            {
                _dbihelper.Dbi.AssignWorkItemTo(_dbihelper.EventChanges["Changed By"][WIFieldChangeType.NewValue], _dbihelper.WICE.PortfolioProject +
                                                                    ConfigurationManager.AppSettings.Get("Areapath4Open"));

                _dbihelper.Dbi.PopulateApprovedBy("");

                Mailer _mailer = new Mailer();
                Dictionary<string, string> _wiFields = _dbihelper.Dbi.GetWorkItemFields(Convert.ToInt32(_dbihelper.EventChanges["ID"][WIFieldChangeType.NewValue]));
                StringBuilder _sb = new StringBuilder();

                string _rejector = _dbihelper.EventChanges["Changed By"][WIFieldChangeType.NewValue];

                _sb.AppendLine("<table>")
                  .AppendLine("<tr><td>")
                  .AppendLine("DBI: " + _wiFields["Title"])
                  .AppendLine("</td></tr>")
                  .AppendLine("<tr><td>")
                  .AppendLine("Number: " + _wiFields["ID"])
                  .AppendLine("</td></tr>")
                  .AppendLine("<tr><td>")
                  .AppendLine("WorkItem has been rejected by " + _rejector +
                              ".  Please view workitem history to see rejection reason or talk to rejector.")
                  .AppendLine("</td></tr>")
                  .AppendLine("<tr><td>")
                  .AppendLine("Use below links to view Workitem Details")
                  .AppendLine("</td></tr>")
                  .AppendLine("</table>");

                _mailer.Add2Body(GetBody(_sb.ToString(), _dbihelper.WiFields["ID"]));
                _mailer.SetSubject("DBI #: " + _dbihelper.EventChanges["ID"][WIFieldChangeType.NewValue] + " rejected");

                if (!_rejector.Equals(_wiFields["Created By"]))
                {
                    _mailer.Add2RecipientList(this.GetCreatedByEmialAddress(_wiFields["Created By"]));

                }

                if (_dbihelper.EventChanges["State"][WIFieldChangeType.OldValue].Equals("Not Done", StringComparison.CurrentCultureIgnoreCase) &&
                    !_rejector.Equals(GetProjectApprover(_wiFields["HIC Project"], _wiFields["Deployment Type"], _wiFields["New Test Environment"])))
                {
                    //DBI was successfully submitted and the approver got an alert therefore need to  alert that
                    //dbi was reject
                    _mailer.Add2RecipientList(this.GetEmailAddress(GetProjectApprover(_wiFields["HIC Project"], _wiFields["Deployment Type"], _wiFields["New Test Environment"])));
                }
                else if (_dbihelper.EventChanges["State"][WIFieldChangeType.OldValue].Equals("Approved for deployment", StringComparison.CurrentCultureIgnoreCase) &&
                         !_rejector.Equals(GetDeployer(_wiFields["Deployment Type"], _wiFields["HIC Project"], _wiFields["New Test Environment"])))
                {
                    //DBI has been approved
                    _mailer.Add2RecipientList(this.GetEmailAddress(GetDeployer(_wiFields["Deployment Type"], _wiFields["HIC Project"], _wiFields["New Test Environment"])));

                }
                else if (_dbihelper.EventChanges["State"][WIFieldChangeType.OldValue].Contains("IRB"))
                {
                    //DBI was in IRB
                    _mailer.Add2RecipientList(this.GetEmailAddress(GetDeployer(_wiFields["Deployment Type"], _wiFields["HIC Project"], _wiFields["New Test Environment"])));
                    _mailer.Add2RecipientList(this.GetEmailAddress(ConfigurationManager.AppSettings.Get("IRB_Approver")));

                }

                if (_mailer.Mail.To.Count > 0)
                {
                    _mailer.Send();
                }

                _dbihelper.Dbi.ChangeAreaPath(_dbihelper.WICE.PortfolioProject +
                                   ConfigurationManager.AppSettings.Get("AreaPath4Open"));

                return true;
            }
            else if (_dbihelper.EventChanges.ContainsKey("HIC Deployment Approver") &&
                     !String.IsNullOrEmpty(_dbihelper.EventChanges["HIC Deployment Approver"][WIFieldChangeType.NewValue]) &&
                     _dbihelper.EventChanges["HIC Deployment Approver"][WIFieldChangeType.NewValue].Equals("Submission-Rejected"))
            {//TFWI rejected the submission therefore need to make sure DBI is an area that anybody can change it
                _dbihelper.Dbi.ChangeAreaPath(_dbihelper.WICE.PortfolioProject +
                                     ConfigurationManager.AppSettings.Get("Areapath4Open"));

                return true;
            }
            return false;
        }
コード例 #2
0
        private bool DBIDeferred()
        {
            if (_dbihelper.State == DBIHelper.DBIStates.Deferred && _dbihelper.StateChangeType == WIStateChangeType.New )
            {
                //assign DBI to person deferring it
                _dbihelper.Dbi.AssignWorkItemTo(_dbihelper.EventChanges["Changed By"][WIFieldChangeType.NewValue], _dbihelper.WICE.PortfolioProject +
                                                     ConfigurationManager.AppSettings.Get("Areapath4Open"));

                _dbihelper.Dbi.PopulateApprovedBy("Deferred");

                _dbihelper.Dbi.AddHistory2WorkItem("DBI was deferred by " + _dbihelper.EventChanges["Changed By"][WIFieldChangeType.NewValue]);

                //_dbihelper.Dbi.SaveWorkItem();

                Mailer _mailer = new Mailer();
                Dictionary<string, string> _wiFields = _dbihelper.Dbi.GetWorkItemFields(Convert.ToInt32(_dbihelper.EventChanges["ID"][WIFieldChangeType.NewValue]));
                StringBuilder _sb = new StringBuilder();

                _sb.AppendLine("<table>")
                  .AppendLine("<tr><td>")
                  .AppendLine("DBI: " + _wiFields["Title"])
                  .AppendLine("</td></tr>")
                  .AppendLine("<tr><td>")
                  .AppendLine("Number: " + _wiFields["ID"])
                  .AppendLine("</td></tr>")
                  .AppendLine("<tr><td>")
                  .AppendLine("WorkItem has been deferred by " + _dbihelper.EventChanges["Changed By"][WIFieldChangeType.NewValue])
                  .AppendLine("</td></tr>")
                  .AppendLine("<tr><td>")
                  .AppendLine("Use below link to view Workitem Details")
                  .AppendLine("</td></tr>")
                  .AppendLine("</table>");

                _mailer.Add2Body(GetBody(_sb.ToString(), _dbihelper.WiFields["ID"]));
                _mailer.SetSubject("DBI #: " + _dbihelper.EventChanges["ID"][WIFieldChangeType.NewValue] + " deferred");

                _mailer.Add2RecipientList(this.GetEmailAddress(GetProjectApprover(_wiFields["HIC Project"], _wiFields["Deployment Type"], _wiFields["New Test Environment"])));

                if (_dbihelper.EventChanges["State"][WIFieldChangeType.OldValue].Equals("Approved for deployment", StringComparison.CurrentCultureIgnoreCase))
                {
                    //DBI has been approved
                    _mailer.Add2RecipientList(this.GetEmailAddress(GetDeployer(_wiFields["Deployment Type"], _wiFields["HIC Project"], _wiFields["New Test Environment"])));

                }
                else if (_dbihelper.EventChanges["State"][WIFieldChangeType.OldValue].Contains("IRB"))
                {
                    //DBI was in IRB
                    _mailer.Add2RecipientList(this.GetEmailAddress(GetDeployer(_wiFields["Deployment Type"], _wiFields["HIC Project"], _wiFields["New Test Environment"])));
                    _mailer.Add2RecipientList(this.GetEmailAddress(ConfigurationManager.AppSettings.Get("IRB_Approver")));

                }

                _mailer.Send();

                _dbihelper.Dbi.ChangeAreaPath(_dbihelper.WICE.PortfolioProject +
                                   ConfigurationManager.AppSettings.Get("Areapath4Open"));

                return true;
            }
            return false;
        }