﻿<?xml version="1.0" encoding="utf-16"?>
<JiwaDocument xmlns:jiwa="http://www.jiwa.com.au/xml/schemas" Type="JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin">
  <RecID>b604354a-dac1-474e-a5d0-bc5a5379cdc7</RecID>
  <Name>AERP - Copy user profile on logon</Name>
  <Description>Adapted from Jiwa sample plugin available at: https://forums.jiwa.com.au/viewtopic.php?f=26&amp;t=579&amp;#13;&amp;#10;&amp;#13;&amp;#10;Copies the user profile settings (SY_UserProfile, SY_TabControlSettings, SY_TabSettings) from a nominated user (specified by a custom field and/or system setting) to the current user when they log in.&amp;#13;&amp;#10;&amp;#13;&amp;#10;Advanced ERP changes:&amp;#13;&amp;#10;    (1) in addition to a global setting, adds a staff record custom field that allows selection of another staff member to use as a profile source. So you could have several different template users, and assign users to different templates.&amp;#13;&amp;#10;    (2) adds another global setting for choosing a user group. If the user logging on is a member of this group, then they will *not* load the global profile.&amp;#13;&amp;#10;    (3) if the model profile is not found, then the process is aborted without first clearing the user settings, i.e. they will get the default settings for the user.</Description>
  <IsEnabled>true</IsEnabled>
  <IsIsolatedToOwnAppDomain>false</IsIsolatedToOwnAppDomain>
  <ExecutionOrder>2</ExecutionOrder>
  <Author>Advanced ERP</Author>
  <Version>21.06.04.0055</Version>
  <Code>using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

using JiwaFinancials.Jiwa.JiwaApplication;
using JiwaFinancials.Jiwa.JiwaApplication.Controls;
using JiwaFinancials.Jiwa.JiwaApplication.CustomFields;
using JiwaFinancials.Jiwa.JiwaApplication.Entities.Staff;
using JiwaFinancials.Jiwa.JiwaApplication.JiwaStaff;
using JiwaFinancials.Jiwa.JiwaApplication.SystemSettings;

using Plugins = JiwaFinancials.Jiwa.JiwaApplication.Plugin;

/*
    Adapted from Jiwa sample plugin available at: https://forums.jiwa.com.au/viewtopic.php?f=26&amp;t=579

    Copies the user profile settings (SY_UserProfile, SY_TabControlSettings, SY_TabSettings) from a nominated user to the current user when they log in.

    Advanced ERP changes:
    (1) in addition to a global setting, adds a staff record custom field that allows selection of another staff member to use as a profile source. So you could have several different 'template' users, and assign users to different templates.
    (2) adds another global setting for choosing a user group. If the user logging on is a member of this group, then they will *not* load the global profile.
    (3) if the model profile is not found, then the process is aborted without first clearing the user settings, i.e. they will get the 'default' settings for the user.

*/

#region "ApplicationManagerPlugin"
public class ApplicationManagerPlugin : MarshalByRefObject, IJiwaApplicationManagerPlugin
{
    public override object InitializeLifetimeService()
    {
        // returning null here will prevent the lease manager
        // from deleting the Object.
        return null;
    }

    public void Setup(Plugins.Plugin plugin)
    {
        plugin.Manager.LoggedOn += delegate ()
        {
            LoggedOn(plugin);
        };
    }

    public void LoggedOn(Plugins.Plugin plugin)
    {
        if (System.Diagnostics.Debugger.IsAttached)
        {
            System.Diagnostics.Debugger.Break();
        }

        // who am I?
        clsStaff user = plugin.Manager.Staff;

        try
        {
            // First try and load a model specified against the user.
            if (ApplySharedProfile(plugin, GetProfileRecId(user), user.RecID))
            {
                return;
            }

            // Now check if there's a user group that will exclude this user.
            if (UserInGroup(user, GetPersonalProfileGroupId(plugin)))
            {
                return;
            }

            // Find and load the 'global' shared model profile.
            if (ApplySharedProfile(plugin, GetModelProfileId(plugin), user.RecID))
            {
                return;
            }
        }
        catch (Exception ex)
        {
            ReportLoadError(ex);
            return;
        }
    }

