Пример #1
0
        private void GetValuesFromCache()
        {
            // Get screen values from cache
            //

            // ----------------------------------------
            // Get font size for client document list
            // ----------------------------------------
            var userSettingsCache = new UserSettings();

            userSettingsCache.FKUserID       = Utils.UserID;
            userSettingsCache.FKScreenCode   = ScreenCode;
            userSettingsCache.FKControlCode  = FCMConstant.ScreenControl.TreeViewClientDocumentList;
            userSettingsCache.FKPropertyCode = FCMConstant.ScreenProperty.FontSize;

            var stringValue = Utils.UserSettingGetCacheValue(userSettingsCache);

            if (string.IsNullOrEmpty(stringValue))
            {
                stringValue = "8.25";
            }

            // Convert to float
            tvClientDocumentListFontSize = float.Parse(stringValue);

            tvFileList.Font =
                new System.Drawing.Font("Microsoft Sans Serif",
                                        tvClientDocumentListFontSize,
                                        System.Drawing.FontStyle.Regular,
                                        System.Drawing.GraphicsUnit.Point,
                                        ((System.Byte)(0)));
            // ----------------------------------------

            // ----------------------------------------
            // Get icon size for client document list
            // ----------------------------------------
            userSettingsCache.FKPropertyCode = FCMConstant.ScreenProperty.IconSize;

            var stringIconSize = Utils.UserSettingGetCacheValue(userSettingsCache);

            if (string.IsNullOrEmpty(stringIconSize))
            {
                stringIconSize = "16";
            }

            if (stringIconSize == "16")
            {
                tvFileList.ImageList = imageList16;
            }

            if (stringIconSize == "32")
            {
                tvFileList.ImageList = imageList32;
            }
        }
Пример #2
0
        /// <summary>
        /// Get file details from file name
        /// </summary>
        private void FileSelected(string fileName, string fullPathFileName)
        {
            // Get template folder
            var templateFolder =
                CodeValue.GetCodeValueExtended(FCMConstant.CodeTypeString.SYSTSET, FCMConstant.SYSFOLDER.TEMPLATEFOLDER);

            // Extract File Path
            string pathOnly = fullPathFileName.Replace(fileName, "");

            txtFileName.Text = fileName;
            txtLocation.Text = pathOnly;

            string pathPartToCheck = "";

            if (pathOnly.Length >= templateFolder.Length)
            {
                pathPartToCheck = pathOnly.Substring(0, templateFolder.Length);
            }
            else
            {
                pathPartToCheck = pathOnly;
            }

            if (pathPartToCheck != templateFolder)
            {
                txtFileName.Text = "";
                txtLocation.Text = "";

                MessageBox.Show("Please select file from allowed folder. " + templateFolder);
                return;
            }

            // Get reference path
            //
            string refPath =
                Utils.getReferenceFilePathName(txtLocation.Text);

            txtLocation.Text = refPath;

            // This is the name of the document and not the file name
            // If it is already set for the client, there is no need
            // to replace it. The idea here is to suggest a name only
            // when the document is being created.
            //
            if (string.IsNullOrEmpty(txtName.Text))
            {
                txtName.Text = fileName.Substring(0, fileName.Length - 4);
            }

            txtFileName.Text = fileName;
        }
Пример #3
0
        private void loadDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tvFileList.Nodes.Count <= 0)
            {
                MessageBox.Show("Root node is missing. Please contact technical support.");
                return;
            }
            //
            // Get selected document from tree
            //
            TreeNode tndocSelected    = tvFileList.SelectedNode;
            Document treeSelectedDoco = new Document();

            if (tndocSelected == null)
            {
                tvFileList.SelectedNode = tvFileList.Nodes[0];
                tndocSelected           = tvFileList.SelectedNode;
            }

            treeSelectedDoco = (Document)tndocSelected.Tag; // Cast

            var templateFolder = CodeValue.GetCodeValueExtended(MakConstant.CodeTypeString.SYSTSET, MakConstant.SYSFOLDER.TEMPLATEFOLDER);

            folderBrowserDialog1.ShowNewFolderButton = false;
            folderBrowserDialog1.SelectedPath        = templateFolder;
            folderBrowserDialog1.RootFolder          = Environment.SpecialFolder.Desktop;

            folderBrowserDialog1.ShowDialog();

            if (string.IsNullOrEmpty(folderBrowserDialog1.SelectedPath))
            {
                return;
            }

            string folderSelected = folderBrowserDialog1.SelectedPath;

            var resp =
                MessageBox.Show("Load Directory", "Are you sure? ", MessageBoxButtons.YesNo);

            if (resp == DialogResult.Yes)
            {
                var uioutput = new Windows.UIOutputMessage();
                uioutput.Show();

                var response = Utils.LoadFolder(folderSelected, uioutput, treeSelectedDoco.UID, 0, HeaderInfo.Instance);
                MessageBox.Show(response.Message, "Load Folder", MessageBoxButtons.OK, response.Icon);
            }

            loadDocumentList(HeaderInfo.Instance);
        }
