Exemple #1
0
        // ---------------------------------------
        // Save sequence number and parent
        // ---------------------------------------
        private void SaveSequenceParent(HeaderInfo headerInfo, Document document)
        {
            // document.Save(headerInfo, FCMConstant.SaveType.UPDATE);

            //RepDocument.Save(headerInfo, document, FCMConstant.SaveType.UPDATE);

            var documentSaveRequest = new DocumentSaveRequest();

            documentSaveRequest.inDocument = document;
            documentSaveRequest.headerInfo = HeaderInfo.Instance;
            documentSaveRequest.saveType   = FCMConstant.SaveType.UPDATE;

            var resp = BUSDocument.DocumentSave(documentSaveRequest);

            document.UID = resp.document.UID;
        }
Exemple #2
0
        private void btnFixLocation_Click(object sender, EventArgs e)
        {
            int documentUID = Convert.ToInt32(txtUID.Text);
            var drr         = new DocumentReadRequest();

            drr.UID = documentUID;

            var docread = BUSDocument.DocumentRead(drr);

            if (docread.document.RecordType == "FOLDER")
            {
                return;
            }

            var documentSaveRequest = new DocumentSaveRequest();

            documentSaveRequest.inDocument      = docread.document;
            documentSaveRequest.inDocument.Name =
                UIHelper.ClientDocumentUIHelper.SetDocumentName(
                    documentSaveRequest.inDocument.SimpleFileName,
                    documentSaveRequest.inDocument.IssueNumber.ToString(),
                    documentSaveRequest.inDocument.CUID,
                    documentSaveRequest.inDocument.RecordType,
                    documentSaveRequest.inDocument.FileName);
            documentSaveRequest.headerInfo = HeaderInfo.Instance;
            documentSaveRequest.saveType   = FCMConstant.SaveType.UPDATE;

            var resp = BUSDocument.DocumentSave(documentSaveRequest);

            txtLocation.Text = resp.document.Location;
            txtName.Text     = resp.document.Name;

            TreeNode tndocSelected = tvFileList.SelectedNode;

            if (tndocSelected != null)
            {
                if (tndocSelected.Tag.GetType().Name == "Document")
                {
                    tndocSelected.Tag = resp.document;
                }
            }
        }
Exemple #3
0
        private void fixDocumentLocation(TreeNode tn)
        {
            if (tn.Tag == null)
            {
                return;
            }

            Document document = (Document)tn.Tag;

            if (document.RecordType == "FOLDER")
            {
                foreach (TreeNode node in tn.Nodes)
                {
                    fixDocumentLocation(node);
                }
            }

            var drr = new DocumentReadRequest();

            drr.UID = document.UID;

            var docread = BUSDocument.DocumentRead(drr);

            var documentSaveRequest = new DocumentSaveRequest();

            documentSaveRequest.inDocument = docread.document;

            documentSaveRequest.inDocument.Name =
                UIHelper.ClientDocumentUIHelper.SetDocumentName(
                    documentSaveRequest.inDocument.SimpleFileName,
                    documentSaveRequest.inDocument.IssueNumber.ToString(),
                    documentSaveRequest.inDocument.CUID,
                    documentSaveRequest.inDocument.RecordType,
                    documentSaveRequest.inDocument.FileName);

            documentSaveRequest.headerInfo = HeaderInfo.Instance;
            documentSaveRequest.saveType   = FCMConstant.SaveType.UPDATE;

            var resp = BUSDocument.DocumentSave(documentSaveRequest);

            tn.Tag = resp.document;
        }
