Added code to handle a transition where the item the transition is going to does not have an active section
Added code to handle the condition where no email address has been defined for a user.
This commit is contained in:
@@ -81,22 +81,27 @@ namespace VEPROMS
|
||||
UserInfo ui = UserInfo.GetByUserID(oi.SessionUserID);
|
||||
UserConfig uc = new UserConfig(ui.Config);
|
||||
string subject = "Please Check In A Procedure";
|
||||
if (!SendOutlookEmail(uc.User_UserEmail, subject, BuildEmailMessageBody(pi)))
|
||||
(sender as Button).Enabled = false;
|
||||
if (uc.User_UserEmail != string.Empty)
|
||||
{
|
||||
if (!SendOutlookEmail(uc.User_UserEmail, subject, BuildEmailMessageBody(pi)))
|
||||
(sender as Button).Enabled = false;
|
||||
}
|
||||
else
|
||||
MessageBox.Show("No email has been defined for this user. You will need to Force Check In this procedure", "No Email");
|
||||
}
|
||||
|
||||
private string BuildEmailMessageBody(ProcedureInfo pi)
|
||||
{
|
||||
StringBuilder body = new StringBuilder();
|
||||
body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
|
||||
body.AppendLine();
|
||||
body.AppendLine(string.Format("I need you to check in procedure {0} so I can continue a batch refresh process", pi.DisplayNumber));
|
||||
body.AppendLine();
|
||||
body.AppendLine("Obviously, you do not really have this procedure checked out, so you really do not have to do anything.");
|
||||
body.AppendLine();
|
||||
body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
|
||||
body.AppendLine();
|
||||
body.AppendLine("I will try NOT to overwhelm your email system :-)");
|
||||
//body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
|
||||
//body.AppendLine();
|
||||
body.AppendLine(string.Format("The administrator needs you to check in procedure {0} so the administrator can continue an administrative tool process", pi.DisplayNumber));
|
||||
//body.AppendLine();
|
||||
//body.AppendLine("Obviously, you do not really have this procedure checked out, so you really do not have to do anything.");
|
||||
//body.AppendLine();
|
||||
//body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
|
||||
//body.AppendLine();
|
||||
//body.AppendLine("I will try NOT to overwhelm your email system :-)");
|
||||
return body.ToString();
|
||||
}
|
||||
void ForceCheckIn_Click(object sender, EventArgs e)
|
||||
@@ -107,22 +112,27 @@ namespace VEPROMS
|
||||
UserConfig uc = new UserConfig(ui.Config);
|
||||
MySessionInfo.CheckInItem(oi.OwnerID);
|
||||
pnlList.Controls.Remove((sender as Button).Parent as Panel);
|
||||
string subject = "A Procedure Was Forced Checked In";
|
||||
SendOutlookEmail(uc.User_UserEmail, subject, BuildForcedMessageBody(pi));
|
||||
if (uc.User_UserEmail != string.Empty)
|
||||
{
|
||||
string subject = "A Procedure Was Forced Checked In";
|
||||
SendOutlookEmail(uc.User_UserEmail, subject, BuildForcedMessageBody(pi));
|
||||
}
|
||||
else
|
||||
MessageBox.Show("No email has been defined for this user. The procedure will be Force Checked In, but the user will not be notified.", "No Email");
|
||||
}
|
||||
|
||||
private string BuildForcedMessageBody(ProcedureInfo pi)
|
||||
{
|
||||
StringBuilder body = new StringBuilder();
|
||||
body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
|
||||
body.AppendLine();
|
||||
body.AppendLine(string.Format("I needed to force check in procedure {0} so I could continue a batch refresh process", pi.DisplayNumber));
|
||||
body.AppendLine();
|
||||
body.AppendLine("Obviously, you do not really have this procedure checked out, so nothing really got forced checked in.");
|
||||
body.AppendLine();
|
||||
body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
|
||||
body.AppendLine();
|
||||
body.AppendLine("I will try NOT to overwhelm your email system :-)");
|
||||
//body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
|
||||
//body.AppendLine();
|
||||
body.AppendLine(string.Format("The administrator needed to force check in procedure {0} so the administrator could continue an administrative tool process", pi.DisplayNumber));
|
||||
//body.AppendLine();
|
||||
//body.AppendLine("Obviously, you do not really have this procedure checked out, so nothing really got forced checked in.");
|
||||
//body.AppendLine();
|
||||
//body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
|
||||
//body.AppendLine();
|
||||
//body.AppendLine("I will try NOT to overwhelm your email system :-)");
|
||||
return body.ToString();
|
||||
}
|
||||
private bool SendOutlookEmail(string email, string subject, string body)
|
||||
|
Reference in New Issue
Block a user