Пример #4
0
        /// <summary>
        /// Remove role from user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RemoveRoleFromUser(object sender, EventArgs e)
        {
            // Get selected item in available tree
            //
            TreeNode tnUserRoleSelected = tvUserList.SelectedNode;

            if (tnUserRoleSelected == null)
            {
                return;
            }

            if (tnUserRoleSelected.Tag.GetType().ToString() != "FCMMySQLBusinessLibrary.SecurityUserRole")
            {
                return;
            }

            // Get role
            //
            SecurityUserRole roleOld = new SecurityUserRole(HeaderInfo.Instance);

            roleOld = (SecurityUserRole )tnUserRoleSelected.Tag;

            // Update database
            //
            SecurityUserRole newUserRole = new SecurityUserRole(HeaderInfo.Instance);

            newUserRole.UniqueID  = roleOld.UniqueID;
            newUserRole.FK_Role   = roleOld.FK_Role;
            newUserRole.FK_UserID = roleOld.FK_UserID;

            var response = newUserRole.Delete();

            Utils.RefreshCache();

            // Show message
            ControllerUtils.ShowFCMMessage(response.UniqueCode, Utils.UserID);

            RefreshList();
        }
Пример #5
0
        private void locateInExplorerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //
            // Get selected document from tree
            //
            TreeNode docSelected = tvFileList.SelectedNode;
            var      rm          = new Document();

            if (docSelected == null)
            {
                return;
            }

            rm = (Document)docSelected.Tag;  // Cast

            // Show file dialog
            string filePathName = Utils.getFilePathName(rm.Location, rm.FileName);
            string filePath     = Utils.GetPathName(rm.Location);

            openFileDialog1.FileName         = rm.FileName;
            openFileDialog1.InitialDirectory = filePath;

            var file = openFileDialog1.ShowDialog();
        }
Пример #6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            //
            // Get selected document from tree
            //
            TreeNode tndocSelected = tvDocumentList.SelectedNode;

            if (tndocSelected == null)
            {
                return;
            }

            var cds = new scClientDocSetDocLink();

            cds = (scClientDocSetDocLink)tndocSelected.Tag;

            var Location = cds.clientDocument.Location;
            var FileName = cds.clientDocument.FileName;
            var FileType = cds.clientDocument.DocumentType;

            //string filePathName =
            //         Utils.getFilePathName(Location,
            //                               FileName);


            //if (!string.IsNullOrEmpty(filePathName))
            //{
            //    WordDocumentTasks.OpenDocument(filePathName);
            //}
            //else
            //{
            //    MessageBox.Show("Document is empty.");
            //}

            Utils.OpenDocument(Location, FileName, FileType, vkReadOnly: false);
        }
Пример #7
0
        private void btnAddNewClient_Click(object sender, EventArgs e)
        {
            txtABN.Text                    = "";
            txtAddress.Text                = "";
            txtContactPerson.Text          = "";
            txtEmailAddress.Text           = "";
            txtFax.Text                    = "";
            txtName.Text                   = "";
            txtPhone.Text                  = "";
            txtUID.Text                    = "";
            cbxAssociateInitialSet.Checked = false;
            comboContractorSize.Text       = "";
            comboUserID.Text               = "";

            Bitmap MyImage;

            pbxLogo.SizeMode = PictureBoxSizeMode.StretchImage;
            string filePathName = Utils.getFilePathName(FCMConstant.SYSFOLDER.LOGOFOLDER, "imgNoImage.jpg");

            MyImage       = new Bitmap(filePathName);
            pbxLogo.Image = (Image)MyImage;

            Utils.ClientID = 0;
        }
