Adding the photo in WSP Active Directory users. part 6
This commit is contained in:
parent
f65ab5d5b8
commit
bf9a36c0c6
10 changed files with 4744 additions and 3134 deletions
File diff suppressed because it is too large
Load diff
|
@ -34,6 +34,8 @@ using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
using WebsitePanel.EnterpriseServer.Code.HostedSolution;
|
using WebsitePanel.EnterpriseServer.Code.HostedSolution;
|
||||||
using WebsitePanel.Providers;
|
using WebsitePanel.Providers;
|
||||||
using WebsitePanel.Providers.Common;
|
using WebsitePanel.Providers.Common;
|
||||||
|
@ -47,6 +49,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
public class ExchangeServerController
|
public class ExchangeServerController
|
||||||
{
|
{
|
||||||
|
public const int MAX_THUMBNAILPHOTO_SIZE = 96;
|
||||||
|
|
||||||
#region Organizations
|
#region Organizations
|
||||||
public static DataSet GetRawExchangeOrganizationsPaged(int packageId, bool recursive,
|
public static DataSet GetRawExchangeOrganizationsPaged(int packageId, bool recursive,
|
||||||
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||||
|
@ -6033,6 +6037,125 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Pictures
|
||||||
|
|
||||||
|
// proportional resizing
|
||||||
|
private static Bitmap ResizeBitmap(Bitmap srcBitmap, Size newSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Bitmap destBitmap = new Bitmap(newSize.Width, newSize.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
|
||||||
|
|
||||||
|
Rectangle srcRect = new Rectangle(0, 0, srcBitmap.Width, srcBitmap.Height);
|
||||||
|
Rectangle destRect = new Rectangle(0, 0, destBitmap.Width, destBitmap.Height);
|
||||||
|
|
||||||
|
float kWidth = Convert.ToSingle(srcBitmap.Width) / Convert.ToSingle(destBitmap.Width);
|
||||||
|
float kHeight = Convert.ToSingle(srcBitmap.Height) / Convert.ToSingle(destBitmap.Height);
|
||||||
|
|
||||||
|
if (kHeight > kWidth)
|
||||||
|
{
|
||||||
|
int l = (srcBitmap.Height - Convert.ToInt32(kWidth * destBitmap.Height));
|
||||||
|
srcRect.Y = l / 2;
|
||||||
|
srcRect.Height = srcBitmap.Height - l;
|
||||||
|
}
|
||||||
|
else if (kHeight < kWidth)
|
||||||
|
{
|
||||||
|
int l = (srcBitmap.Width - Convert.ToInt32(kHeight * destBitmap.Width));
|
||||||
|
srcRect.X = l / 2;
|
||||||
|
srcRect.Width = srcBitmap.Width - l;
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphics g = Graphics.FromImage(destBitmap);
|
||||||
|
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
|
||||||
|
g.DrawImage(srcBitmap, destRect, srcRect, GraphicsUnit.Pixel);
|
||||||
|
g.Dispose();
|
||||||
|
|
||||||
|
return destBitmap;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ResultObject SetPicture(int itemId, int accountID, byte[] picture)
|
||||||
|
{
|
||||||
|
ResultObject res = TaskManager.StartResultTask<ResultObject>("EXCHANGE", "SET_PICTURE", itemId);
|
||||||
|
|
||||||
|
Organization org = GetOrganization(itemId);
|
||||||
|
if (org == null)
|
||||||
|
throw new ApplicationException("Organization is null");
|
||||||
|
|
||||||
|
ExchangeAccount account = GetAccount(itemId, accountID);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||||
|
if (exchangeServiceId > 0)
|
||||||
|
{
|
||||||
|
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
|
||||||
|
|
||||||
|
Bitmap bitmap;
|
||||||
|
|
||||||
|
if (picture == null)
|
||||||
|
bitmap = new Bitmap(1, 1);
|
||||||
|
else
|
||||||
|
bitmap = new Bitmap(new MemoryStream(picture));
|
||||||
|
|
||||||
|
MemoryStream pictureStream = new MemoryStream();
|
||||||
|
|
||||||
|
if ((bitmap.Width > MAX_THUMBNAILPHOTO_SIZE) || (bitmap.Height > MAX_THUMBNAILPHOTO_SIZE))
|
||||||
|
bitmap = ResizeBitmap(bitmap, new Size(MAX_THUMBNAILPHOTO_SIZE, MAX_THUMBNAILPHOTO_SIZE));
|
||||||
|
|
||||||
|
bitmap.Save(pictureStream, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||||
|
|
||||||
|
res = exchange.SetPicture(account.AccountName, pictureStream.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TaskManager.WriteError(ex);
|
||||||
|
TaskManager.CompleteResultTask(res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskManager.CompleteResultTask();
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BytesResult GetPicture(int itemId, int accountID)
|
||||||
|
{
|
||||||
|
BytesResult res = TaskManager.StartResultTask<BytesResult>("EXCHANGE", "GET_PICTURE", itemId);
|
||||||
|
|
||||||
|
Organization org = GetOrganization(itemId);
|
||||||
|
if (org == null)
|
||||||
|
throw new ApplicationException("Organization is null");
|
||||||
|
|
||||||
|
ExchangeAccount account = GetAccount(itemId, accountID);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||||
|
if (exchangeServiceId > 0)
|
||||||
|
{
|
||||||
|
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
|
||||||
|
res = exchange.GetPicture(account.AccountName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TaskManager.WriteError(ex);
|
||||||
|
TaskManager.CompleteResultTask(res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskManager.CompleteResultTask();
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.DirectoryServices" />
|
<Reference Include="System.DirectoryServices" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Security" />
|
<Reference Include="System.Security" />
|
||||||
<Reference Include="System.ServiceProcess" />
|
<Reference Include="System.ServiceProcess" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
|
|
|
@ -779,17 +779,15 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#region Picture
|
#region Picture
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public ResultObject SetPicture(string accountName, byte[] picture)
|
public ResultObject SetPicture(int itemId, int accountId, byte[] picture)
|
||||||
{
|
{
|
||||||
return null;
|
return ExchangeServerController.SetPicture(itemId, accountId, picture);
|
||||||
// return ExchangeServerController.SetPicture(accountName, picture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public BytesResult GetPicture(string accountName)
|
public BytesResult GetPicture(int itemId, int accountId)
|
||||||
{
|
{
|
||||||
return null;
|
return ExchangeServerController.GetPicture(itemId, accountId);
|
||||||
// return ExchangeServerController.GetPicture(accountName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -38,83 +38,107 @@
|
||||||
<uc1:MailboxTabs ID="MailboxTabsId" runat="server" SelectedTab="edit_user" />
|
<uc1:MailboxTabs ID="MailboxTabsId" runat="server" SelectedTab="edit_user" />
|
||||||
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
<wsp:SimpleMessageBox id="messageBox" runat="server" />
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="FormLabel150"> <asp:Localize ID="locUserPrincipalName" runat="server" meta:resourcekey="locUserPrincipalName" Text="Login Name:"></asp:Localize></td>
|
|
||||||
<td>
|
|
||||||
<asp:Label runat="server" ID="lblUserPrincipalName" />
|
|
||||||
<wsp:EmailAddress id="upn" runat="server" ValidationGroup="CreateMailbox"></wsp:EmailAddress>
|
|
||||||
<asp:DropDownList ID="ddlEmailAddresses" runat="server" CssClass="NormalTextBox"></asp:DropDownList>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<asp:Button id="btnSetUserPrincipalName" runat="server" Text="Set Login" CssClass="Button1"
|
<table>
|
||||||
meta:resourcekey="btnSetUserPrincipalName" OnClick="btnSetUserPrincipalName_Click"></asp:Button>
|
<tr>
|
||||||
|
<td class="FormLabel150"> <asp:Localize ID="locUserPrincipalName" runat="server" meta:resourcekey="locUserPrincipalName" Text="Login Name:"></asp:Localize></td>
|
||||||
|
<td>
|
||||||
|
<asp:Label runat="server" ID="lblUserPrincipalName" />
|
||||||
|
<wsp:EmailAddress id="upn" runat="server" ValidationGroup="CreateMailbox"></wsp:EmailAddress>
|
||||||
|
<asp:DropDownList ID="ddlEmailAddresses" runat="server" CssClass="NormalTextBox"></asp:DropDownList>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<asp:Button id="btnSetUserPrincipalName" runat="server" Text="Set Login" CssClass="Button1"
|
||||||
|
meta:resourcekey="btnSetUserPrincipalName" OnClick="btnSetUserPrincipalName_Click"></asp:Button>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="chkInherit" runat="server" meta:resourcekey="chkInherit" Text="Services inherit Login Name" checked="true"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="FormLabel150"><asp:Localize ID="locDisplayName" runat="server" meta:resourcekey="locDisplayName" Text="Display Name: *"></asp:Localize></td>
|
||||||
|
<td>
|
||||||
|
<asp:TextBox ID="txtDisplayName" runat="server" CssClass="HugeTextBox200"></asp:TextBox>
|
||||||
|
<asp:RequiredFieldValidator ID="valRequireDisplayName" runat="server" meta:resourcekey="valRequireDisplayName" ControlToValidate="txtDisplayName"
|
||||||
|
ErrorMessage="Enter Display Name" ValidationGroup="EditMailbox" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="FormLabel150" valign="top"><asp:Localize ID="locPassword" runat="server" meta:resourcekey="locPassword" Text="Password:"></asp:Localize></td>
|
||||||
|
<td>
|
||||||
|
<wsp:PasswordControl id="password" runat="server" ValidationGroup="ValidatePassword">
|
||||||
|
</wsp:PasswordControl>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<asp:Button id="btnSetUserPassword" runat="server" Text="Set Password" CssClass="Button1"
|
||||||
|
meta:resourcekey="btnSetUserPassword" OnClick="btnSetUserPassword_Click" ValidationGroup="ValidatePassword"></asp:Button>
|
||||||
|
<asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="ValidatePassword" />
|
||||||
|
<asp:Button id="btnResetUserPassword" runat="server" Text="Reset Password" CssClass="Button1"
|
||||||
|
meta:resourcekey="btnResetUserPassword" OnClick="btnResetUserPassword_Click"></asp:Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<asp:CheckBox ID="chkUserMustChangePassword" runat="server" meta:resourcekey="chkUserMustChangePassword" Text="User must change password at next login" />
|
||||||
|
<br />
|
||||||
|
<asp:CheckBox ID="chkDisable" runat="server" meta:resourcekey="chkDisable" Text="Disable User" />
|
||||||
|
<br />
|
||||||
|
<asp:CheckBox ID="chkLocked" runat="server" meta:resourcekey="chkLocked" Text="Lock User" />
|
||||||
|
<br />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="FormLabel150"><asp:Localize ID="locFirstName" runat="server" meta:resourcekey="locFirstName" Text="First Name:"></asp:Localize></td>
|
||||||
|
<td>
|
||||||
|
<asp:TextBox ID="txtFirstName" runat="server" CssClass="TextBox100"></asp:TextBox>
|
||||||
|
|
||||||
|
<asp:Localize ID="locInitials" runat="server" meta:resourcekey="locInitials" Text="Middle Initial:" />
|
||||||
|
<asp:TextBox ID="txtInitials" runat="server" MaxLength="6" CssClass="TextBox100"></asp:TextBox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="FormLabel150"><asp:Localize ID="locLastName" runat="server" meta:resourcekey="locLastName" Text="Last Name:"></asp:Localize></td>
|
||||||
|
<td>
|
||||||
|
<asp:TextBox ID="txtLastName" runat="server" CssClass="TextBox200"></asp:TextBox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="FormLabel150" valign="top"><asp:Localize ID="locSubscriberNumber" runat="server" meta:resourcekey="locSubscriberNumber" ></asp:Localize></td>
|
||||||
|
<td><asp:TextBox runat="server" ID="txtSubscriberNumber" CssClass="TextBox200"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="FormLabel150" valign="top"><asp:Localize ID="locExternalEmailAddress" runat="server" meta:resourcekey="locExternalEmailAddress" ></asp:Localize></td>
|
||||||
|
<td><asp:TextBox runat="server" ID="txtExternalEmailAddress" CssClass="TextBox200"/></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<asp:CheckBox ID="chkInherit" runat="server" meta:resourcekey="chkInherit" Text="Services inherit Login Name" checked="true"/>
|
<asp:Panel ID="pnlThumbnailphoto" runat="server" HorizontalAlign="Right" Width="200px">
|
||||||
|
<div class="FormLabel150">
|
||||||
|
<asp:Localize ID="locThumbnailphoto" runat="server" meta:resourcekey="locThumbnailphoto" Text="Thumbnail photo:"></asp:Localize>
|
||||||
|
</div>
|
||||||
|
<asp:Image ID="imgThumbnailphoto" runat="server" />
|
||||||
|
<br />
|
||||||
|
<asp:FileUpload ID="upThumbnailphoto" ClientIDMode="Static" runat="server" Style="display: none;"
|
||||||
|
onchange="__doPostBack('<%= btnLoadThumbnailphoto.ClientID %>', '')" />
|
||||||
|
<asp:Button ID="btnLoadThumbnailphoto" runat="server" meta:resourcekey="btnLoadThumbnailphoto"
|
||||||
|
CssClass="CommandButton" Text="Load"
|
||||||
|
OnClientClick="$('#upThumbnailphoto').click(); return false;" />
|
||||||
|
<asp:Button ID="btnClearThumbnailphoto" runat="server" meta:resourcekey="btnClearThumbnailphoto"
|
||||||
|
CssClass="CommandButton" Text="Clear"
|
||||||
|
OnClick="btnClearThumbnailphoto_Click" />
|
||||||
|
|
||||||
|
</asp:Panel>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</table>
|
||||||
<tr>
|
|
||||||
<td class="FormLabel150"><asp:Localize ID="locDisplayName" runat="server" meta:resourcekey="locDisplayName" Text="Display Name: *"></asp:Localize></td>
|
|
||||||
<td>
|
|
||||||
<asp:TextBox ID="txtDisplayName" runat="server" CssClass="HugeTextBox200"></asp:TextBox>
|
|
||||||
<asp:RequiredFieldValidator ID="valRequireDisplayName" runat="server" meta:resourcekey="valRequireDisplayName" ControlToValidate="txtDisplayName"
|
|
||||||
ErrorMessage="Enter Display Name" ValidationGroup="EditMailbox" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="FormLabel150" valign="top"><asp:Localize ID="locPassword" runat="server" meta:resourcekey="locPassword" Text="Password:"></asp:Localize></td>
|
|
||||||
<td>
|
|
||||||
<wsp:PasswordControl id="password" runat="server" ValidationGroup="ValidatePassword">
|
|
||||||
</wsp:PasswordControl>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<asp:Button id="btnSetUserPassword" runat="server" Text="Set Password" CssClass="Button1"
|
|
||||||
meta:resourcekey="btnSetUserPassword" OnClick="btnSetUserPassword_Click" ValidationGroup="ValidatePassword"></asp:Button>
|
|
||||||
<asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="ValidatePassword" />
|
|
||||||
<asp:Button id="btnResetUserPassword" runat="server" Text="Reset Password" CssClass="Button1"
|
|
||||||
meta:resourcekey="btnResetUserPassword" OnClick="btnResetUserPassword_Click"></asp:Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
<td>
|
|
||||||
<asp:CheckBox ID="chkUserMustChangePassword" runat="server" meta:resourcekey="chkUserMustChangePassword" Text="User must change password at next login" />
|
|
||||||
<br />
|
|
||||||
<asp:CheckBox ID="chkDisable" runat="server" meta:resourcekey="chkDisable" Text="Disable User" />
|
|
||||||
<br />
|
|
||||||
<asp:CheckBox ID="chkLocked" runat="server" meta:resourcekey="chkLocked" Text="Lock User" />
|
|
||||||
<br />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="FormLabel150"><asp:Localize ID="locFirstName" runat="server" meta:resourcekey="locFirstName" Text="First Name:"></asp:Localize></td>
|
|
||||||
<td>
|
|
||||||
<asp:TextBox ID="txtFirstName" runat="server" CssClass="TextBox100"></asp:TextBox>
|
|
||||||
|
|
||||||
<asp:Localize ID="locInitials" runat="server" meta:resourcekey="locInitials" Text="Middle Initial:" />
|
|
||||||
<asp:TextBox ID="txtInitials" runat="server" MaxLength="6" CssClass="TextBox100"></asp:TextBox>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="FormLabel150"><asp:Localize ID="locLastName" runat="server" meta:resourcekey="locLastName" Text="Last Name:"></asp:Localize></td>
|
|
||||||
<td>
|
|
||||||
<asp:TextBox ID="txtLastName" runat="server" CssClass="TextBox200"></asp:TextBox>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="FormLabel150" valign="top"><asp:Localize ID="locSubscriberNumber" runat="server" meta:resourcekey="locSubscriberNumber" ></asp:Localize></td>
|
|
||||||
<td><asp:TextBox runat="server" ID="txtSubscriberNumber" CssClass="TextBox200"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="FormLabel150" valign="top"><asp:Localize ID="locExternalEmailAddress" runat="server" meta:resourcekey="locExternalEmailAddress" ></asp:Localize></td>
|
|
||||||
<td><asp:TextBox runat="server" ID="txtExternalEmailAddress" CssClass="TextBox200"/></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="FormLabel150"><asp:Localize ID="locNotes" runat="server" meta:resourcekey="locNotes" Text="Notes:"></asp:Localize></td>
|
<td class="FormLabel150"><asp:Localize ID="locNotes" runat="server" meta:resourcekey="locNotes" Text="Notes:"></asp:Localize></td>
|
||||||
|
@ -283,8 +307,6 @@
|
||||||
</table>
|
</table>
|
||||||
</asp:Panel>
|
</asp:Panel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="FormFooterClean">
|
<div class="FormFooterClean">
|
||||||
<wsp:ItemButtonPanel id="buttonPanel" runat="server" ValidationGroup="EditMailbox"
|
<wsp:ItemButtonPanel id="buttonPanel" runat="server" ValidationGroup="EditMailbox"
|
||||||
OnSaveClick="btnSave_Click" OnSaveExitClick="btnSaveExit_Click" />
|
OnSaveClick="btnSave_Click" OnSaveExitClick="btnSaveExit_Click" />
|
||||||
|
@ -293,6 +315,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ using System.Web.UI.WebControls;
|
||||||
using WebsitePanel.EnterpriseServer;
|
using WebsitePanel.EnterpriseServer;
|
||||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||||
using WebsitePanel.Providers.HostedSolution;
|
using WebsitePanel.Providers.HostedSolution;
|
||||||
|
using WebsitePanel.Providers.Common;
|
||||||
using WebsitePanel.Providers.ResultObjects;
|
using WebsitePanel.Providers.ResultObjects;
|
||||||
|
|
||||||
namespace WebsitePanel.Portal.HostedSolution
|
namespace WebsitePanel.Portal.HostedSolution
|
||||||
|
@ -47,12 +48,45 @@ namespace WebsitePanel.Portal.HostedSolution
|
||||||
|
|
||||||
BindSettings();
|
BindSettings();
|
||||||
|
|
||||||
|
BindPicture();
|
||||||
|
|
||||||
MailboxTabsId.Visible = (PanelRequest.Context == "Mailbox");
|
MailboxTabsId.Visible = (PanelRequest.Context == "Mailbox");
|
||||||
UserTabsId.Visible = (PanelRequest.Context == "User");
|
UserTabsId.Visible = (PanelRequest.Context == "User");
|
||||||
|
|
||||||
if (GetLocalizedString("buttonPanel.OnSaveClientClick") != null)
|
if (GetLocalizedString("buttonPanel.OnSaveClientClick") != null)
|
||||||
buttonPanel.OnSaveClientClick = GetLocalizedString("buttonPanel.OnSaveClientClick");
|
buttonPanel.OnSaveClientClick = GetLocalizedString("buttonPanel.OnSaveClientClick");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (upThumbnailphoto.HasFile)
|
||||||
|
SavePicture(upThumbnailphoto.FileBytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BindPicture()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// get settings
|
||||||
|
OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID,
|
||||||
|
PanelRequest.AccountID);
|
||||||
|
|
||||||
|
if ((user.AccountType== ExchangeAccountType.Mailbox) ||
|
||||||
|
(user.AccountType== ExchangeAccountType.Room) ||
|
||||||
|
(user.AccountType== ExchangeAccountType.SharedMailbox) ||
|
||||||
|
(user.AccountType== ExchangeAccountType.Equipment))
|
||||||
|
{
|
||||||
|
imgThumbnailphoto.Visible = true;
|
||||||
|
imgThumbnailphoto.ImageUrl = "~/DesktopModules/WebsitePanel/ThumbnailPhoto.ashx" + "?" + "ItemID=" + PanelRequest.ItemID +
|
||||||
|
"&AccountID=" + PanelRequest.AccountID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imgThumbnailphoto.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch { } // skip
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindSettings()
|
private void BindSettings()
|
||||||
|
@ -450,5 +484,35 @@ namespace WebsitePanel.Portal.HostedSolution
|
||||||
"Context=" + ((PanelRequest.Context == "Mailbox") ? "Mailbox" : "User"),
|
"Context=" + ((PanelRequest.Context == "Mailbox") ? "Mailbox" : "User"),
|
||||||
"AccountID=" + PanelRequest.AccountID));
|
"AccountID=" + PanelRequest.AccountID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SavePicture(byte[] picture)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ResultObject result = ES.Services.ExchangeServer.SetPicture(
|
||||||
|
PanelRequest.ItemID, PanelRequest.AccountID,
|
||||||
|
picture);
|
||||||
|
if (!result.IsSuccess)
|
||||||
|
{
|
||||||
|
messageBox.ShowErrorMessage("ORGANIZATION_UPDATE_USER_SETTINGS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
messageBox.ShowSuccessMessage("ORGANIZATION_UPDATE_USER_SETTINGS");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
messageBox.ShowErrorMessage("ORGANIZATION_UPDATE_USER_SETTINGS", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
BindPicture();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void btnClearThumbnailphoto_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SavePicture(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,6 +336,60 @@ namespace WebsitePanel.Portal.HostedSolution {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.TextBox txtExternalEmailAddress;
|
protected global::System.Web.UI.WebControls.TextBox txtExternalEmailAddress;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// pnlThumbnailphoto control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Panel pnlThumbnailphoto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// locThumbnailphoto control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Localize locThumbnailphoto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// imgThumbnailphoto control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Image imgThumbnailphoto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// upThumbnailphoto control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.FileUpload upThumbnailphoto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// btnLoadThumbnailphoto control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Button btnLoadThumbnailphoto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// btnClearThumbnailphoto control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Button btnClearThumbnailphoto;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// locNotes control.
|
/// locNotes control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<%@ WebHandler Language="C#" CodeBehind="ThumbnailPhoto.ashx.cs" Class="WebsitePanel.Portal.ThumbnailPhoto" %>
|
|
@ -0,0 +1,64 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using WebsitePanel.EnterpriseServer;
|
||||||
|
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||||
|
using WebsitePanel.Providers.HostedSolution;
|
||||||
|
using WebsitePanel.Providers.Common;
|
||||||
|
using WebsitePanel.Providers.ResultObjects;
|
||||||
|
|
||||||
|
namespace WebsitePanel.Portal
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Summary description for ThumbnailPhoto
|
||||||
|
/// </summary>
|
||||||
|
public class ThumbnailPhoto : IHttpHandler
|
||||||
|
{
|
||||||
|
public HttpContext Context = null;
|
||||||
|
|
||||||
|
public int Param(string key)
|
||||||
|
{
|
||||||
|
string val = Context.Request.QueryString[key];
|
||||||
|
if (val == null)
|
||||||
|
{
|
||||||
|
val = Context.Request.Form[key];
|
||||||
|
if (val == null) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int res = 0;
|
||||||
|
int.TryParse(val, out res);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void ProcessRequest(HttpContext context)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
|
||||||
|
int ItemID = Param("ItemID");
|
||||||
|
int AccountID = Param("AccountID");
|
||||||
|
|
||||||
|
BytesResult res = ES.Services.ExchangeServer.GetPicture(ItemID, AccountID);
|
||||||
|
if (res.IsSuccess)
|
||||||
|
{
|
||||||
|
context.Response.ContentType = "image/jpeg";
|
||||||
|
context.Response.BinaryWrite(res.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
context.Response.Redirect(PortalUtils.GetThemedImage("empty.gif"), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsReusable
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -346,6 +346,9 @@
|
||||||
<Compile Include="SettingsUserPasswordRequestLetter.ascx.designer.cs">
|
<Compile Include="SettingsUserPasswordRequestLetter.ascx.designer.cs">
|
||||||
<DependentUpon>SettingsUserPasswordRequestLetter.ascx</DependentUpon>
|
<DependentUpon>SettingsUserPasswordRequestLetter.ascx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ThumbnailPhoto.ashx.cs">
|
||||||
|
<DependentUpon>ThumbnailPhoto.ashx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UserControls\SendToControl.ascx.cs">
|
<Compile Include="UserControls\SendToControl.ascx.cs">
|
||||||
<DependentUpon>SendToControl.ascx</DependentUpon>
|
<DependentUpon>SendToControl.ascx</DependentUpon>
|
||||||
<SubType>ASPXCodeBehind</SubType>
|
<SubType>ASPXCodeBehind</SubType>
|
||||||
|
@ -7509,6 +7512,7 @@
|
||||||
<Content Include="VPSForPC\VirtualMachineSnapshotImage.ashx" />
|
<Content Include="VPSForPC\VirtualMachineSnapshotImage.ashx" />
|
||||||
<Content Include="VPS2012\VirtualMachineImage.ashx" />
|
<Content Include="VPS2012\VirtualMachineImage.ashx" />
|
||||||
<Content Include="VPS2012\VirtualMachineSnapshotImage.ashx" />
|
<Content Include="VPS2012\VirtualMachineSnapshotImage.ashx" />
|
||||||
|
<Content Include="ThumbnailPhoto.ashx" />
|
||||||
<None Include="Web.config">
|
<None Include="Web.config">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue