public void loadDocumentList(int documentSetUID = 0) { // Image list // ImageList imageList = ControllerUtils.GetImageList(); // Binding tvFileList.ImageList = imageList; // Clear nodes tvFileList.Nodes.Clear(); // List Document Set documentSet.UID = documentSetUID; documentSet.Read(IncludeDocuments: 'Y'); // Load document in the treeview // Document root = new Document(); root.CUID = "ROOT"; root.RecordType = FCMConstant.RecordType.FOLDER; root.UID = 0; // root.Read(); // root = RepDocument.Read(false, 0, "ROOT"); // Using Business Layer root = BUSDocument.GetRootDocument(); // DocumentList.ListInTree(tvFileList, documentSet.documentList, root); tvFileList.Nodes[0].Expand(); }
/// <summary> /// List of documents /// </summary> public static DocumentSet DocumentSetRead(int documentSetUID) { DocumentSet documentSet = new DocumentSet(); documentSet.UID = documentSetUID; documentSet.Read('Y'); return(documentSet); }
public static ResponseStatus AddDocumentToSet(HeaderInfo headerInfo, int documentSetUID, int documentUID) { // Find Document // DocumentReadRequest documentReadRequest = new DocumentReadRequest(); documentReadRequest.headerInfo = headerInfo; documentReadRequest.retrieveVoidedDocuments = false; documentReadRequest.UID = documentUID; var documentReadResponse = BUSDocument.DocumentRead(documentReadRequest); var documentSelected = new Document(); documentSelected = documentReadResponse.document; // Find parent of the document // var folderReadRequestParent = new DocumentReadRequest(); folderReadRequestParent.headerInfo = headerInfo; folderReadRequestParent.retrieveVoidedDocuments = false; folderReadRequestParent.UID = documentSelected.ParentUID; // Reading parent var folderParentResponse = BUSDocument.DocumentRead(folderReadRequestParent); var folderParent = new Document(); folderParent = folderParentResponse.document; // Find DocumentSet // var documentSet = new DocumentSet(); documentSet.UID = documentSetUID; documentSet.Read('N'); // Create link // DocumentSetDocument dsd = new DocumentSetDocument(); dsd.FKDocumentSetUID = documentSet.UID; dsd.FKDocumentUID = documentSelected.UID; dsd.EndDate = System.DateTime.MaxValue; dsd.StartDate = System.DateTime.Today; dsd.UID = 0; dsd.Location = documentSelected.Location; dsd.SequenceNumber = 1; dsd.IsVoid = 'N'; dsd.FKParentDocumentSetUID = documentSet.UID; dsd.FKParentDocumentUID = folderReadRequestParent.UID; // Is this the ID of the parent on the document table or the id of the document on this table? dsd.Add(); return(new ResponseStatus()); }
/// <summary> /// Load client object /// </summary> /// <param name="reader"></param> /// <param name="client"> </param> private static void LoadClientObject(MySqlDataReader reader, Client client) { client.UID = Convert.ToInt32(reader[FCMDBFieldName.Client.UID]); client.RecordVersion = Convert.ToInt32(reader[FCMDBFieldName.Client.RecordVersion]); client.ABN = reader[FCMDBFieldName.Client.ABN].ToString(); client.Name = reader[FCMDBFieldName.Client.Name].ToString(); client.LegalName = reader[FCMDBFieldName.Client.LegalName].ToString(); client.Address = reader[FCMDBFieldName.Client.Address].ToString(); client.EmailAddress = reader[FCMDBFieldName.Client.EmailAddress].ToString(); client.Phone = reader[FCMDBFieldName.Client.Phone].ToString(); try { client.FKUserID = reader[FCMDBFieldName.Client.FKUserID].ToString(); } catch { client.FKUserID = ""; } try { client.FKDocumentSetUID = Convert.ToInt32(reader[FCMDBFieldName.Client.FKDocumentSetUID]); } catch { client.FKDocumentSetUID = 0; } try { client.Fax = reader[FCMDBFieldName.Client.Fax].ToString(); } catch { client.Fax = ""; } try { client.Mobile = reader[FCMDBFieldName.Client.Mobile].ToString(); } catch { client.Mobile = ""; } try { client.Logo1Location = reader[FCMDBFieldName.Client.Logo1Location].ToString(); } catch { client.Logo1Location = ""; } try { client.Logo2Location = reader[FCMDBFieldName.Client.Logo2Location].ToString(); } catch { client.Logo2Location = ""; } try { client.Logo3Location = reader[FCMDBFieldName.Client.Logo3Location].ToString(); } catch { client.Logo3Location = ""; } try { client.MainContactPersonName = reader[FCMDBFieldName.Client.MainContactPersonName].ToString(); } catch { client.MainContactPersonName = ""; } try { client.DisplayLogo = Convert.ToChar(reader[FCMDBFieldName.Client.DisplayLogo]); } catch { client.DisplayLogo = ' '; } try { client.UpdateDateTime = Convert.ToDateTime(reader[FCMDBFieldName.Client.UpdateDateTime].ToString()); } catch { client.UpdateDateTime = DateTime.Now; } try { client.CreationDateTime = Convert.ToDateTime(reader[FCMDBFieldName.Client.CreationDateTime].ToString()); } catch { client.CreationDateTime = DateTime.Now; } try { client.IsVoid = reader[FCMDBFieldName.Client.IsVoid].ToString(); } catch { client.IsVoid = "N"; } try { client.UserIdCreatedBy = reader[FCMDBFieldName.Client.UserIdCreatedBy].ToString(); } catch { client.UserIdCreatedBy = "N"; } try { client.UserIdUpdatedBy = reader[FCMDBFieldName.Client.UserIdCreatedBy].ToString(); } catch { client.UserIdCreatedBy = "N"; } client.DocSetUIDDisplay = "0; 0"; if (client.FKDocumentSetUID > 0) { DocumentSet ds = new DocumentSet(); ds.UID = client.FKDocumentSetUID; ds.Read('N'); client.DocSetUIDDisplay = ds.UID + "; " + ds.TemplateType; } }
/// <summary> /// Associate documents from selected document set to selected client /// </summary> /// <param name="clientUID"></param> /// <param name="clientDocumentSetUID"></param> /// <param name="documentSetUID"></param> public static void AssociateDocumentsToClient( ClientDocumentSet clientDocumentSet, int documentSetUID, HeaderInfo headerInfo) { // It is a new client document set // It maybe a new client, the client document set MUST be new or empty // 1) Instantiate a TREE for the Client Document Set document // 2) Instantiate a second tree for the documents related to that document set // 3) Now the old copy all starts, all the nodes from the second tree are moved to the new tree // following current process // 4) Save happens as per usual // TreeView tvFileList = new TreeView(); // This is the list of documents for a client, it should be EMPTY TreeView tvDocumentsAvailable = new TreeView(); // This is the list of documents for a client, it should be EMPTY string folderOnly = clientDocumentSet.FolderOnly; // Contains the folder location of the file // Add root folder // ClientDocument clientDocument = new ClientDocument(); clientDocument.AddRootFolder(clientDocumentSet.FKClientUID, clientDocumentSet.ClientSetID, clientDocumentSet.FolderOnly); // List client document list !!!!!!! Important because the ROOT folder is loaded ;-) var documentSetList = new ClientDocument(); documentSetList.List(clientDocumentSet.FKClientUID, clientDocumentSet.ClientSetID); tvFileList.Nodes.Clear(); documentSetList.ListInTree(tvFileList, "CLIENT"); if (tvFileList.Nodes.Count > 0) { tvFileList.Nodes[0].Expand(); } // Load available documents // tvDocumentsAvailable.Nodes.Clear(); // Get document list for a given document set // DocumentSet documentSet = new DocumentSet(); documentSet.UID = documentSetUID; documentSet.Read(IncludeDocuments: 'Y'); // Load document in the treeview // Document.Document root = new Document.Document(); root.GetRoot(headerInfo); DocumentList.ListInTree(tvDocumentsAvailable, documentSet.documentList, root); while (tvDocumentsAvailable.Nodes[0].Nodes.Count > 0) { TreeNode tn = tvDocumentsAvailable.Nodes[0].Nodes[0]; tn.Remove(); tvFileList.Nodes[0].Nodes.Add(tn); } tvFileList.SelectedNode = tvFileList.Nodes[0]; // ------------------------------------------------------------------- // The documents have been moved from the available to client's tree // Now it is time to save the documents // ------------------------------------------------------------------- Save(clientDocumentSet, documentSetUID, tvFileList); ClientDocumentLink cloneLinks = new ClientDocumentLink(); cloneLinks.ReplicateDocSetDocLinkToClient(clientDocumentSet.FKClientUID, clientDocumentSet.ClientSetID, documentSetUID); }