Пример #8
0
        private void MapFieldsToScreen()
        {
            txtUID.Text              = _client.UID.ToString(CultureInfo.InvariantCulture);
            comboUserID.Text         = _client.FKUserID;
            txtName.Text             = _client.Name;
            txtLegalName.Text        = _client.LegalName;
            comboContractorSize.Text = _client.DocSetUIDDisplay;
            // cbxAssociateInitialSet.Text = false;
            txtAddress.Text       = _client.Address;
            txtPhone.Text         = _client.Phone;
            txtFax.Text           = _client.Fax;
            txtMobile.Text        = _client.Mobile;
            txtEmailAddress.Text  = _client.EmailAddress;
            txtContactPerson.Text = _client.MainContactPersonName;
            txtABN.Text           = _client.ABN;
            txtRecordVersion.Text = _client.RecordVersion.ToString(CultureInfo.InvariantCulture);
            txtLogo1Location.Text = _client.Logo1Location;

            string logoLocation = Utils.GetPathName(txtLogo1Location.Text);

            var dispLogo = _client.DisplayLogo;

            checkDisplayLogo.Checked = dispLogo == 'Y' ? true : false;

            // Get Company Logo
            //
            // logoLocation = Client.GetClientLogoLocation(client.UID);

            Bitmap MyImage;

            // Check if location exists
            if (File.Exists(logoLocation))
            {
                MyImage       = new Bitmap(logoLocation);
                pbxLogo.Image = (Image)MyImage;
            }
            else
            {
                LogFile.WriteToTodaysLogFile(
                    " FCMERR00000009 (01)" +
                    " Error. Client logo not found. " +
                    logoLocation +
                    " Client : " + _client.UID,
                    Utils.UserID);
            }

            if (_client.clientExtraInformation != null)
            {
                if (_client.clientExtraInformation.DateToEnterOnPolicies <= DateTime.MinValue ||
                    _client.clientExtraInformation.DateToEnterOnPolicies >= DateTime.MaxValue)
                {
                    _client.clientExtraInformation.DateToEnterOnPolicies = Utils.MinDate;
                    dtpDateToEnterOnPolicies.Value = _client.clientExtraInformation.DateToEnterOnPolicies;
                }
                else
                {
                    dtpDateToEnterOnPolicies.Value = _client.clientExtraInformation.DateToEnterOnPolicies;
                }

                if (_client.clientExtraInformation.ActionPlanDate <= DateTime.MinValue ||
                    _client.clientExtraInformation.ActionPlanDate >= DateTime.MaxValue)
                {
                    _client.clientExtraInformation.ActionPlanDate = Utils.MinDate;
                    dtpActionPlanDate.Value = _client.clientExtraInformation.ActionPlanDate;
                }
                else
                {
                    dtpActionPlanDate.Value = _client.clientExtraInformation.ActionPlanDate;
                }

                if (_client.clientExtraInformation.CertificationTargetDate <= DateTime.MinValue ||
                    _client.clientExtraInformation.CertificationTargetDate >= DateTime.MaxValue)
                {
                    _client.clientExtraInformation.CertificationTargetDate = Utils.MinDate;
                    dtpCertificationTargetDate.Value = _client.clientExtraInformation.CertificationTargetDate;
                }
                else
                {
                    dtpCertificationTargetDate.Value = _client.clientExtraInformation.CertificationTargetDate;
                }


                txtScopeOfServices.Text     = _client.clientExtraInformation.ScopeOfServices;
                txtTimeTrading.Text         = _client.clientExtraInformation.TimeTrading;
                txtRegionsOfOperation.Text  = _client.clientExtraInformation.RegionsOfOperation;
                txtOperationalMeetings.Text = _client.clientExtraInformation.OperationalMeetingsFrequency;
                txtProjectMeetings.Text     = _client.clientExtraInformation.ProjectMeetingsFrequency;
            }
        }
Пример #9
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     Utils.OpenDocument(txtLocation.Text, txtFileName.Text, cbxDocumentType.Text, vkReadOnly: false);
 }