Exemple #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //Document docSave = new Document();

            if (string.IsNullOrEmpty(cbxSourceCode.Text))
            {
                MessageBox.Show("Source code must be set.");
                return;
            }

            if (string.IsNullOrEmpty(cbxDocumentType.Text))
            {
                MessageBox.Show("Document Type must be set.");
                return;
            }



            if (string.IsNullOrEmpty(txtUID.Text))
            {
                docSave.UID = 0;
            }
            else
            {
                docSave.UID = Convert.ToInt32(txtUID.Text);
            }

            if (checkProjectPlan.Checked)
            {
                docSave.IsProjectPlan = "N";
            }
            else
            {
                docSave.IsProjectPlan = "N";
            }

            docSave.CUID     = txtCUID.Text;
            docSave.Comments = txtComments.Text;
            docSave.Location = txtLocation.Text;
            docSave.Status   = "ACTIVE";

            if (string.IsNullOrEmpty(txtIssueNumber.Text))
            {
                docSave.IssueNumber = 0;
            }
            else
            {
                docSave.IssueNumber = Convert.ToInt32(txtIssueNumber.Text);
            }
            docSave.Name           = txtName.Text;
            docSave.DisplayName    = txtDisplayName.Text;
            docSave.RecordType     = cbxRecordType.Text;
            docSave.SimpleFileName = txtSimpleFileName.Text;

            if (cbxRecordType.Text == FCMConstant.RecordType.FOLDER)
            {
                cbxDocumentType.Text = MackkadoITFramework.Helper.Utils.DocumentType.FOLDER;
            }

            docSave.DocumentType = cbxDocumentType.Text;

            if (string.IsNullOrEmpty(cbxRecordType.Text))
            {
                MessageBox.Show("Record Type is mandatory.");
                return;
            }
            if (string.IsNullOrEmpty(cbxDocumentType.Text))
            {
                MessageBox.Show("Document Type is mandatory.");
                return;
            }


            // Parent UID is sourced from document tree
            //
            if (string.IsNullOrEmpty(txtParentUID.Text))
            {
                docSave.ParentUID = 0;
            }
            else
            {
                docSave.ParentUID = Convert.ToInt32(txtParentUID.Text);
            }

            if (string.IsNullOrEmpty(txtSeqNum.Text))
            {
                docSave.SequenceNumber = 0;
            }
            else
            {
                docSave.SequenceNumber = Convert.ToInt32(txtSeqNum.Text);
            }

            docSave.Comments = txtComments.Text;
            docSave.FileName = txtFileName.Text;

            docSave.FileExtension = MKITHelper.Utils.GetFileExtensionString(txtFileName.Text);

            docSave.SourceCode = cbxSourceCode.Text;

            if (string.IsNullOrEmpty(txtClientUID.Text))
            {
                docSave.FKClientUID = 0;
            }
            else
            {
                docSave.FKClientUID = Convert.ToInt32(txtClientUID.Text);
            }

            if (docSave.SourceCode == "CLIENT" && docSave.FKClientUID == 0)
            {
                MessageBox.Show("Client ID is mandatory if source type is CLIENT");
                return;
            }

            // docSave.Save(HeaderInfo.Instance, FCMConstant.SaveType.UPDATE);

            // RepDocument.Save(HeaderInfo.Instance, docSave, FCMConstant.SaveType.UPDATE);

            var documentSaveRequest = new DocumentSaveRequest();

            documentSaveRequest.inDocument = docSave;
            documentSaveRequest.headerInfo = HeaderInfo.Instance;
            documentSaveRequest.saveType   = FCMConstant.SaveType.UPDATE;

            var resp = BUSDocument.DocumentSave(documentSaveRequest);

            docSave.UID = resp.document.UID;

            if (uidl != null)
            {
                uidl.Refresh();
            }

            txtLocation.Text = resp.document.Location;


            MessageBox.Show(resp.response.Message);

            txtCUID.Enabled  = false;
            txtCUID.ReadOnly = true;
            //txtDirectory.Focus();

            documentSavedSuccessfully = true;

            if (treeNode == null)
            {
                // There is no need to set the treenode unless it is passed in.
            }
            else
            {
                treeNode.Tag  = docSave;
                treeNode.Name = docSave.FileName;
            }
        }