    /// &lt;summary&gt;
    /// Gets the user-specific model profile RecID.
    /// &lt;/summary&gt;
    /// &lt;param name="user"&gt;&lt;/param&gt;
    /// &lt;returns&gt;The RecID of the model user if found and different from the current user, otherwise null.&lt;/returns&gt;
    private static string GetProfileRecId(clsStaff user)
    {
        string profileRecId = user.CustomFieldValues.Cast&lt;CustomFieldValue&gt;() // enumerate the custom fields
            .Where(c =&gt; string.Equals(c.CustomField.PluginCustomField.Name, "ProfileUser", StringComparison.OrdinalIgnoreCase)) // where the key is "ProfileUser"
            .Select(c =&gt; c.Contents) // extract the contents.
            .FirstOrDefault(); // assign null if we can't find it.

        if (string.IsNullOrWhiteSpace(profileRecId) // and the value is not blank
               || string.Equals(profileRecId, user.RecID, StringComparison.OrdinalIgnoreCase)) // and it is not the current users's StaffID.
        {
            return null;
        }
        return profileRecId;
    }

    /// &lt;summary&gt;
    /// Checks if the user is in the specified user group, identified by the group RecID.
    /// &lt;/summary&gt;
    /// &lt;param name="user"&gt;&lt;/param&gt;
    /// &lt;param name="groupId"&gt;&lt;/param&gt;
    /// &lt;returns&gt;True if groupId is not blank and the user is a member of the specified group, otherwise false.&lt;/returns&gt;
    private static bool UserInGroup(clsStaff user, string groupId)
    {
        if (string.IsNullOrWhiteSpace(groupId))
        {
            return false;
        }

        return user.UserGroupMemberships.Cast&lt;UserGroupMember&gt;().Where(g =&gt; string.Equals(g.UserGroup.RecID, groupId, StringComparison.OrdinalIgnoreCase)).Any();
    }

    /// &lt;summary&gt;
    /// Gets the RecID of the user group membership of which prevents a user from using the global shared profile.
    /// &lt;/summary&gt;
    /// &lt;param name="plugin"&gt;&lt;/param&gt;
    /// &lt;returns&gt;The relevant Group's RecID if found, otherwise null&lt;/returns&gt;
    private static string GetPersonalProfileGroupId(Plugins.Plugin plugin)
    {
        string result = plugin.SystemSettingCollection.Cast&lt;Plugins.SystemSetting&gt;()
            .Where(s =&gt; string.Equals(s.IDKey, "PersonalProfileGroup", StringComparison.OrdinalIgnoreCase))
            .Select(s =&gt; s.Contents)
            .FirstOrDefault();
        if (string.IsNullOrWhiteSpace(result))
        {
            return null;
        }

        return result;
    }

    /// &lt;summary&gt;
    /// Gets the RecID of the user whose profile will override the current user's profile.
    /// &lt;/summary&gt;
    /// &lt;param name="plugin"&gt;&lt;/param&gt;
    /// &lt;returns&gt;null if not found or empty&lt;/returns&gt;
    private static string GetModelProfileId(Plugins.Plugin plugin)
    {
        string result = plugin.SystemSettingCollection.Cast&lt;Plugins.SystemSetting&gt;()
            .Where(s =&gt; string.Equals(s.IDKey, "ModelUser", StringComparison.OrdinalIgnoreCase))
            .Select(s =&gt; s.Contents)
            .FirstOrDefault();

        if (string.IsNullOrWhiteSpace(result))
        {
            return null;
        }
        return result;
    }

    private static void ReportLoadError(Exception ex = null)
    {
        System.Windows.Forms.MessageBox.Show("Unable to load template profile." + ((ex != null) ? "\r\n" + ex.Message : string.Empty),
            "User profile error", 
            System.Windows.Forms.MessageBoxButtons.OK, 
            System.Windows.Forms.MessageBoxIcon.Warning);
    }