Пример #10
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            // Separate the file name from the path
            // Store both in separate fields
            //

            // Get template folder
            var templateFolder =
                CodeValue.GetCodeValueExtended(FCMConstant.CodeTypeString.SYSTSET, FCMConstant.SYSFOLDER.TEMPLATEFOLDER);

            // Show file dialog
            openFileDialog1.InitialDirectory = templateFolder;
            openFileDialog1.Filter           = "*.doc|*.xls|*.xlsx|*.docx";
            openFileDialog1.FileName         = "*";

            var file = openFileDialog1.ShowDialog();

            if (file == DialogResult.OK)
            {
                // Only File Name
                string fileName = openFileDialog1.SafeFileName;
                // Full Path including file name
                string fullPathFileName = openFileDialog1.FileName;

                // Extract File Path
                string pathOnly = fullPathFileName.Replace(fileName, "");

                txtFileName.Text = fileName;
                txtLocation.Text = pathOnly;

                string pathPartToCheck = "";

                if (pathOnly.Length >= templateFolder.Length)
                {
                    pathPartToCheck = pathOnly.Substring(0, templateFolder.Length);
                }
                else
                {
                    pathPartToCheck = pathOnly;
                }

                if (pathPartToCheck != templateFolder)
                {
                    txtFileName.Text = "";
                    txtLocation.Text = "";

                    MessageBox.Show("Please select file from allowed folder. " + templateFolder);
                    return;
                }

                // Get reference path
                //
                string refPath =
                    Utils.getReferenceFilePathName(txtLocation.Text);
                txtLocation.Text = refPath;

                // This is the name of the document and not the file name
                // If it is already set for the client, there is no need
                // to replace it. The idea here is to suggest a name only
                // when the document is being created.
                //
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    txtName.Text = openFileDialog1.SafeFileName.Substring(0,
                                                                          openFileDialog1.SafeFileName.Length - 4);
                }

                txtFileName.Text = openFileDialog1.SafeFileName;

                // 03.04.2013
                // CLA-00-00
                txtDisplayName.Text  = txtFileName.Text;
                txtCUID.Text         = txtFileName.Text.Substring(0, 6);
                cbxDocumentType.Text = "WORD";
                cbxRecordType.Text   = FCMConstant.RecordType.DOCUMENT;

                if (txtFileName.Text.Length >= 10)
                {
                    txtSimpleFileName.Text = txtFileName.Text.Substring(10, txtFileName.Text.Length - 10);
                }

                enableSave(sender, e);
            }
        }
Пример #11
0
        private void btnLogon_Click(object sender, EventArgs e)
        {
            connectedTo = "not connected";

            if (rbLocal.Checked || rbServer.Checked)
            {//ok
            }
            else
            {
                MessageBox.Show("Please select database.");
                return;
            }


            if (rbLocal.Checked)
            {
                ConnString.ConnectionString = ConnString.ConnectionStringLocal;
                connectedTo = "Local";
            }
            if (rbServer.Checked)
            {
                ConnString.ConnectionString = ConnString.ConnectionStringServer;
                connectedTo = "Server";
            }

            // Set framework db as the same at this stage
            ConnString.ConnectionStringFramework = ConnString.ConnectionString;

            if (string.IsNullOrEmpty(ConnString.ConnectionString))
            {
                return;
            }

            try
            {
                Utils.UserID = txtUserID.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error loading database. Contact system administrator. " + ex.ToString());
                Application.Exit();
            }
            // Check if user is valid
            var uacnew = new UserAccess();

            var readuser = uacnew.Read(txtUserID.Text);

            if (readuser.ReturnCode == 0001 && readuser.ReasonCode == 0001)
            {
                // cool
            }
            if (readuser.ReturnCode == 0001 && readuser.ReasonCode == 0002)
            {
                MessageBox.Show("User not found.");
                return;
            }

            if (readuser.ReturnCode <= 000)
            {
                MessageBox.Show(readuser.Message);
                return;
            }

            if (string.IsNullOrWhiteSpace(uacnew.Password))
            {
                MessageBox.Show("User not found. Contact System Support.");
                return;
            }

            var response = uacnew.AuthenticateUser(txtUserID.Text, txtPassword.Text);

            if (response.ReturnCode == 0001 && response.ReasonCode == 0001)
            {
                // Cool
            }
            else
            {
                // Invalid Password
                //

                ControllerUtils.ShowFCMMessage(response.UniqueCode, txtUserID.Text, response.Message, "UILogon.cs");

                return;
            }


            var responseClientList = new BUSClient().ClientList(HeaderInfo.Instance);

            Utils.ClientList = responseClientList.clientList;

            string ret = LogFile.WriteToTodaysLogFile("User has logged on", Utils.UserID);

            if (ret != "" && ret.Length > 3 && ret.Substring(0, 5) == "Error")
            {
                MessageBox.Show(ret);
                Application.Exit();
            }

            // Retrieve User Settings - Load in memory
            //

            Utils.LoadUserSettingsInCache();
            LogFile.WriteToTodaysLogFile("User Settings loaded in cache", Utils.UserID);

            // Load reference data in cache
            //
            CachedInfo.LoadReferenceDataInCache(HeaderInfo.Instance);
            LogFile.WriteToTodaysLogFile("Reference Data loaded in cache", Utils.UserID);

            CachedInfo.LoadRelatedCodeInCache();
            LogFile.WriteToTodaysLogFile("Related code loaded in cache", Utils.UserID);

            // Set Header Info
            //
            HeaderInfo.Instance.CurrentDateTime = System.DateTime.Today;
            HeaderInfo.Instance.UserID          = txtUserID.Text;

            this.Hide();
        }
