This commit is contained in:
2020-12-15 20:46:06 +00:00
parent 02bf076a19
commit a118282fbb
7 changed files with 372 additions and 283 deletions

View File

@@ -13,7 +13,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<publishTime>03/14/2019 14:44:18</publishTime> <publishTime>03/14/2019 14:44:18</publishTime>
</File> </File>
<File Include="bin/App_global.asax.compiled"> <File Include="bin/App_global.asax.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/App_global.asax.dll"> <File Include="bin/App_global.asax.dll">
<publishTime>06/14/2017 11:29:54</publishTime> <publishTime>06/14/2017 11:29:54</publishTime>
@@ -34,40 +34,40 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<publishTime>03/14/2019 14:41:56</publishTime> <publishTime>03/14/2019 14:41:56</publishTime>
</File> </File>
<File Include="bin/clients.aspx.cdcab7d2.compiled"> <File Include="bin/clients.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/cmd.aspx.cdcab7d2.compiled"> <File Include="bin/cmd.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/config.txt"> <File Include="bin/config.txt">
<publishTime>03/22/2019 15:27:40</publishTime> <publishTime>03/22/2019 15:27:40</publishTime>
</File> </File>
<File Include="bin/CSLA.Core.Bindablebase.dll"> <File Include="bin/CSLA.Core.Bindablebase.dll">
<publishTime>10/19/2020 14:30:05</publishTime> <publishTime>12/11/2020 11:13:03</publishTime>
</File> </File>
<File Include="bin/CSLA.dll"> <File Include="bin/CSLA.dll">
<publishTime>10/19/2020 14:30:06</publishTime> <publishTime>12/11/2020 11:13:05</publishTime>
</File> </File>
<File Include="bin/CSLA.Server.DataPortal.dll"> <File Include="bin/CSLA.Server.DataPortal.dll">
<publishTime>10/19/2020 14:30:05</publishTime> <publishTime>12/11/2020 11:13:03</publishTime>
</File> </File>
<File Include="bin/default.aspx.cdcab7d2.compiled"> <File Include="bin/default.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/FirebirdSql.Data.FirebirdClient.dll"> <File Include="bin/FirebirdSql.Data.FirebirdClient.dll">
<publishTime>03/14/2019 14:42:21</publishTime> <publishTime>03/14/2019 14:42:21</publishTime>
</File> </File>
<File Include="bin/GZTW.AyaNova.BLL.dll"> <File Include="bin/GZTW.AyaNova.BLL.dll">
<publishTime>10/19/2020 14:30:08</publishTime> <publishTime>12/11/2020 11:13:47</publishTime>
</File> </File>
<File Include="bin/GZTW.AyaNovaMBI.dll"> <File Include="bin/GZTW.AyaNovaMBI.dll">
<publishTime>10/19/2020 14:30:40</publishTime> <publishTime>12/11/2020 11:13:48</publishTime>
</File> </File>
<File Include="bin/GZTW.AyaNovaMBI.Pages.dll"> <File Include="bin/GZTW.AyaNovaMBI.Pages.dll">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/GZTW.Data.dll"> <File Include="bin/GZTW.Data.dll">
<publishTime>10/19/2020 14:30:06</publishTime> <publishTime>12/11/2020 11:13:04</publishTime>
</File> </File>
<File Include="bin/GZTW.MBI.dll"> <File Include="bin/GZTW.MBI.dll">
<publishTime>06/14/2017 12:04:42</publishTime> <publishTime>06/14/2017 12:04:42</publishTime>
@@ -76,61 +76,61 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<publishTime>06/14/2017 11:32:19</publishTime> <publishTime>06/14/2017 11:32:19</publishTime>
</File> </File>
<File Include="bin/GZTW.Profile.dll"> <File Include="bin/GZTW.Profile.dll">
<publishTime>10/19/2020 14:30:05</publishTime> <publishTime>12/11/2020 11:13:03</publishTime>
</File> </File>
<File Include="bin/labor.aspx.cdcab7d2.compiled"> <File Include="bin/labor.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/memoedit.aspx.cdcab7d2.compiled"> <File Include="bin/memoedit.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/memoto.aspx.cdcab7d2.compiled"> <File Include="bin/memoto.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/Newtonsoft.Json.dll"> <File Include="bin/Newtonsoft.Json.dll">
<publishTime>03/18/2019 11:54:01</publishTime> <publishTime>03/18/2019 11:54:01</publishTime>
</File> </File>
<File Include="bin/ro.aspx.cdcab7d2.compiled"> <File Include="bin/ro.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/sched2labor.aspx.cdcab7d2.compiled"> <File Include="bin/sched2labor.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/schedule.aspx.cdcab7d2.compiled"> <File Include="bin/schedule.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/sign.aspx.cdcab7d2.compiled"> <File Include="bin/sign.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="bin/status.aspx.cdcab7d2.compiled"> <File Include="bin/status.aspx.cdcab7d2.compiled">
<publishTime>10/19/2020 14:30:56</publishTime> <publishTime>12/11/2020 11:14:08</publishTime>
</File> </File>
<File Include="clients.aspx"> <File Include="clients.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="cmd.aspx"> <File Include="cmd.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="config.txt"> <File Include="config.txt">
<publishTime>03/22/2019 15:27:40</publishTime> <publishTime>03/22/2019 15:27:40</publishTime>
</File> </File>
<File Include="default.aspx"> <File Include="default.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="jquery-1.4.4.min.js"> <File Include="jquery-1.4.4.min.js">
<publishTime>03/14/2019 14:44:19</publishTime> <publishTime>03/14/2019 14:44:19</publishTime>
</File> </File>
<File Include="labor.aspx"> <File Include="labor.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="mbi.css"> <File Include="mbi.css">
<publishTime>03/14/2019 14:44:19</publishTime> <publishTime>03/14/2019 14:44:19</publishTime>
</File> </File>
<File Include="memoedit.aspx"> <File Include="memoedit.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="memoto.aspx"> <File Include="memoto.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="ok.gif"> <File Include="ok.gif">
<publishTime>03/14/2019 14:44:19</publishTime> <publishTime>03/14/2019 14:44:19</publishTime>
@@ -142,25 +142,25 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<publishTime>03/14/2019 14:44:19</publishTime> <publishTime>03/14/2019 14:44:19</publishTime>
</File> </File>
<File Include="PrecompiledApp.config"> <File Include="PrecompiledApp.config">
<publishTime>10/19/2020 14:30:42</publishTime> <publishTime>12/11/2020 11:13:50</publishTime>
</File> </File>
<File Include="ro.aspx"> <File Include="ro.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="sched2labor.aspx"> <File Include="sched2labor.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="schedule.aspx"> <File Include="schedule.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="sig.js"> <File Include="sig.js">
<publishTime>03/14/2019 14:44:19</publishTime> <publishTime>03/14/2019 14:44:19</publishTime>
</File> </File>
<File Include="sign.aspx"> <File Include="sign.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="status.aspx"> <File Include="status.aspx">
<publishTime>10/19/2020 14:30:47</publishTime> <publishTime>12/11/2020 11:13:58</publishTime>
</File> </File>
<File Include="user.gif"> <File Include="user.gif">
<publishTime>03/14/2019 14:44:18</publishTime> <publishTime>03/14/2019 14:44:18</publishTime>