    /// &lt;summary&gt;
    /// Loads and applies the user profile of the specified model user, replacing the existing profile of the user logging on.
    /// &lt;/summary&gt;
    /// &lt;param name="Plugin"&gt;This plugin, used to provide access to the database connection&lt;/param&gt;
    /// &lt;param name="modelStaffId"&gt;The StaffID of the model user.&lt;/param&gt;
    /// &lt;param name="staffId"&gt;The StaffID of the user logging on.&lt;/param&gt;
    /// &lt;returns&gt;false if:
    /// &lt;list type="bullet"&gt;
    /// &lt;item&gt;either modelStaffId or staffId is empty&lt;/item&gt;
    /// &lt;item&gt;modelStaffId and staffId are equal&lt;/item&gt;
    /// &lt;item&gt;there is an error loading the profile&lt;/item&gt;
    /// &lt;/list&gt;
    /// otherwise, true
    /// &lt;/returns&gt;
    private static bool ApplySharedProfile(Plugins.Plugin Plugin, string modelStaffId, string staffId)
    {
        if (string.IsNullOrWhiteSpace(staffId)
            || string.IsNullOrWhiteSpace(modelStaffId)
            || string.Equals(modelStaffId, staffId, StringComparison.OrdinalIgnoreCase))
        {
            return false;
        }

        // shortcut
        var db = Plugin.Manager.Database;

        // Read user profile settings
        string sql = @"SELECT Section, IDKey, Contents FROM SY_UserProfile WHERE UserID = @ModelUserID ORDER BY Section, IDKey";
        using (var cmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction))
        {
            cmd.Parameters.Add(new SqlParameter("@ModelUserID", SqlDbType.VarChar)).Value = modelStaffId;

            using (SqlDataReader reader = db.ExecuteReader(cmd))
            {
                if (!reader.HasRows)
                {
                    // panic - profile user settings not found
                    ReportLoadError(new Exception("Model user template is empty"));

                    // returning false here means that we can try the shared profile instead.
                    // alternatively, we could just throw the above exception, in which case the
                    // user will just keep the profile that's already loaded.
                    return false;
                }

                // if we've got here, then we have at least *some* settings to load.
                // clear existing settings.
                // todo: 'merge' settings instead of wiping out and reloading.
                Plugin.Manager.Database.UserSettings.Clear();

                // load the model profile's settings
                while (reader.Read())
                {
                    db.UserSettings.Add(new JiwaFinancials.Jiwa.JiwaODBC.clsUserSetting()
                    {
                        Section = db.Sanitise(reader, "Section").ToString(),
                        IDKey = db.Sanitise(reader, "IDKey").ToString(),
                        Contents = db.Sanitise(reader, "Contents").ToString()
                    });
                }
            }
        }

        // Delete SY_TabControlSettings (Deletion of SY_TabControlSettings will cascade to SY_TabSettings)
        sql = @"DELETE FROM SY_TabControlSettings WHERE HR_Staff_RecID = @CurrentUserID";

        using (var cmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction))
        {
            cmd.Parameters.Add(new SqlParameter("@CurrentUserID", SqlDbType.VarChar)).Value = staffId;

            db.ExecuteNonQuery(cmd);
        }

        // Insert SY_TabControlSettings
        sql = @"INSERT INTO SY_TabControlSettings (RecID, HR_Staff_RecID, Context, FullName, UseCustomTabs, TabOrderXML)  
					SELECT NEWID(), @CurrentUserID, Context, FullName, UseCustomTabs, TabOrderXML FROM SY_TabControlSettings WHERE HR_Staff_RecID = @ModelUserID";

        using (var cmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction))
        {
            cmd.Parameters.Add(new SqlParameter("@CurrentUserID", SqlDbType.VarChar)).Value = staffId;
            cmd.Parameters.Add(new SqlParameter("@ModelUserID", SqlDbType.VarChar)).Value = modelStaffId;

            db.ExecuteNonQuery(cmd);
        }

        // Insert SY_TabSettings
        sql = @"INSERT INTO SY_TabSettings (RecID, SY_TabControlSettings_RecID, TabKey, TEXT, Visible)
                SELECT NEWID(), (SELECT TOP (1) RecID FROM SY_TabControlSettings WHERE (HR_Staff_RecID = @CurrentUserID) AND (FullName = C.FullName) AND (Context = C.Context)), T.TabKey, T.TEXT, T.Visible
                FROM SY_TabSettings AS T INNER JOIN SY_TabControlSettings AS C ON C.RecID = T.SY_TabControlSettings_RecID
                WHERE (C.HR_Staff_RecID = @ModelUserID)";

        using (var cmd = new SqlCommand(sql, db.SQLConnection, db.SQLTransaction))
        {
            cmd.Parameters.Add(new SqlParameter("@CurrentUserID", SqlDbType.VarChar)).Value = staffId;
            cmd.Parameters.Add(new SqlParameter("@ModelUserID", SqlDbType.VarChar)).Value = modelStaffId;

            db.ExecuteNonQuery(cmd);
        }

        return true;
    }
}
#endregion