Пример #12
0
        // -----------------------------------------------------
        //           Load documents in a tree
        // -----------------------------------------------------
        public static void ListInTree(
            TreeView fileList,
            ClientDocumentLinkList documentList,
            Document root)
        {
            // Find root folder
            //
            Document rootDocument = new Document();

            rootDocument.CUID       = root.CUID;
            rootDocument.RecordType = root.RecordType;
            rootDocument.UID        = root.UID;
            // rootDocument.Read();

            // rootDocument = RepDocument.Read(false, root.UID);

            // Using Business Layer
            var documentReadRequest = new DocumentReadRequest();

            documentReadRequest.UID  = root.UID;
            documentReadRequest.CUID = root.CUID;
            documentReadRequest.retrieveVoidedDocuments = false;

            var docreadresp = BUSDocument.DocumentRead(documentReadRequest);

            if (docreadresp.response.ReturnCode == 0001)
            {
                // all good
            }
            else
            {
                MessageBox.Show(docreadresp.response.Message);
                return;
            }

            rootDocument = docreadresp.document;
            //


            // Create root
            //
            var rootNode = new TreeNode(rootDocument.Name, FCMConstant.Image.Folder, FCMConstant.Image.Folder);

            // Add root node to tree
            //
            fileList.Nodes.Add(rootNode);
            rootNode.Tag  = rootDocument;
            rootNode.Name = rootDocument.Name;

            foreach (var document in documentList.clientDocumentLinkList)
            {
                // Ignore root folder
                if (document.childDocument.CUID == "ROOT")
                {
                    continue;
                }

                // Check if folder has a parent
                string cdocumentUID = document.UID.ToString();
                string cparentIUID  = document.childDocument.ParentUID.ToString();

                int image = 0;

                if (document.childDocument.RecordType != null)
                {
                    document.childDocument.RecordType = document.childDocument.RecordType.Trim();
                }

                image = Utils.ImageSelect(document.childDocument.RecordType);

                if (document.childDocument.ParentUID == 0)
                {
                    var treeNode = new TreeNode(document.childDocument.Name, image, image);
                    treeNode.Tag  = document;
                    treeNode.Name = cdocumentUID;

                    rootNode.Nodes.Add(treeNode);
                }
                else
                {
                    // Find the parent node
                    //
                    var node = fileList.Nodes.Find(cparentIUID, true);

                    if (node.Count() > 0)
                    {
                        var treeNode = new TreeNode(document.childDocument.Name, image, image);
                        treeNode.Tag  = document;
                        treeNode.Name = cdocumentUID;

                        node[0].Nodes.Add(treeNode);
                    }
                    else
                    {
                        // Add Element to the root
                        //
                        var treeNode = new TreeNode(document.childDocument.Name, image, image);
                        treeNode.Tag  = document;
                        treeNode.Name = cdocumentUID;

                        rootNode.Nodes.Add(treeNode);
                    }
                }
            }
        }