View File

@@ -41,6 +41,7 @@
this.btnTest = new System.Windows.Forms.Button(); this.btnTest = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.lblPreRelease = new System.Windows.Forms.Label(); this.lblPreRelease = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -167,6 +168,16 @@
this.lblPreRelease.Text = "Pre-release 7.6-Alpha"; this.lblPreRelease.Text = "Pre-release 7.6-Alpha";
this.lblPreRelease.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblPreRelease.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(28, 278);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(181, 16);
this.label3.TabIndex = 38;
this.label3.Text = "AyaNova 8 SuperUser login:";
//
// Auth // Auth
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -174,6 +185,7 @@
this.AutoSize = true; this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(614, 545); this.ClientSize = new System.Drawing.Size(614, 545);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.label3);
this.Controls.Add(this.lblPreRelease); this.Controls.Add(this.lblPreRelease);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.btnTest); this.Controls.Add(this.btnTest);
@@ -213,5 +225,6 @@
private System.Windows.Forms.Button btnTest; private System.Windows.Forms.Button btnTest;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lblPreRelease; private System.Windows.Forms.Label lblPreRelease;
private System.Windows.Forms.Label label3;
} }
} }

View File

@@ -42,7 +42,7 @@ namespace AyaNova.PlugIn.V8
var res = await util.AuthenticateAsync(edUserName.Text,edPassword.Text); var res = await util.AuthenticateAsync(edUserName.Text,edPassword.Text);
if (!res) if (!res)
{ {
MessageBox.Show("Login failed"); MessageBox.Show("AyaNova 8 SuperUser account login failed");
return; return;
} }

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion public string PluginVersion
{ {
get { return "7.6.1-alpha.95"; } get { return "7.6.1-alpha.96"; }
} }
public string About public string About
@@ -317,6 +317,8 @@ namespace AyaNova.PlugIn.V8
await ExportUnitModels(progress); await ExportUnitModels(progress);
await ExportVendors(progress); await ExportVendors(progress);
await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late await ExportExternalUsers(progress);//needs vendors, clients and headoffices already exported so needs to be here late
await ExportMemos(progress);
await ExportServiceWorkorders(progress); await ExportServiceWorkorders(progress);
//todo: these are now invalid and awaiting RAVEN end implementation //todo: these are now invalid and awaiting RAVEN end implementation
//after which can copy mostly from service workorder block //after which can copy mostly from service workorder block
@@ -1849,6 +1851,58 @@ namespace AyaNova.PlugIn.V8
} }
#endregion Vendors #endregion Vendors
#region Memos
private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress)
{
if (!progress.KeepGoing) return;
progress.Op("Start Memos export");
progress.SubOp("");
var ObjectTypeName = "Memo";
//Step 2: export the objects
MemoList pl = MemoList.GetListForSingleItem(PluginID);
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
foreach (MemoList.MemoListInfo i in pl)
{
if (!progress.KeepGoing) return;
List<string> tags = new List<string>();
tags.Add(ImportTag);
dynamic d = new JObject();
d.name = i.LT_Memo_Label_Subject.Display;
d.notes = i.LT_Memo_Label_Message;
//d.customFields = "{}";
//d.tags = "[]";
d.viewed = i.LT_Memo_Label_Viewed;
d.replied = i.LT_Memo_Label_Replied;
d.fromId = SafeGetUserMap(i.LT_Memo_Label_FromID.Value);
d.sent = i.LT_Memo_Label_Sent;
progress.Op(ObjectTypeName + " " + i.ID.ToString());
var rMainObject = await util.PostAsync("memo", d.ToString());
long RavenId = util.IdFromResponse(rMainObject);
//-----
d = rMainObject.ObjectResponse["data"];
//-----
//Event log fixup
await util.EventLog(util.AyaType.Project, RavenId, SafeGetUserMap(i.LT_Memo_Label_FromID.Value), SafeGetUserMap(i.LT_Memo_Label_FromID.Value), i.LT_Memo_Label_Sent.ToString(), i.LT_Memo_Label_Sent.ToString());
}
}
#endregion Memos
#region Service Workorders #region Service Workorders
private async System.Threading.Tasks.Task ExportServiceWorkorders(ProgressForm progress) private async System.Threading.Tasks.Task ExportServiceWorkorders(ProgressForm progress)
{ {

View File

@@ -110,7 +110,16 @@ namespace AyaNova.PlugIn.V8
if (a.HttpResponse.IsSuccessStatusCode) if (a.HttpResponse.IsSuccessStatusCode)
{ {
JWT = a.ObjectResponse["data"]["token"].Value<string>(); JWT=a.ObjectResponse["data"]["token"].Value<string>();
//Must be *the* SuperUser to continue:
a = await GetAsync("user/amsu");
var IsSuperUser = a.ObjectResponse["data"].Value<bool>();
if (!IsSuperUser) {
JWT = string.Empty;
return false;
}
return true; return true;
} }

View File

@@ -64,4 +64,4 @@ using System.Security.Permissions;
// Configure log4net using the .config file // Configure log4net using the .config file
//[assembly: log4net.Config.XmlConfigurator(ConfigFile="Log4Net.config",Watch=true)] //[assembly: log4net.Config.XmlConfigurator(ConfigFile="Log4Net.config",Watch=true)]
//[assembly: log4net.Config.XmlConfigurator( ConfigFile="Log4Net.config",Watch=true )] //[assembly: log4net.Config.XmlConfigurator( ConfigFile="Log4Net.config",Watch=true )]
[assembly: AssemblyFileVersionAttribute("7.6.10.0")] [assembly: AssemblyFileVersionAttribute("7.6.11.0")]

View File

@@ -20,78 +20,78 @@ namespace GZTW.AyaNova.BLL
{ {
#pragma warning disable 1591 #pragma warning disable 1591
/// <summary> /// <summary>
/// Lightweight read only list of <see cref="MemoList.MemoListInfo"/> objects representing <see cref="Memo"/> object /// Lightweight read only list of <see cref="MemoList.MemoListInfo"/> objects representing <see cref="Memo"/> object
/// ///
/// </summary> /// </summary>
[Serializable] [Serializable]
public class MemoList : ReadOnlyCollectionBase public class MemoList : ReadOnlyCollectionBase
{ {
#region Data structure #region Data structure
/// <summary> /// <summary>
/// Properties /// Properties
/// </summary> /// </summary>
[Serializable] [Serializable]
public struct MemoListInfo public struct MemoListInfo
{ {
internal Guid mID; internal Guid mID;
internal SmartDate mCreated; internal SmartDate mCreated;
internal GridRelativeTimeCellItem mCreatedRelative; internal GridRelativeTimeCellItem mCreatedRelative;
internal GridNameValueCellItem mSubject; internal GridNameValueCellItem mSubject;
internal string mMessage; internal string mMessage;
internal GridNameValueCellItem mFrom; internal GridNameValueCellItem mFrom;
//internal Guid mFrom; //internal Guid mFrom;
internal bool mViewed; internal bool mViewed;
internal bool mReplied; internal bool mReplied;
//ID Not localized as it's an invisible field //ID Not localized as it's an invisible field
[Display(DisplayType.Hidden)] [Display(DisplayType.Hidden)]
public Guid ID public Guid ID
{ {
get get
{ {
return mID; return mID;
} }
} }
[SqlColumnNameAttribute("aMemo.aCreated"),Display(DisplayType.DateTime)] [SqlColumnNameAttribute("aMemo.aCreated"), Display(DisplayType.DateTime)]
public object LT_Memo_Label_Sent public object LT_Memo_Label_Sent
{ {
get get
{ {
return mCreated.DBValue; return mCreated.DBValue;
} }
} }
[SqlColumnNameAttribute("grid"), Display(DisplayType.Text)] [SqlColumnNameAttribute("grid"), Display(DisplayType.Text)]
public GridRelativeTimeCellItem LT_Memo_Label_Sent_Relative public GridRelativeTimeCellItem LT_Memo_Label_Sent_Relative
{ {
get get
{ {
return mCreatedRelative; return mCreatedRelative;
} }
} }
[SqlColumnNameAttribute("aUser.aLastName", [SqlColumnNameAttribute("aUser.aLastName",
"aMemo.aFromID"), "aMemo.aFromID"),
Display(DisplayType.Button, RootObjectType = RootObjectTypes.Client)] Display(DisplayType.Button, RootObjectType = RootObjectTypes.Client)]
public GridNameValueCellItem LT_Memo_Label_FromID public GridNameValueCellItem LT_Memo_Label_FromID
{ {
get get
{ {
return mFrom; return mFrom;
} }
} }
[SqlColumnNameAttribute("aMemo.aSubject", "aMemo.aID"), Display(DisplayType.Button, RootObjectType = RootObjectTypes.Memo)] [SqlColumnNameAttribute("aMemo.aSubject", "aMemo.aID"), Display(DisplayType.Button, RootObjectType = RootObjectTypes.Memo)]
public GridNameValueCellItem LT_Memo_Label_Subject public GridNameValueCellItem LT_Memo_Label_Subject
{ {
get get
{ {
return mSubject; return mSubject;
} }
} }
[Display(DisplayType.Hidden)] [Display(DisplayType.Hidden)]
public string LT_Memo_Label_Message public string LT_Memo_Label_Message
@@ -103,118 +103,118 @@ namespace GZTW.AyaNova.BLL
} }
[SqlColumnNameAttribute("aMemo.aViewed"), Display(DisplayType.Hidden)]//case 1805 added column name attribute so can set criteria for dashboard [SqlColumnNameAttribute("aMemo.aViewed"), Display(DisplayType.Hidden)]//case 1805 added column name attribute so can set criteria for dashboard
public bool LT_Memo_Label_Viewed public bool LT_Memo_Label_Viewed
{ {
get get
{ {
return mViewed; return mViewed;
} }
} }
//Special control, i.e. in this case image checkbox showing replied graphic or not replied graphic //Special control, i.e. in this case image checkbox showing replied graphic or not replied graphic
[Display(DisplayType.SpecialControl)] [Display(DisplayType.SpecialControl)]
public bool LT_Memo_Label_Replied public bool LT_Memo_Label_Replied
{ {
get get
{ {
return this.mReplied; return this.mReplied;
} }
} }
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
public bool Equals(MemoListInfo obj)
{
return this.ID.Equals(obj.ID);
}
}//end MemoListInfo
#endregion
#region Constructor
private RelativeTimeFormatter rtfm=null;
protected MemoList()
{
rtfm=RelativeTimeFormatter.GetItem(User.CurrentUserLanguage);
// AllowSort=false;
// AllowFind=true;
// AllowEdit=false;
// AllowNew=false;
// AllowRemove=false;
}
#endregion
#region Business properties and methods
/// <summary>
/// Get item by index
/// </summary>
/// <param name="Item"></param>
public MemoListInfo this[int Item]
{
get
{
return (MemoListInfo) List[Item];
}
}
/// <summary>
/// Returns display text that matches passed in itemid value
/// </summary>
/// <param name="ItemID"></param>
public string this[Guid ItemID]
{
get /// <summary>
{ ///
foreach (MemoListInfo child in List) /// </summary>
{ /// <param name="obj"></param>
if(child.ID==ItemID) return child.ToString(); public bool Equals(MemoListInfo obj)
} {
return "Missing: "+ItemID.ToString(); return this.ID.Equals(obj.ID);
} }
}
#endregion
#region contains }//end MemoListInfo
/// <summary> #endregion
/// Check if item in collection
/// </summary>
/// <param name="obj"></param>
public bool Contains(MemoListInfo obj)
{
foreach (MemoListInfo child in List)
{
if(child.Equals(obj)) return true;
}
return false;
} #region Constructor
#endregion private RelativeTimeFormatter rtfm = null;
protected MemoList()
{
rtfm = RelativeTimeFormatter.GetItem(User.CurrentUserLanguage);
// AllowSort=false;
// AllowFind=true;
// AllowEdit=false;
// AllowNew=false;
// AllowRemove=false;
}
#endregion
#region Business properties and methods
/// <summary>
/// Get item by index
/// </summary>
/// <param name="Item"></param>
public MemoListInfo this[int Item]
{
get
{
return (MemoListInfo)List[Item];
}
}
/// <summary>
/// Returns display text that matches passed in itemid value
/// </summary>
/// <param name="ItemID"></param>
public string this[Guid ItemID]
{
get
{
foreach (MemoListInfo child in List)
{
if (child.ID == ItemID) return child.ToString();
}
return "Missing: " + ItemID.ToString();
}
}
#endregion
#region contains
/// <summary>
/// Check if item in collection
/// </summary>
/// <param name="obj"></param>
public bool Contains(MemoListInfo obj)
{
foreach (MemoListInfo child in List)
{
if (child.Equals(obj)) return true;
}
return false;
}
#endregion
#region Reporting and shared UI editor helpers #region Reporting and shared UI editor helpers
/// <summary> /// <summary>
/// Returns the report key which is a property of /// Returns the report key which is a property of
/// reports used to link all reports that can be used /// reports used to link all reports that can be used
/// with a particular data source. /// with a particular data source.
/// </summary> /// </summary>
public static string ReportKey public static string ReportKey
{ {
get get
{ {
return "MemoList"; return "MemoList";
} }
} }
/// <summary> /// <summary>
/// Returns the Detailed report key /// Returns the Detailed report key
@@ -298,9 +298,9 @@ namespace GZTW.AyaNova.BLL
} }
} }
#endregion #endregion
#region Static methods #region Static methods
/// <summary> /// <summary>
/// Internal method used by list factory /// Internal method used by list factory
@@ -310,16 +310,16 @@ namespace GZTW.AyaNova.BLL
return (MemoList)DataPortal.Fetch(new Criteria(Filter, IDList, MaxRecords)); return (MemoList)DataPortal.Fetch(new Criteria(Filter, IDList, MaxRecords));
} }
/// <summary> /// <summary>
/// Get all Memo (filtered by crit) /// Get all Memo (filtered by crit)
/// </summary> /// </summary>
/// <param name="xmlCriteria">Use AyaNova UI to easily build xmlCriteria and Ctrl-Alt-g keyboard command to display it for use in your code</param> /// <param name="xmlCriteria">Use AyaNova UI to easily build xmlCriteria and Ctrl-Alt-g keyboard command to display it for use in your code</param>
/// <returns>list of <see cref="MemoList.MemoListInfo"/> objects</returns> /// <returns>list of <see cref="MemoList.MemoListInfo"/> objects</returns>
public static MemoList GetList(string xmlCriteria) public static MemoList GetList(string xmlCriteria)
{ {
return (MemoList)DataPortal.Fetch(new Criteria(xmlCriteria, null, -1)); return (MemoList)DataPortal.Fetch(new Criteria(xmlCriteria, null, -1));
} }
/// <summary> /// <summary>
/// Takes a single ID and returns a "list" of one object /// Takes a single ID and returns a "list" of one object
@@ -349,62 +349,75 @@ namespace GZTW.AyaNova.BLL
return (MemoList)DataPortal.Fetch(new Criteria("", IDList, -1)); return (MemoList)DataPortal.Fetch(new Criteria("", IDList, -1));
} }
/// <summary> /// <summary>
/// Return an empty list /// Return an empty list
/// used for initializing grid /// used for initializing grid
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static MemoList GetEmptyList() public static MemoList GetEmptyList()
{ {
return new MemoList(); return new MemoList();
} }
#endregion #endregion
#region DAL DATA ACCESS #region DAL DATA ACCESS
/// ///
/// <param name="Criteria"></param> /// <param name="Criteria"></param>
protected override void DataPortal_Fetch(object Criteria) protected override void DataPortal_Fetch(object Criteria)
{ {
Criteria crit = (Criteria)Criteria;
SafeDataReader dr = null; Criteria crit = (Criteria)Criteria;
SafeDataReader dr = null;
DateTime dtNow = DBUtil.CurrentWorkingDateTime; DateTime dtNow = DBUtil.CurrentWorkingDateTime;
try try
{ {
if (crit.IDList != null) if (crit.IDList != null)
{ {
//Case 556 //v8 Migrate related change
System.Text.StringBuilder sbIN = new System.Text.StringBuilder(); //this is a workaround to get all the memos even though the current user is not the recipient of all of them
sbIN.Append(" WHERE (aMemo.aID in ("); if (crit.IDList.Count == 1 && crit.IDList[0] == new Guid("{BD608E8A-820C-46D1-9D81-4CCB6E71B213}"))//v8 migrate plugin id
foreach (Guid gItem in crit.IDList)
{ {
sbIN.Append("'"); dr = DBUtil.GetReaderFromSQLString(
sbIN.Append("{"); "SELECT aMemo.aID, aMemo.aCreated, " +
sbIN.Append(gItem.ToString().ToUpperInvariant()); "aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
sbIN.Append("}"); "aMemo.aFromID, aMemo.aToId " +
sbIN.Append("',"); " 'first' as afirstname, 'last' as alastname, 'ii' as ainitials, 'en' as aemployeenumber, 'r' as aregionname " +
"FROM aMemo order by amemo.acreated");
} }
sbIN.Length = sbIN.Length - 1; else
sbIN.Append(")) "); {
//Case 556
//************************************************************ System.Text.StringBuilder sbIN = new System.Text.StringBuilder();
dr = DBUtil.GetReaderFromSQLString( sbIN.Append(" WHERE (aMemo.aID in (");
"SELECT aMemo.aID, aMemo.aCreated, " + foreach (Guid gItem in crit.IDList)
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " + {
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " + sbIN.Append("'");
"aUser.aEmployeeNumber FROM aMemo " + sbIN.Append("{");
sbIN.Append(gItem.ToString().ToUpperInvariant());
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " + sbIN.Append("}");
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " + sbIN.Append("',");
sbIN.ToString() + " " + }
AyaBizUtils.GetGridSortOrderColumns(crit.CriteriaXML)); sbIN.Length = sbIN.Length - 1;
sbIN.Append(")) ");
//************************************************************
dr = DBUtil.GetReaderFromSQLString(
"SELECT aMemo.aID, aMemo.aCreated, " +
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
"aUser.aEmployeeNumber FROM aMemo " +
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
sbIN.ToString() + " " +
AyaBizUtils.GetGridSortOrderColumns(crit.CriteriaXML));
}
} }
else else
{ {
@@ -413,7 +426,7 @@ namespace GZTW.AyaNova.BLL
"aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " + "aMemo.aViewed, aMemo.aReplied, aMemo.aSubject, aMemo.aMessage, " +
"aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " + "aMemo.aFromID, aUser.aFirstName, aUser.aLastName, aUser.aInitials, AREGION.ANAME AS AREGIONNAME, " +
"aUser.aEmployeeNumber FROM aMemo " + "aUser.aEmployeeNumber FROM aMemo " +
" LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " + " LEFT OUTER JOIN aUser ON aMemo.aFromID = aUser.aID " +
" LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " + " LEFT OUTER JOIN AREGION ON (AUSER.AREGIONID=AREGION.AID) " +
"WHERE (aMemo.aToID = @ID) " + "WHERE (aMemo.aToID = @ID) " +
@@ -428,45 +441,45 @@ namespace GZTW.AyaNova.BLL
dr = DBUtil.GetReaderFromSQLString(q, CurrentUserID); dr = DBUtil.GetReaderFromSQLString(q, CurrentUserID);
} }
while(dr.Read()) while (dr.Read())
{ {
//******************************************* //*******************************************
MemoListInfo info=new MemoListInfo(); MemoListInfo info = new MemoListInfo();
info.mID=dr.GetGuid("aID"); info.mID = dr.GetGuid("aID");
info.mCreated=DBUtil.ToLocal(dr.GetSmartDate("aCreated")); info.mCreated = DBUtil.ToLocal(dr.GetSmartDate("aCreated"));
info.mCreatedRelative = new GridRelativeTimeCellItem(rtfm.Format(dtNow,info.mCreated)); info.mCreatedRelative = new GridRelativeTimeCellItem(rtfm.Format(dtNow, info.mCreated));
info.mFrom=new GridNameValueCellItem( info.mFrom = new GridNameValueCellItem(
dr.GetGuid("aFromID"), dr.GetGuid("aFromID"),
User.NameFormatter(dr.GetString("aFirstName"),dr.GetString("aLastName"),dr.GetString("aInitials"), User.NameFormatter(dr.GetString("aFirstName"), dr.GetString("aLastName"), dr.GetString("aInitials"),
dr.GetString("aEmployeeNumber"), dr.GetString("AREGIONNAME"), AyaBizUtils.GlobalSettings.DefaultScheduleableUserNameDisplayFormat) dr.GetString("aEmployeeNumber"), dr.GetString("AREGIONNAME"), AyaBizUtils.GlobalSettings.DefaultScheduleableUserNameDisplayFormat)
,RootObjectTypes.User); , RootObjectTypes.User);
info.mSubject = new GridNameValueCellItem( info.mSubject = new GridNameValueCellItem(
dr.GetGuid("aID"), dr.GetGuid("aID"),
dr.GetString("aSubject"), dr.GetString("aSubject"),
RootObjectTypes.Memo); RootObjectTypes.Memo);
info.mViewed=dr.GetBoolean("aViewed"); info.mViewed = dr.GetBoolean("aViewed");
info.mReplied=dr.GetBoolean("aReplied"); info.mReplied = dr.GetBoolean("aReplied");
info.mMessage = dr.GetString("aMessage"); info.mMessage = dr.GetString("aMessage");
InnerList.Add(info);
//*******************************************
}
}
finally
{
if(dr!=null) dr.Close();
}
InnerList.Add(info);
} //*******************************************
#endregion }
}
finally
{
if (dr != null) dr.Close();
}
#region criteria
}
#endregion
#region criteria
/// <summary> /// <summary>
/// Criteria for identifying existing object /// Criteria for identifying existing object
/// </summary> /// </summary>
@@ -483,8 +496,8 @@ namespace GZTW.AyaNova.BLL
MaxRecords = _MaxRecords; MaxRecords = _MaxRecords;
} }
} }
#endregion #endregion
}//end MemoList }//end MemoList
#pragma warning restore 1591 #pragma warning restore 1591
}//end namespace GZTW.AyaNova.BLL }//end namespace GZTW.AyaNova.BLL