#region "SystemSettingPlugin"
public class SystemSettingPlugin : MarshalByRefObject, IJiwaSystemSettingPlugin
{
    public override object InitializeLifetimeService()
    {
        // returning null here will prevent the lease manager
        // from deleting the Object.
        return null;
    }

    public void FormatCell(IJiwaBusinessLogic BusinessLogicHost, JiwaGrid GridObject, IJiwaForm FormObject, int Col, int Row, Setting SystemSetting)
    {
    }

    public void ReadData(IJiwaBusinessLogic BusinessLogicHost, JiwaGrid GridObject, IJiwaForm FormObject, int Row, Setting SystemSetting)
    {
        if (string.IsNullOrWhiteSpace(SystemSetting.Contents))
        {
            return;
        }

        if (string.Equals(SystemSetting.IDKey, "ModelUser", StringComparison.OrdinalIgnoreCase))
        {
            var staff = BusinessLogicHost.Manager.EntityFactory.CreateEntity&lt;Staff&gt;();
            staff.ReadRecord(SystemSetting.Contents);
            SystemSetting.DisplayContents = staff.DisplayName;
        }
        else if (string.Equals(SystemSetting.IDKey, "PersonalProfileGroup", StringComparison.OrdinalIgnoreCase))
        {
            var group = BusinessLogicHost.Manager.EntityFactory.CreateEntity&lt;UserGroup&gt;();
            group.ReadRecord(SystemSetting.Contents);
            SystemSetting.DisplayContents = group.Name;
        }
    }

    public void ButtonClicked(IJiwaBusinessLogic BusinessLogicHost, JiwaGrid GridObject, IJiwaForm FormObject, int Col, int Row, Setting SystemSetting)
    {
        if (string.Equals(SystemSetting.IDKey, "ModelUser", StringComparison.OrdinalIgnoreCase))
        {
            var staff = BusinessLogicHost.Manager.EntityFactory.CreateEntity&lt;Staff&gt;();
            staff.Search(FormObject.Form);
            SystemSetting.Contents = staff.RecID;
            SystemSetting.DisplayContents = staff.DisplayName;
        }
        else if (string.Equals(SystemSetting.IDKey, "PersonalProfileGroup", StringComparison.OrdinalIgnoreCase))
        {
            var group = BusinessLogicHost.Manager.EntityFactory.CreateEntity&lt;UserGroup&gt;();
            group.Search(FormObject.Form);
            SystemSetting.Contents = group.RecID;
            SystemSetting.DisplayContents = group.Name;
        }
    }
}
#endregion

#region "CustomFieldPlugin"
public class CustomFieldPlugin : MarshalByRefObject, IJiwaCustomFieldPlugin
{
    Plugins.Plugin _Plugin;

    public override object InitializeLifetimeService()
    {
        // returning null here will prevent the lease manager
        // from deleting the Object.
        return null;
    }

    public void FormatCell(IJiwaBusinessLogic BusinessLogicHost, JiwaGrid GridObject, IJiwaForm FormObject, int Col, int Row, IJiwaCustomFieldValues HostObject, CustomField customField, CustomFieldValue customFieldValue)
    {
    }

