00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 using System;
00013 using System.Web.Services.Protocols;
00014 using System.Windows.Forms;
00015 using Mcs.Epm.MicrosoftProject.mpFx.ProjectsWebService;
00016 using Mcs.Epm.MicrosoftProject.mpFx.WinForms.Properties;
00017
00018 namespace Mcs.Epm.MicrosoftProject.mpFx.WinForms
00019 {
00020
00021
00022
00023 public partial class CheckInProjectForm : Form
00024 {
00025 #region Instance Data
00026
00027 private readonly ProjectServer _ProjectServer;
00028 private readonly Guid _ProjectGuid;
00029 private readonly Guid _SessionGuid;
00030
00031 #endregion
00032
00033 #region Constructor
00034
00035 public CheckInProjectForm(ProjectServer projectServer,
00036 Guid projectGuid,
00037 Guid sessionGuid)
00038 {
00039 _ProjectServer = projectServer;
00040 _ProjectGuid = projectGuid;
00041 _SessionGuid = sessionGuid;
00042
00043 InitializeComponent();
00044 }
00045
00046 #endregion
00047
00048 #region Event Handlers
00049
00050 private void okButton_Click(object sender,
00051 EventArgs e)
00052 {
00053 try
00054 {
00055 string errorString;
00056
00057 if (!_ProjectServer.Projects.CheckIn(_ProjectGuid,
00058 _SessionGuid,
00059 forceCheckInCheckBox.Checked,
00060 waitCheckBox.Checked,
00061 out errorString))
00062 {
00063 MessageBox.Show(this,
00064 errorString,
00065 Resources.AppTitle,
00066 MessageBoxButtons.OK,
00067 MessageBoxIcon.Error);
00068 }
00069 Hide();
00070 }
00071
00072 catch (SoapException exception)
00073 {
00074 MessageBox.Show(this,
00075 Errors.ProcessMSProjectErrors(exception),
00076 Resources.AppTitle,
00077 MessageBoxButtons.OK,
00078 MessageBoxIcon.Error);
00079 }
00080 catch (Exception exception)
00081 {
00082 MessageBox.Show(this,
00083 exception.Message,
00084 Resources.AppTitle,
00085 MessageBoxButtons.OK,
00086 MessageBoxIcon.Error);
00087 }
00088 }
00089
00090 private void cancelButton_Click(object sender,
00091 EventArgs e)
00092 {
00093 Hide();
00094 }
00095
00096 private void CheckInProjectForm_Load(object sender,
00097 EventArgs e)
00098 {
00099 if (_ProjectServer.Projects.IsProjectCheckedOutByCurrentUser(_ProjectGuid, DataStoreEnum.WorkingStore))
00100 {
00101 projectNameTextBox.Text = _ProjectServer.Projects[_ProjectGuid].Name;
00102 }
00103 else
00104 {
00105 MessageBox.Show(this,
00106 "The project is not currently checked out to you.",
00107 Resources.AppTitle,
00108 MessageBoxButtons.OK,
00109 MessageBoxIcon.Information);
00110 Close();
00111 }
00112 }
00113
00114 #endregion
00115 }
00116 }