Пример #13
0
        private void sendEmailToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var answer = MessageBox.Show("Would you like to send emails to impacted clients?",
                                         "Send email",
                                         MessageBoxButtons.YesNo);

            if (answer != DialogResult.Yes)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            List <Client> listOfClients = new List <Client>();

            // Get file name
            //
            string filePathName = Utils.getFilePathName(
                document.Location,
                document.FileName);

            if (!File.Exists(filePathName))
            {
                MessageBox.Show("File not found. " + filePathName);
                return;
            }


            // Select client to send email and show before send
            //
            var impacted = new ClientDocument();

            // impacted.ListImpacted(document);

            BUSClientDocument.ListImpacted(impacted, document);

            foreach (var doco in impacted.clientDocSetDocLink)
            {
                var response =
                    BUSClientContract.GetValidContractOnDate(doco.clientDocument.FKClientUID, System.DateTime.Today);

                if (response.ReturnCode == 0001 && response.ReasonCode == 0001)
                {
                    //Client client = new Client(HeaderInfo.Instance);
                    //client.UID = doco.clientDocument.FKClientUID;

                    ClientReadRequest crr = new ClientReadRequest();
                    crr.clientUID  = doco.clientDocument.FKClientUID;
                    crr.headerInfo = HeaderInfo.Instance;

                    var busClientResponse = BUSClient.ClientRead(crr);

                    //var busClientResponse = client.Read();

                    listOfClients.Add(busClientResponse.client);
                }
            }

            if (listOfClients.Count <= 0)
            {
                return;
            }

            string subject = "Document updated";
            string body    = "The document " + document.Name + " has been updated.";

            var resp = SendEmailToGroup(
                clientList: listOfClients,
                iSubject: subject,
                iBody: body,
                Attachment: filePathName);

            MessageBox.Show(resp.Message);

            Cursor.Current = Cursors.Arrow;
        }
Пример #14
0
        private void ListImpact(Document document, int h = 16, int w = 16)
        {
            // Clear nodes
            tvDocumentList.Nodes.Clear();

            var impacted = new ClientDocument();

            // impacted.ListImpacted(document);

            BUSClientDocument.ListImpacted(impacted, document);

            TreeNode rootNode = new TreeNode("Impacted List", FCMConstant.Image.Folder, FCMConstant.Image.Folder);

            rootNode.Name = "Impacted List";
            tvDocumentList.Nodes.Add(rootNode);

            foreach (var doco in impacted.clientDocSetDocLink)
            {
                // string clientName = Client.ReadFieldClient(DBFieldName.Client.Name, doco.clientDocument.FKClientUID);

                var clientField = new Client(HeaderInfo.Instance);

                // string clientName = clientField.ReadFieldClient(DBFieldName.Client.Name, doco.clientDocument.FKClientUID);
                var readFieldClientResponse = new BUSClient().ReadFieldClient(
                    new ReadFieldRequest()
                {
                    clientUID = doco.clientDocument.FKClientUID, field = FCMDBFieldName.Client.Name, headerInfo = HeaderInfo.Instance
                });

                string clientName = readFieldClientResponse.fieldContents;

                // 1) Add client to tree
                //
                // 1.1) Find out current contract information
                // 1.2) Display document version
                // 1.3) Check if document has been further updated
                var response =
                    BUSClientContract.GetValidContractOnDate(doco.clientDocument.FKClientUID, System.DateTime.Today);

                // Successful
                ClientContract clientContractValid = new ClientContract();
                string         validContract       = @";Contract=N/A";
                if (response.ReturnCode == 0001 && response.ReasonCode == 0001)
                {
                    clientContractValid = (ClientContract)response.Contents;
                    validContract       = ";Contract=Valid";
                }

                int imageClient = Utils.GetClientLogoImageSeqNum(doco.clientDocument.FKClientUID);

                string NameToDisplay = clientName + " ==> " +
                                       validContract +
                                       "; Version: " +
                                       doco.clientDocument.ClientIssueNumber.ToString();

                TreeNode clientNode = new TreeNode(NameToDisplay, imageClient, imageClient);
                clientNode.Name = doco.clientDocument.FKClientUID.ToString();
                clientNode.Tag  = doco;
                rootNode.Nodes.Add(clientNode);

                // Add Client Document Set to tree
                //
                TreeNode clientDocumentSetNode = new TreeNode("Set " + doco.clientDocument.FKClientDocumentSetUID.ToString(), FCMConstant.Image.Folder, FCMConstant.Image.Folder);
                clientDocumentSetNode.Name = "Set " + doco.clientDocument.FKClientDocumentSetUID.ToString("0000");
                clientDocumentSetNode.Tag  = doco;
                clientNode.Nodes.Add(clientDocumentSetNode);

                // Add document to tree
                //
                int      image        = Utils.GetFileImage(doco.clientDocument.SourceFilePresent, doco.clientDocument.DestinationFilePresent, doco.clientDocument.DocumentType);
                TreeNode documentNode = new TreeNode(txtDocumentName.Text, image, image);
                documentNode.Name = txtDocumentName.Text;
                documentNode.Tag  = doco;
                clientDocumentSetNode.Nodes.Add(documentNode);
            }

            if (tvDocumentList.Nodes.Count > 0)
            {
                tvDocumentList.Nodes[0].Expand();
            }
        }