Esempio n. 1
0
        private void tempBtnAddDocumentClick(object sender, RoutedEventArgs e)
        {
            DLDocument dlDocument = new DLDocument()
            {
                companyId    = 1111,
                docTypeId    = 71,
                documentDate = DateTime.Now,
                documentId   = 2,
                documentPath = "\\vinay1\\rdc.xlsx",
                rev_no       = 0,
                sender       = "V"
            };
            DataLayer dl  = new DataLayer();
            Response  res = dl.AddDocument(dlDocument);

            if (res.success)
            {
                // document added
                MessageBox.Show("Document added");
            }
            else if (res.isException)
            {
                MessageBox.Show(res.exception);
            }
        }
        public void SaveInDb(string documentSavePath)
        {
            DataLayer dl        = new DataLayer();
            Response  res       = dl.GetDoctypeIdByName(cmbTemplateFolders.SelectedItem.ToString());
            int       docTypeId = 0;

            if (res.success)
            {
                docTypeId = (int)res.body;
            }
            else if (res.isException)
            {
                MessageBox.Show(res.exception);
                return;
            }
            //int docTypeId = Int32.Parse(dl.GetDoctypeIdByName(cmbTemplateFolders.SelectedItem.ToString()).ToString());
            Trace.WriteLine("Doctype id " + docTypeId);
            DLDocument dlDocument = new DLDocument()
            {
                companyId    = getCurrentSelectedCompany().companyId,
                docTypeId    = docTypeId,
                documentId   = Int32.Parse(txtDocumentSerialNumber.Text),
                documentPath = documentSavePath,
                sender       = txtRef.Text
            };

            res = dl.AddDocument(dlDocument);
            if (res.success)
            {
                // document added
                //MessageBox.Show("Document added");
                populateDocumentsDataGrid(cmbTemplateFolders.SelectedItem.ToString());
            }
            else if (res.isException)
            {
                MessageBox.Show("Exception in adding document : " + res.exception);
            }
        }