Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Document docSave = new Document();

            docSave.CUID                = txtCUID.Text;
            docSave.Comments            = txtComments.Text;
            docSave.Directory           = txtDirectory.Text;
            docSave.LatestIssueLocation = txtLatestIssueLocation.Text;
            docSave.LatestIssueNumber   = txtLatestIssueNumber.Text;
            docSave.Name                = txtName.Text;
            docSave.SequenceNumber      = txtSeqNum.Text;
            docSave.Subdirectory        = txtSubDirectory.Text;
            docSave.Comments            = txtComments.Text;

            docSave.Save();

            if (uidl != null)
            {
                uidl.Refresh();
            }
        }
Exemplo n.º 2
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;
            }
        }