    public void ReadData(IJiwaBusinessLogic BusinessLogicHost, JiwaGrid GridObject, IJiwaForm FormObject, int Row, IJiwaCustomFieldValues HostObject, CustomField customField, CustomFieldValue customFieldValue)
    {
        if (customField.PluginCustomField.Name == "ProfileUser")
        {
            if (!string.IsNullOrWhiteSpace(customFieldValue.Contents))
            {
                try
                {
                    Staff staff = BusinessLogicHost.Manager.EntityFactory.CreateEntity&lt;Staff&gt;();
                    staff.ReadRecord(customFieldValue.Contents);
                    customFieldValue.DisplayContents = staff.DisplayName;
                }
                catch (Exception)
                {
                    // do nothing.
                }
            }
        }
    }

    public void ButtonClicked(IJiwaBusinessLogic BusinessLogicHost, JiwaGrid GridObject, IJiwaForm FormObject, int Col, int Row, IJiwaCustomFieldValues HostObject, CustomField customField, CustomFieldValue customFieldValue)
    {
        if (customField.PluginCustomField.Name == "ProfileUser")
        {
            var staff = BusinessLogicHost.Manager.EntityFactory.CreateEntity&lt;Staff&gt;();
            staff.Search(FormObject.Form);
            customFieldValue.Contents = staff.RecID;
            customFieldValue.DisplayContents = staff.DisplayName;
        }
    }
}
#endregion
</Code>
  <ExceptionPolicy>Report</ExceptionPolicy>
  <Language>CSharp</Language>
  <PluginFormCollection>
    <PluginForm>
      <RecID>fb0c048d-675a-4251-bd71-b880b7c9b0ce</RecID>
      <Description>Staff Maintenance</Description>
      <ClassName>JiwaFinancials.Jiwa.JiwaStaffUI.frmMain</ClassName>
    </PluginForm>
  </PluginFormCollection>
  <ReferenceCollection>
    <Reference>
      <RecID>117b58a7-5a13-4332-b1a7-03aa320431d1</RecID>
      <AssemblyFullName>JiwaApplication, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaApplication.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\JiwaApplication.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>009e032a-f3e6-4cb1-a9d9-6e33da090b2d</RecID>
      <AssemblyFullName>mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>mscorlib.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>54d9afd1-7848-4ec0-bc97-b1e9e3fdd94d</RecID>
      <AssemblyFullName>System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>ebd4dd52-e603-4dfc-8e6b-fb3b3346131a</RecID>
      <AssemblyFullName>System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Data.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>b6757757-7b55-40fb-9794-7da669d23e08</RecID>
      <AssemblyFullName>JiwaODBC, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaODBC.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\JiwaODBC.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>540d1d68-cb1e-4cec-a309-2edc2964c0d7</RecID>
      <AssemblyFullName>System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Xml.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>70265fba-6e0d-4988-b4d5-afb50becf931</RecID>
      <AssemblyFullName>System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Runtime.Serialization.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>054b863c-0c0e-4e7b-9078-256a5e2db2a1</RecID>
      <AssemblyFullName>System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>System.Drawing.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>857883a4-c4e4-45c0-a1c4-fa78d66af3b0</RecID>
      <AssemblyFullName>Microsoft.SqlServer.Smo, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91</AssemblyFullName>
      <AssemblyName>Microsoft.SqlServer.Smo.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Microsoft.SqlServer.Smo.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>cfa927ee-2c76-4d74-b60c-efc085e66508</RecID>
      <AssemblyFullName>Microsoft.SqlServer.ConnectionInfo, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91</AssemblyFullName>
      <AssemblyName>Microsoft.SqlServer.ConnectionInfo.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Microsoft.SqlServer.ConnectionInfo.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>8cfb25fe-ab82-4bfd-bff0-ef3413c2c907</RecID>
      <AssemblyFullName>System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Windows.Forms.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>7e751675-8607-4066-af39-fcc124612537</RecID>
      <AssemblyFullName>Infragistics4.Win.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>8c0ab838-7f1f-436f-bec6-6a59064f157a</RecID>
      <AssemblyFullName>Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>Microsoft.VisualBasic.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>7780cdeb-ef89-4e1c-b6d7-645d005ec6cb</RecID>
      <AssemblyFullName>Infragistics4.Win.Misc.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.Misc.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.Misc.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>3b309c47-6960-46b1-be99-f9b1a3b483ab</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinEditors.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinEditors.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinEditors.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>4f0983ba-437b-4b94-8ae7-19cf4ca3d8b0</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinExplorerBar.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinExplorerBar.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinExplorerBar.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>c0c959d9-0826-4945-bb41-2bf3f723f831</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinTree.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinTree.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinTree.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>641959e6-4145-46c0-b00f-a69d67849ec8</RecID>
      <AssemblyFullName>FarPoint.Win.Spread, Version=8.35.20151.0, Culture=neutral, PublicKeyToken=327c3516b1b18457</AssemblyFullName>
      <AssemblyName>FarPoint.Win.Spread.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\FarPoint.Win.Spread.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>55877455-8abd-4476-9279-d474637661e3</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinTabControl.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinTabControl.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinTabControl.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>57b29bda-ca98-4e75-a267-35299c3f6d1a</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinToolbars.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinToolbars.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinToolbars.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>c28855cd-9acc-4866-94c3-c30c9ea11d8b</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinStatusBar.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinStatusBar.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinStatusBar.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>1d471b54-b220-4440-b838-d6093cb30d57</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinListView.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinListView.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinListView.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>1dff5234-c47d-4c45-84d1-4aee566f64d7</RecID>
      <AssemblyFullName>ActiproSoftware.SyntaxEditor.WinForms, Version=16.1.330.0, Culture=neutral, PublicKeyToken=c27e062d3c1a4763</AssemblyFullName>
      <AssemblyName>ActiproSoftware.SyntaxEditor.WinForms.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\ActiproSoftware.SyntaxEditor.WinForms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>d0371813-7864-435a-b0f2-50afac37f600</RecID>
      <AssemblyFullName>ZetaHtmlEditControl, Version=1.1.0.3, Culture=neutral, PublicKeyToken=2e2e5ba5da72b6c0</AssemblyFullName>
      <AssemblyName>ZetaHtmlEditControl.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\ZetaHtmlEditControl.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>b051479a-4228-4aee-8bbb-c526f8f810fd</RecID>
      <AssemblyFullName>ActiproSoftware.SyntaxEditor.Addons.DotNet.WinForms, Version=16.1.330.0, Culture=neutral, PublicKeyToken=c27e062d3c1a4763</AssemblyFullName>
      <AssemblyName>ActiproSoftware.SyntaxEditor.Addons.DotNet.WinForms.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\ActiproSoftware.SyntaxEditor.Addons.DotNet.WinForms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>841bfd3d-f38f-418d-9e55-7f0fea6c6f91</RecID>
      <AssemblyFullName>JiwaEncryption, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaEncryption.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\JiwaEncryption.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>2d9186d4-1227-4e0b-84de-9c9da77046fd</RecID>
      <AssemblyFullName>System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>System.Security.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>c3be1f7a-b36e-4181-afd8-4cf26deb538b</RecID>
      <AssemblyFullName>Microsoft.SqlServer.Dac, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>Microsoft.SqlServer.Dac.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Microsoft.SqlServer.Dac.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>b1065ab3-2eb6-41f2-9ff2-e770ea1ca23d</RecID>
      <AssemblyFullName>CrystalDecisions.CrystalReports.Engine, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.CrystalReports.Engine.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.3500.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>8109995f-c488-4b55-8941-fc317cd31d9d</RecID>
      <AssemblyFullName>CrystalDecisions.Shared, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.Shared.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.Shared\13.0.3500.0__692fbea5521e1304\CrystalDecisions.Shared.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>27adeacf-b434-4858-9717-73304b9ce748</RecID>
      <AssemblyFullName>CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.ReportAppServer.ClientDoc.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ClientDoc.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>ba79e562-2c57-44fd-ae00-f3c24293109e</RecID>
      <AssemblyFullName>CrystalDecisions.ReportAppServer.Controllers, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.ReportAppServer.Controllers.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.Controllers\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.Controllers.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>ab114b79-a837-4b35-b27d-84a97f4df4d8</RecID>
      <AssemblyFullName>System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Core.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>b98bbc3d-6ec6-4df3-8bf4-8c97678a498c</RecID>
      <AssemblyFullName>Infragistics4.Win.AppStylistSupport.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.AppStylistSupport.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.AppStylistSupport.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>061e1323-0c40-43ee-8757-6d8b7efe70ec</RecID>
      <AssemblyFullName>JiwaLib, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaLib.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\JiwaLib.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>940f99ef-d338-44e8-b238-ac1d0dae5699</RecID>
      <AssemblyFullName>CrystalDecisions.Windows.Forms, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.Windows.Forms.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.Windows.Forms\13.0.3500.0__692fbea5521e1304\CrystalDecisions.Windows.Forms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>405c0021-ad40-48dc-80ee-e2208745d372</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinSchedule.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinSchedule.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinSchedule.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>53039f88-49ad-4cc4-bbc6-ee1db0821774</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinGrid.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinGrid.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Win.UltraWinGrid.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>2ea6c08e-ea47-4011-8895-af6908d533ba</RecID>
      <AssemblyFullName>Infragistics4.Shared.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Shared.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\Infragistics4.Shared.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>f0c6620d-eefe-4e9d-ba84-9ace393b6e03</RecID>
      <AssemblyFullName>Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</AssemblyFullName>
      <AssemblyName>Microsoft.Office.Interop.Outlook.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Outlook\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Outlook.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>e8906fe5-6b5f-4437-9c8c-fe15749ad45c</RecID>
      <AssemblyFullName>ActiproSoftware.Shared.WinForms, Version=16.1.330.0, Culture=neutral, PublicKeyToken=c27e062d3c1a4763</AssemblyFullName>
      <AssemblyName>ActiproSoftware.Shared.WinForms.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\ActiproSoftware.Shared.WinForms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>aad8b37f-457c-4d23-88c9-d4cd5303964f</RecID>
      <AssemblyFullName>FarPoint.Win, Version=8.35.20151.0, Culture=neutral, PublicKeyToken=327c3516b1b18457</AssemblyFullName>
      <AssemblyName>FarPoint.Win.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\FarPoint.Win.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>5bdaf01c-fee9-42b8-a588-8e86e8f06a60</RecID>
      <AssemblyFullName>CrystalDecisions.ReportAppServer.ReportDefModel, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.ReportAppServer.ReportDefModel.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ReportDefModel\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ReportDefModel.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>60345559-7ecf-4457-a343-9aa87183d8b8</RecID>
      <AssemblyFullName>JiwaStaffUI, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaStaffUI.dll</AssemblyName>
      <AssemblyLocation>C:\Jiwa\Jiwa 7\JiwaStaffUI.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>70acc655-67b9-47df-83d2-0fa6b07eb254</RecID>
      <AssemblyFullName>System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Xml.Linq.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll</AssemblyLocation>
    </Reference>
  </ReferenceCollection>
  <CustomFieldCollection>
    <CustomField>
      <RecID>6289e971-e36d-4e1b-802e-c9412c3153c1</RecID>
      <Name>ProfileUser</Name>
      <Description>User profile to user (this user or a different user)</Description>
      <DisplayOrder>1</DisplayOrder>
      <CellType>Lookup</CellType>
      <CustomFieldModule>Staff Maintenance</CustomFieldModule>
    </CustomField>
  </CustomFieldCollection>
  <SystemSettingCollection>
    <SystemSetting>
      <RecID>5edb12f07026492186b4</RecID>
      <IDKey>ModelUser</IDKey>
      <Description>The staff member to copy user profile settings from when logging on</Description>
      <DisplayOrder>1</DisplayOrder>
      <CellType>Lookup</CellType>
      <Contents>955DB0E345AC4339A504</Contents>
      <DisplayContents>955DB0E345AC4339A504</DisplayContents>
    </SystemSetting>
    <SystemSetting>
      <RecID>f6604a1bea8e42bfbb30</RecID>
      <IDKey>PersonalProfileGroup</IDKey>
      <Description>User group staff must be member of to use a personal profile</Description>
      <DisplayOrder>1</DisplayOrder>
      <CellType>Lookup</CellType>
      <Contents />
      <DisplayContents />
    </SystemSetting>
  </SystemSettingCollection>
</JiwaDocument>