示例#1
0
        /// <summary>
        /// Статический метод. Возвращает тип документа как тестовую строку
        /// </summary>
        public static string GetDocumentTypeAsString(DocumentTypes documentType)
        {
            string documentTypeAsString;                                        // Тип документа (как тескстовая строка)

            switch (documentType)                                               // Проверить тип документа
            {
            case DocumentTypes.passport:                                        // Тип документа: паспорт
                documentTypeAsString = "Паспорт";                               // Задать тип документа
                break;

            case DocumentTypes.driverId:                                        // Тип документа: водительское удостоверение
                documentTypeAsString = "Водительское удостоверение";            // Задать тип документа
                break;

            case DocumentTypes.warId:                                           // Тип документа: военный билет
                documentTypeAsString = "Военный билет";                         // Задать тип документа
                break;

            default:                                                            // Тип документа: документ по умолчанию
                documentTypeAsString = "";                                      // Задать тип документа
                break;
            }

            return(documentTypeAsString);
        }
        public static void PrintToPdf(
            PdfDocument document,
            ESolutions.Web.UI.Page parentPage,
            Invoice invoice,
            DocumentTypes documentType,
            Boolean isCopy)
        {
            String url = PageUrlAttribute.GetAbsolute <Invoices.Print>(parentPage, new Invoices.Print.Query()
            {
                Invoice      = invoice,
                DocumentType = documentType,
                IsCopy       = isCopy
            });

            HtmlToPdf.Options.PageSize   = EO.Pdf.PdfPageSizes.A4;
            HtmlToPdf.Options.OutputArea = new RectangleF(0.0f, 0.0f, HtmlToPdf.Options.PageSize.Width, HtmlToPdf.Options.PageSize.Height);
            HtmlToPdf.Options.UserName   = ShopperConfiguration.Default.Printing.User;
            HtmlToPdf.Options.Password   = ShopperConfiguration.Default.Printing.Password;
            HtmlToPdf.ConvertUrl(url, document);

            FileInfo invoicePdfFile = invoice.CreateArchiveFileFullname();

#if !DEBUG
            if (!invoicePdfFile.Exists && documentType == DocumentTypes.Invoice)
            {
                invoice.Printed = true;
                MyDataContext.Default.SaveChanges();
                Print.WriteToDisk(document, invoicePdfFile);
            }
#endif
        }
        private DocumentTypeDiffgram AddDocumentType(DocumentTypeConfiguration documentTypeConfiguration)
        {
            var docTypeDiffgram = new DocumentTypeDiffgram(this, documentTypeConfiguration, serviceContext);

            DocumentTypes.Add(documentTypeConfiguration.Alias, docTypeDiffgram);
            return(docTypeDiffgram);
        }
        public List <DocumentTypes> selectDocumentTypes()
        {
            List <DocumentTypes> Documentos = new List <DocumentTypes>();



            DataSet ds    = new DataSet();
            string  query = "exec spS_Requirements";

            ds = con.ObtenerConsulta(query);


            foreach (DataRow DR in ds.Tables[0].Rows)
            {
                DocumentTypes dtype = new DocumentTypes();
                dtype.Name           = DR["Name"].ToString();
                dtype.DocumentTypeId = Convert.ToInt32(DR["DocumentTypeId"].ToString());
                dtype.Name           = DR["Name"].ToString();
                dtype.Required       = Convert.ToBoolean(DR["Required"].ToString());
                Documentos.Add(dtype);
            }



            return(Documentos);
        }
            //Constructors
            #region InvoiceLayout
            public InvoiceLayout(Invoice invoice, DocumentTypes documentType, Boolean isCopy)
            {
                this.Invoice      = invoice;
                this.DocumentType = documentType;
                this.IsCopy       = isCopy;

                List <InvoiceItem> itemsWithShipping = new List <InvoiceItem>(this.Invoice.InvoiceItems.OrderBy(runner => runner.ArticleNumber).ToArray());

                itemsWithShipping.Add(InvoiceItem.CreateShippingCosts(this.Invoice));

                Int32 pageCount =
                    itemsWithShipping.Count % InvoiceLayout.InvoiceItemsPerPage == 0 ?
                    itemsWithShipping.Count / InvoiceLayout.InvoiceItemsPerPage :
                    itemsWithShipping.Count / InvoiceLayout.InvoiceItemsPerPage + 1;

                Int32 pageIndex = 0;

                this.InvoiceLayoutPages = new List <InvoiceLayoutPage>();
                while (pageIndex < pageCount)
                {
                    InvoiceLayoutPage lastPage = this.InvoiceLayoutPages.LastOrDefault();
                    InvoiceLayoutPage newPage  = new InvoiceLayoutPage(
                        this,
                        lastPage,
                        itemsWithShipping.Skip(pageIndex * InvoiceLayout.InvoiceItemsPerPage).Take(InvoiceLayout.InvoiceItemsPerPage));

                    if (lastPage != null)
                    {
                        lastPage.NextPage = newPage;
                    }

                    this.InvoiceLayoutPages.Add(newPage);
                    pageIndex++;
                }
            }
示例#6
0
        /// <summary>
        /// to activate (or create if not exist) child form with appropriate id
        /// </summary>
        /// <param name="documentType">type of document to be created</param>
        /// <param name="id">id of entity to be opened</param>
        public void OpenChildForm(DocumentTypes documentType, Guid id = default(Guid))
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>("id", id));
            OpenReturnChildForm(documentType, parameters, id);
        }
示例#7
0
        public static IState EndofRecord()
        {
            // if current document type is return document, do not change type with choosen customer default document type
            if (cr.Document.DocumentTypeId == (int)DocumentTypes.RETURN_DOCUMENT)
            {
                return((ReturnConfirm == null) ? Start.Instance() : ReturnConfirm());
            }

            if (cr.Document.Customer.DefaultDocumentType != (DocumentTypes)cr.Document.DocumentTypeId)
            {
                DocumentTypes type = DocumentTypes.RECEIPT;
                switch (cr.Document.Customer.DefaultDocumentType)
                {
                case DocumentTypes.INVOICE:
                    type = DocumentTypes.INVOICE;
                    break;

                case DocumentTypes.E_INVOICE:
                    type = DocumentTypes.E_INVOICE;
                    break;

                case DocumentTypes.E_ARCHIEVE:
                    type = DocumentTypes.E_ARCHIEVE;
                    break;
                }
                cr.ChangeDocumentType(cr.ChangeDocumentType(cr.Document, type));
                return(cr.State);
            }
            else
            {
                return((ReturnConfirm == null) ? Start.Instance() : ReturnConfirm());
            }
        }
示例#8
0
        public async Task <GetResponse <IDocument> > GetByTypeAsync(int clientId, DocumentTypes documentType)
        {
            var response = new GetResponse <IDocument>();

            try
            {
                using (var connection = ConnectionFactory.GetConnection())
                {
                    var sql = $@"{GetDocumentSelectStatement()} AND [TypeId] = @typeId AND ([ClientId] = @clientId OR [ClientId] = 0) ORDER BY ClientID DESC;
                                 {GetDocumentFieldSelectStatement()} AND d.TypeId = @typeId AND (d.[ClientId] = @clientId OR d.[ClientId] = 0)";

                    var results = await connection.QueryMultipleAsync(sql, new { TypeId = (int)documentType, ClientId = clientId });

                    response = GetResponse(results);

                    if (response.Content == null)
                    {
                        response.AddError($@"Unable to locate a document with Type: {documentType} for client with ID: {clientId}");
                    }
                }
            }
            catch (Exception e)
            {
                var message = $@"Unable to retrieve a document with Type: {documentType} for client with ID: {clientId}.";
                response.AddError(e);
                LogManager.LogError(e, message);
                Console.WriteLine(e);
            }

            return(response);
        }
        public DocumentTypeConfigurator DocumentType(string alias)
        {
            var documentTypeConfiguration = new DocumentTypeConfigurator(this, alias);

            DocumentTypes.Add(alias, documentTypeConfiguration);
            return(documentTypeConfiguration);
        }
示例#10
0
        public void CreateUser()
        {
            if (file != null)
            {
                imageArray = FilesHelper.ReadFully(file.GetStream());
            }

            employee = mainViewModel.Employee;

            EditEmployee = new Employee
            {
                EmployeeId     = employee.EmployeeId,
                FirstName      = FirstName,
                LastName       = LastName,
                EmployeeCode   = EmployeeCode,
                DocumentTypeId = DocumentTypes.ElementAt(SourceIndex).DocumentTypeId,
                LoginTypeId    = employee.LoginTypeId,
                Document       = Document,
                Email          = Email,
                Phone          = Phone,
                Address        = Address,
                ImageArray     = imageArray,
                Password       = employee.Password,
                AccessToken    = employee.AccessToken,
                TokenType      = employee.TokenType,
                TokenExpires   = employee.TokenExpires,
                IsRemembered   = employee.IsRemembered,
            };
        }
示例#11
0
 public Company(string companyName, string document, DocumentTypes type, FederativeUnits fu)
 {
     this.CompanyName    = companyName;
     this.Document       = document;
     this.DocumentType   = type;
     this.FederativeUnit = fu;
 }
示例#12
0
        private void ProductsForm_Load(object sender, EventArgs e)
        {
            //Set tab so tab pages aren't displayed
            tabControlProducts.Appearance = TabAppearance.FlatButtons;
            tabControlProducts.ItemSize   = new System.Drawing.Size(0, 1);
            tabControlProducts.SizeMode   = TabSizeMode.Fixed;

            //Configure elements for when the form is first time opened
            btnSearchProducts.Visible = false;
            btnSaveProducts.Visible   = false;

            lblWeightUnit.Text = PropertiesHolder.weightUnit;

            //Get products from database
            //ProductsHolder.products = ProductManager.GetProducts();

            //set next id [last+1]
            tBoxAddID.Text = (ProductsHolder.products.Count == 0 ? 0 : (from elem in ProductsHolder.products select elem.id).Max() + 1).ToString();

            //DataGridViewSetup RECEVING
            documentProducts         = new List <ProductDisplay>();
            source                   = new BindingSource();
            source.DataSource        = documentProducts;
            dgv_receiving.DataSource = source;

            _selectedDocument = DocumentTypes.writeOff;

            //Amount document tbox
            tbox_document_amount.Text    = "1";
            tbox_document_amount.Enabled = false;
        }
示例#13
0
        /// <summary>
        /// to create child form with new entity and this number should be as proposed number
        /// </summary>
        /// <param name="documentType">type of document</param>
        /// <param name="number">number</param>
        public void OpenChildForm(DocumentTypes documentType, string number)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>("number", number));
            OpenReturnChildForm(documentType, parameters);
        }
示例#14
0
        private async void LoadData()
        {
            using (BusyScope.CreateWork())
            {
                try
                {
                    var types = await Task.Run(() => _accountIdentService.GetPrimaryPersonalDocuments());

                    foreach (var type in types)
                    {
                        DocumentTypes.Add(type);
                    }
                }
                catch (Exception ex)
                {
                    var message = ex.GetLastError();
                    _userMessageService?.ShowError(message);
                }
            }

            if (cardReader != null)
            {
                var curentCard = cardReader.GetCardOnScanner();
                if (curentCard != null)
                {
                    TryFindAccountByCard(curentCard.CardNumber);
                }
            }
        }
示例#15
0
        /// <summary>
        /// Creates a document using a fully qualified or relative filename.
        /// </summary>
        /// <param name="filename">The fully qualified or relative filename.</param>
        /// <param name="documentType"></param>
        /// <returns>Returns a Document object which represents the document.</returns>
        /// <example>
        /// <code>
        /// // Create a document using a relative filename.
        /// using (var document = DocX.Create(@"..\Test.docx"))
        /// {
        ///     // Do something with the document here.
        ///
        ///     // Save all changes made to this document.
        ///     document.Save();
        /// }// Release this document from memory
        /// </code>
        /// <code>
        /// // Create a document using a relative filename.
        /// using (var document = DocX.Create(@"..\Test.docx"))
        /// {
        ///     // Do something with the document here.
        ///
        ///     // Save all changes made to this document.
        ///     document.Save();
        /// }// Release this document from memory
        /// </code>
        /// <seealso cref="DocX.Load(System.IO.Stream)"/>
        /// <seealso cref="DocX.Load(string)"/>
        /// <seealso cref="DocX.Save()"/>
        /// </example>
        public static DocX Create(string filename, DocumentTypes documentType = DocumentTypes.Document)
        {
            var docX = new DocX(null, null) as Xceed.Document.NET.Document;

            Xceed.Document.NET.Document.PrepareDocument(ref docX, documentType);
            docX._filename = filename;
            return(docX as DocX);
        }
示例#16
0
        /// <summary>
        /// Creates a document using a Stream.
        /// </summary>
        /// <param name="stream">The Stream to create the document from.</param>
        /// <param name="documentType"></param>
        /// <returns>Returns a Document object which represents the document.</returns>
        /// <example>
        /// Creating a document from a FileStream.
        /// <code>
        /// // Use a FileStream fs to create a new document.
        /// using(FileStream fs = new FileStream(@"C:\Example\Test.docx", FileMode.Create))
        /// {
        ///     // Load the document using fs
        ///     using (var document = DocX.Create(fs))
        ///     {
        ///         // Do something with the document here.
        ///
        ///         // Save all changes made to this document.
        ///         document.Save();
        ///     }// Release this document from memory.
        /// }
        /// </code>
        /// </example>
        /// <example>
        /// Creating a document in a SharePoint site.
        /// <code>
        /// using(SPSite mySite = new SPSite("http://server/sites/site"))
        /// {
        ///     // Open a connection to the SharePoint site
        ///     using(SPWeb myWeb = mySite.OpenWeb())
        ///     {
        ///         // Create a MemoryStream ms.
        ///         using (MemoryStream ms = new MemoryStream())
        ///         {
        ///             // Create a document using ms.
        ///             using (var document = DocX.Create(ms))
        ///             {
        ///                 // Do something with the document here.
        ///
        ///                 // Save all changes made to this document.
        ///                 document.Save();
        ///             }// Release this document from memory
        ///
        ///             // Add the document to the SharePoint site
        ///             web.Files.Add("filename", ms.ToArray(), true);
        ///         }
        ///     }
        /// }
        /// </code>
        /// </example>
        /// <seealso cref="DocX.Load(System.IO.Stream)"/>
        /// <seealso cref="DocX.Load(string)"/>
        /// <seealso cref="DocX.Save()"/>
        public static DocX Create(Stream stream, DocumentTypes documentType = DocumentTypes.Document)
        {
            var docX = new DocX(null, null) as Xceed.Document.NET.Document;

            Xceed.Document.NET.Document.PrepareDocument(ref docX, documentType);
            docX._stream = stream;
            return(docX as DocX);
        }
示例#17
0
        public DocumentTypes Import(DocumentTypes documentTypes)
        {
            var user = UmbracoContext.Current.Security.CurrentUser;

            EnumerateDocumentTypes(documentTypes.Items, -1, user.Id);

            return(documentTypes);
        }
示例#18
0
    public string getDocumentTypes()
    {
        JavaScriptSerializer j  = new JavaScriptSerializer();
        DocumentTypes        dt = new DocumentTypes();
        List <DocumentTypes> documentsTypesList = dt.getDocumentTypesList();

        return(j.Serialize(documentsTypesList));
    }
 private void RefreshData()
 {
     Customers      = DBHelper.Instance.GetCustomers();
     AllFolderNames = DocumentFolder.GetAllFolderNames();
     FileTypes      = LookupItem.GetLookupStrings(LookupItem.LookupTypesEnum.FileType);
     FileTypes.Insert(0, string.Empty);
     DocumentTypes = LookupItem.GetLookupStrings(LookupItem.LookupTypesEnum.DocumentType);
     DocumentTypes.Insert(0, string.Empty);
 }
示例#20
0
        public void SetDocumentTypes(bool isDigital)
        {
            Document.IsDigital = isDigital;

            var settings = GetInstance <ISettingsRepository <MiscellaneousSettings> >().GetMiscellaneousSettings();

            DocumentTypes         = DocumentType.GetDocumentTypes(isDigital);
            Document.DocumentType = Document.DocumentType ?? DocumentTypes.FirstOrDefault(c => string.Equals(c, isDigital ? settings.DefaultDigitalDocumentType : settings.DefaultAnalogueDocumentType));
        }
 private void UpdateTemplates()
 {
     DocumentTypes.Clear();
     if (SelectedAccount != null)
     {
         var templates = _applicationState.GetAccountTransactionDocumentTypes(SelectedAccount.AccountTypeId)
                         .Where(x => !string.IsNullOrEmpty(x.ButtonHeader) && x.CanMakeAccountTransaction(SelectedAccount));
         DocumentTypes.AddRange(templates.Select(x => new DocumentTypeButtonViewModel(x, SelectedAccount)));
     }
 }
        protected override void Execute(CodeActivityContext context)
        {
            string   text         = DocumentText.Get(context);
            Document document     = DocumentObjectModel.Get(context);
            string   documentPath = DocumentPath.Get(context);

            ClassifierDocumentType[] documentTypes = DocumentTypes.Get(context);
            int evidencePage = EvidencePage.Get(context);

            ClassifierResult.Set(context, ComputeResult(text, document, documentPath, documentTypes, evidencePage));
        }
示例#23
0
        public async static Task <object> Generate(DateTime datefrom, DateTime dateto)
        {
            EntityModel employeeModel = await MetadataToModelConverter.GetEntityModelByModelAsync("Employee", 0);

            EntityModel businessTripModel = await MetadataToModelConverter.GetEntityModelByModelAsync(DocumentTypes.BusinessTrip);

            EntityModel sickLeaveModel = await MetadataToModelConverter.GetEntityModelByModelAsync(DocumentTypes.SickLeave);

            EntityModel vacationModel = await MetadataToModelConverter.GetEntityModelByModelAsync(DocumentTypes.Vacation);

            var filter = Filter.And.In(WorkflowReport.FinalStates, "State").Merge(
                Filter.And.LessOrEqual(dateto, "DateStart").GreaterOrEqual(datefrom, "DateEnd"));

            var employees = await employeeModel.GetAsync(Filter.Empty);

            var businessTripFilter = DocumentTypes.GetFilter(DocumentTypes.BusinessTrip)
                                     .Merge(filter)
                                     .Merge(Document.GetViewFilterForCurrentUser(businessTripModel));
            var businessTrips = await businessTripModel.GetAsync(businessTripFilter);

            businessTrips.ForEach((item) =>
            {
                var i = (dynamic)item;
                if (!string.IsNullOrEmpty(i.Employees))
                {
                    i.EmployeesList = JsonConvert.DeserializeObject <List <Guid> >(i.Employees);
                    var names       = new List <string>();
                    foreach (Guid empId in i.EmployeesList)
                    {
                        var emp = employees.Select(c => c as dynamic).Where(c => c.Id == empId).FirstOrDefault();
                        names.Add(emp?.Name);
                    }
                    i.EmployeesNames = names.OrderBy(c => c).ToList();
                }
            });

            var sickLeaveFilter = DocumentTypes.GetFilter(DocumentTypes.SickLeave)
                                  .Merge(filter)
                                  .Merge(Document.GetViewFilterForCurrentUser(sickLeaveModel));

            var sickLeaves = await sickLeaveModel.GetAsync(sickLeaveFilter);

            var vacationFilter = DocumentTypes.GetFilter(DocumentTypes.Vacation)
                                 .Merge(filter)
                                 .Merge(Document.GetViewFilterForCurrentUser(vacationModel));
            var vacations = await vacationModel.GetAsync(vacationFilter);

            var res = new List <WorkCalendarEvent>();

            res.AddRange(businessTrips.Select(c => new WorkCalendarEvent(c, "businesstrip", "Business Trip")));
            res.AddRange(sickLeaves.Select(c => new WorkCalendarEvent(c, "sickleave", "Sick Leave")));
            res.AddRange(vacations.Select(c => new WorkCalendarEvent(c, "vacation", "Vacation")));
            return(res);
        }
示例#24
0
 private void OpenForm(DocumentTypes type, Guid id, int pageNumber = 0)
 {
     if (type == DocumentTypes.Settings && pageNumber >= 0)
     {
         FormManager.Instance.OpenSettingsChildForm(pageNumber);
     }
     else
     {
         FormManager.Instance.OpenChildForm(type, id);
     }
 }
示例#25
0
        public async ValueTask <bool> UpdateDocumentTypesAsync(DocumentTypes documentType)
        {
            try
            {
                var stringContent = new StringContent(JsonConvert.SerializeObject(documentType), encoding: Encoding.UTF8, "application/json");
                var response      = await client.PostAsync($"{WebApiHost}/api/bd/UpdateDocumentType", stringContent);

                return(response.IsSuccessStatusCode);
            }
            catch (Exception) { return(false); }
        }
示例#26
0
        public GeneralLedgerHeader CreateGeneralLedgerHeader(DocumentTypes documentType, DateTime date, string description)
        {
            var entry = new GeneralLedgerHeader()
            {
                DocumentType = documentType,
                Date         = date,
                Description  = description,
            };

            return(entry);
        }
示例#27
0
        /// <summary>
        /// Add/Update document type
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> AddDocumentType(int id)
        {
            var documentType = await _masterService.GetDocumentTypeById(id);

            if (documentType == null)
            {
                documentType = new DocumentTypes();
            }

            return(PartialView("_DocumentTypeWizard", documentType));
        }
示例#28
0
 public void ReloadDocuments()
 {
     DocumentTypes.Clear();
     foreach (var document in documentTypes)
     {
         DocumentTypes.Add(new DocumentTypeItemViewModel
         {
             Description    = document.Description,
             DocumentTypeId = document.DocumentTypeId,
         });
     }
 }
示例#29
0
 public Documents(int documentID, string documentName, float totalPrice, string comments, string containerID, DateTime date, DocumentTypes docType, Drivers sendBy, Orders relatedOrder, int imgID)
 {
     DocumentID   = documentID;
     DocumentName = documentName;
     TotalPrice   = totalPrice;
     Comments     = comments;
     ContainerID  = containerID;
     Date         = date;
     DocType      = docType;
     SendBy       = sendBy;
     RelatedOrder = relatedOrder;
     ImgID        = imgID;
 }
示例#30
0
 public DocumentModel(DocumentType type)
     : this()
 {
     if (type == DocumentType.New)
     {
         this.DocumentTypeID = Constants.RussianFederationPassportDocumentId;
     }
     if (type == DocumentType.NewForeign || type == DocumentType.OldForeign)
     {
         DocumentTypes.RemoveAll(item => item.Value != string.Empty && item.Value != "11" && item.Value != "23");
     }
     this.DocumentType = type;
 }
		/// <summary>
		/// Gets the first importer that match the parameter criteria.
		/// </summary>
		/// <param name="documentType">Type of the document.</param>
		/// <param name="loadPath">The save path.</param>
		/// <returns></returns>
		public IImporter GetFirstImporter(DocumentTypes documentType, string loadPath)
		{
			string targetExtension			= ExportHandler.GetExtension(loadPath);

			foreach(IImporter iImporter in this.LoadImporter())
			{
				foreach(DocumentSupportInfo documentSupportInfo in iImporter.DocumentSupportInfos)
					if (documentSupportInfo.Extension.ToLower().Equals(targetExtension.ToLower()))
						if (documentSupportInfo.DocumentType == documentType)
							return iImporter;
			}

			throw new AODLException("No importer available for type "+documentType.ToString()+" and extension "+targetExtension);
		}
示例#32
0
 public GeneralLedgerHeader CreateGeneralLedgerHeader(DocumentTypes documentType, DateTime date, string description)
 {
     var entry = new GeneralLedgerHeader()
     {
         DocumentType = documentType,
         Date = date,
         Description = description,
         CreatedBy = Thread.CurrentPrincipal.Identity.Name,
         CreatedOn = DateTime.Now,
         ModifiedBy = Thread.CurrentPrincipal.Identity.Name,
         ModifiedOn = DateTime.Now
     };
     return entry;
 }
示例#33
0
        /// <summary>
        /// Gets the first exporter that match the parameter criteria.
        /// </summary>
        /// <param name="documentType">Type of the document.</param>
        /// <param name="savePath">The save path.</param>
        /// <returns></returns>
        public IExporter GetFirstExporter(DocumentTypes documentType, string savePath)
        {
            string targetExtension			= GetExtension(savePath);

            foreach(IExporter iExporter in this.LoadExporter())
            {
                foreach(DocumentSupportInfo documentSupportInfo in iExporter.DocumentSupportInfos)
                    if(documentSupportInfo.Extension.ToLower().Equals(targetExtension.ToLower()))
                        if(documentSupportInfo.DocumentType == documentType)
                            return iExporter;
            }

            AODLException exception		= new AODLException("No exporter available for type "+documentType.ToString()+" and extension "+targetExtension);
            exception.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
            throw exception;
        }
        public string UploadFile(byte[] fileBytes, DocumentTypes type, string extention)
        {
            string folder = Path.GetFullPath(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "/DocumentStore/" + type.ToString());
            string fileName = System.Guid.NewGuid().ToString() + "." + extention;
            log.Debug("file " + fileName + " intends to save at " + folder);

            if (!Directory.Exists(folder))
                Directory.CreateDirectory(folder);

            using (MemoryStream mstream = new MemoryStream(fileBytes))
                using (FileStream fstream = new FileStream(folder + "/" + fileName, FileMode.Create))
                    mstream.WriteTo(fstream);

            log.Info("file " + fileName + " saved successfully");
            return fileName;
        }
示例#35
0
        public InventoryControlJournal CreateInventoryControlJournal(int itemId, int measurementId, DocumentTypes documentType, decimal? inQty, decimal? outQty, decimal? totalCost, decimal? totalAmount)
        {
            if (!inQty.HasValue && !outQty.HasValue)
                throw new MissingFieldException();

            var icj = new InventoryControlJournal()
            {
                ItemId = itemId,
                MeasurementId = measurementId,
                DocumentType = documentType,
                Date = DateTime.Now,
                INQty = inQty,
                OUTQty = outQty,
                TotalCost = totalCost,
                TotalAmount = totalAmount,
            };
            return icj;
        }
        public DocumentTypes GetDocumentTypes()
        {
            var documentTypes = new DocumentTypes();
            using (var app = OBConnection(ServiceUrl, DataSource, UserName, Password))
            {
                foreach (var udtg in app.Core.DocumentTypeGroups)
                {
                    var dtg = new DocumentType(udtg.ID, udtg.Name);
                    documentTypes.Add(dtg);

                    if (udtg.DocumentTypes != null)
                    {
                        foreach (var udt in udtg.DocumentTypes)
                        {
                            if (dtg.DocumentTypes == null)
                                dtg.DocumentTypes = new DocumentTypes();

                            dtg.DocumentTypes.Add(new DocumentType(udt.ID, udt.Name));
                        }
                    }
                }
            }
            return documentTypes;
        }
示例#37
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="doctypeId"></param>
        /// <returns></returns>
        internal DocumentTypes getDocumentTypeById(string doctypeId)
        {
            string sql = "select * from DOCUMENT_TYPES where DOC_TYPE_ID = :i";
            var data = db.Database.SqlQuery<DocumentTypes>(sql,
                         new OracleParameter(":n", doctypeId));
            DocumentTypes dt = new DocumentTypes();
            foreach (DocumentTypes x in data)
            {
                dt = x;
            }

            return dt;
        }
 public DocumentType(long id, string name, DocumentTypes documentTypes)
     : base(id, name)
 {
     DocumentTypes = documentTypes;
 }
示例#39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        internal int updateDocumentType(DocumentTypes dt)
        {
            string sql = "update DOCUMENT_TYPES set name=:n, description=:d, FOR_MIDN_USE='T'  where DOC_TYPE_ID="+dt.doc_type_id ;
            var data = db.Database.ExecuteSqlCommand(sql,
                new OracleParameter(":n", dt.name.Trim()),
                new OracleParameter(":d", dt.description.Trim()));

            return data;
        }
示例#40
0
        /// <summary>
        /// Get document by type
        /// </summary>
        /// <param name="documentType"></param>
        /// <returns></returns>
        public Document GetDocumentByType(DocumentTypes documentType)
        {
            getDocumentByType getDocumentByType = new getDocumentByType()
            {
                type = documentType.ToString(),
                service = _Scenario.Service,
                transactionId = TransactionId
            };

            getDocumentByTypeResponse getDocumentByTypeResponse = _DocumentPortCli.getDocumentByType(getDocumentByType);
            Document doc = getDocumentByTypeResponse.document;

            return doc;
        }
示例#41
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        internal int addDocumentType(DocumentTypes dt)
        {
            string sql = "insert   into DOCUMENT_TYPES (name,description,FOR_MIDN_USE) values (:n,:d,'T') ";
            var data = db.Database.ExecuteSqlCommand(sql,
                new OracleParameter(":n", dt.name),
                new OracleParameter(":d", dt.description));

            return data;
        }
示例#42
0
文件: DocX.cs 项目: EnergonV/BestCS
        internal static void PostCreation(Package package, DocumentTypes documentType = DocumentTypes.Document)
        {
            XDocument mainDoc, stylesDoc, numberingDoc;

            #region MainDocumentPart
            // Create the main document part for this package
            PackagePart mainDocumentPart;
            if (documentType == DocumentTypes.Document)
            {
                mainDocumentPart = package.CreatePart(new Uri("/word/document.xml", UriKind.Relative), "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml");
            }
            else
            {
                mainDocumentPart = package.CreatePart(new Uri("/word/document.xml", UriKind.Relative), "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml");
            }
            package.CreateRelationship(mainDocumentPart.Uri, TargetMode.Internal, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument");

            // Load the document part into a XDocument object
            using (TextReader tr = new StreamReader(mainDocumentPart.GetStream(FileMode.Create, FileAccess.ReadWrite)))
            {
                mainDoc = XDocument.Parse
                (@"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>
                   <w:document xmlns:ve=""http://schemas.openxmlformats.org/markup-compatibility/2006"" xmlns:o=""urn:schemas-microsoft-com:office:office"" xmlns:r=""http://schemas.openxmlformats.org/officeDocument/2006/relationships"" xmlns:m=""http://schemas.openxmlformats.org/officeDocument/2006/math"" xmlns:v=""urn:schemas-microsoft-com:vml"" xmlns:wp=""http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"" xmlns:w10=""urn:schemas-microsoft-com:office:word"" xmlns:w=""http://schemas.openxmlformats.org/wordprocessingml/2006/main"" xmlns:wne=""http://schemas.microsoft.com/office/word/2006/wordml"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main"" xmlns:c=""http://schemas.openxmlformats.org/drawingml/2006/chart"">
                   <w:body>
                    <w:sectPr w:rsidR=""003E25F4"" w:rsidSect=""00FC3028"">
                        <w:pgSz w:w=""11906"" w:h=""16838""/>
                        <w:pgMar w:top=""1440"" w:right=""1440"" w:bottom=""1440"" w:left=""1440"" w:header=""708"" w:footer=""708"" w:gutter=""0""/>
                        <w:cols w:space=""708""/>
                        <w:docGrid w:linePitch=""360""/>
                    </w:sectPr>
                   </w:body>
                   </w:document>"
                );
            }

            // Save the main document
            using (TextWriter tw = new StreamWriter(mainDocumentPart.GetStream(FileMode.Create, FileAccess.Write)))
                mainDoc.Save(tw, SaveOptions.None);
            #endregion

            #region StylePart
            stylesDoc = HelperFunctions.AddDefaultStylesXml(package);
            #endregion

            #region NumberingPart
            numberingDoc = HelperFunctions.AddDefaultNumberingXml(package);
            #endregion

            package.Close();
        }
示例#43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentSupportInfo"/> class.
 /// </summary>
 /// <param name="extension">The extension.</param>
 /// <param name="documentTyp">The document typ.</param>
 public DocumentSupportInfo(string extension, DocumentTypes documentTyp)
 {
     this.Extension			= extension;
     this.DocumentType		= documentTyp;
 }
示例#44
0
 /// <summary>
 /// Get document by type
 /// </summary>
 /// <param name="documentType"></param>
 /// <returns></returns>
 public Document GetDocumentByType(DocumentTypes documentType)
 {
     return GetDocumentByType(documentType.ToString());
 }
示例#45
0
 public GeneralLedgerHeader CreateGeneralLedgerHeader(DocumentTypes documentType, DateTime date, string description)
 {
     var entry = new GeneralLedgerHeader()
     {
         DocumentType = documentType,
         Date = date,
         Description = description,
     };
     return entry;
 }
示例#46
0
文件: DocX.cs 项目: EnergonV/BestCS
        /// <summary>
        /// Creates a document using a Stream.
        /// </summary>
        /// <param name="stream">The Stream to create the document from.</param>
        /// <returns>Returns a DocX object which represents the document.</returns>
        /// <example>
        /// Creating a document from a FileStream.
        /// <code>
        /// // Use a FileStream fs to create a new document.
        /// using(FileStream fs = new FileStream(@"C:\Example\Test.docx", FileMode.Create))
        /// {
        ///     // Load the document using fs
        ///     using (DocX document = DocX.Create(fs))
        ///     {
        ///         // Do something with the document here.
        ///
        ///         // Save all changes made to this document.
        ///         document.Save();
        ///     }// Release this document from memory.
        /// }
        /// </code>
        /// </example>
        /// <example>
        /// Creating a document in a SharePoint site.
        /// <code>
        /// using(SPSite mySite = new SPSite("http://server/sites/site"))
        /// {
        ///     // Open a connection to the SharePoint site
        ///     using(SPWeb myWeb = mySite.OpenWeb())
        ///     {
        ///         // Create a MemoryStream ms.
        ///         using (MemoryStream ms = new MemoryStream())
        ///         {
        ///             // Create a document using ms.
        ///             using (DocX document = DocX.Create(ms))
        ///             {
        ///                 // Do something with the document here.
        ///
        ///                 // Save all changes made to this document.
        ///                 document.Save();
        ///             }// Release this document from memory
        ///
        ///             // Add the document to the SharePoint site
        ///             web.Files.Add("filename", ms.ToArray(), true);
        ///         }
        ///     }
        /// }
        /// </code>
        /// </example>
        /// <seealso cref="DocX.Create(string)"/>
        /// <seealso cref="DocX.Load(System.IO.Stream)"/>
        /// <seealso cref="DocX.Load(string)"/>
        /// <seealso cref="DocX.Save()"/>
        public static DocX Create(Stream stream, DocumentTypes documentType = DocumentTypes.Document)
        {
            // Store this document in memory
            MemoryStream ms = new MemoryStream();

            // Create the docx package
            Package package = Package.Open(ms, FileMode.Create, FileAccess.ReadWrite);

            PostCreation(package, documentType);
            DocX document = DocX.Load(ms);
            document.stream = stream;
            return document;
        }
示例#47
0
 private void OpenForm(DocumentTypes type, Guid id, int pageNumber =0) 
 {
     if (type == DocumentTypes.Settings && pageNumber >= 0)
     {
         FormManager.Instance.OpenSettingsChildForm(pageNumber);
     }
     else
     {
         FormManager.Instance.OpenChildForm(type, id);
     }
 }
示例#48
0
文件: DocX.cs 项目: EnergonV/BestCS
        /// <summary>
        /// Creates a document using a fully qualified or relative filename.
        /// </summary>
        /// <param name="filename">The fully qualified or relative filename.</param>
        /// <returns>Returns a DocX object which represents the document.</returns>
        /// <example>
        /// <code>
        /// // Create a document using a relative filename.
        /// using (DocX document = DocX.Create(@"..\Test.docx"))
        /// {
        ///     // Do something with the document here.
        ///
        ///     // Save all changes made to this document.
        ///     document.Save();
        /// }// Release this document from memory
        /// </code>
        /// <code>
        /// // Create a document using a relative filename.
        /// using (DocX document = DocX.Create(@"..\Test.docx"))
        /// {
        ///     // Do something with the document here.
        ///
        ///     // Save all changes made to this document.
        ///     document.Save();
        /// }// Release this document from memory
        /// </code>
        /// <seealso cref="DocX.Create(System.IO.Stream)"/>
        /// <seealso cref="DocX.Load(System.IO.Stream)"/>
        /// <seealso cref="DocX.Load(string)"/>
        /// <seealso cref="DocX.Save()"/>
        /// </example>
        public static DocX Create(string filename, DocumentTypes documentType = DocumentTypes.Document)
        {
            // Store this document in memory
            MemoryStream ms = new MemoryStream();

            // Create the docx package
            //WordprocessingDocument wdDoc = WordprocessingDocument.Create(ms, DocumentFormat.OpenXml.WordprocessingDocumentType.Document);
            Package package = Package.Open(ms, FileMode.Create, FileAccess.ReadWrite);

            PostCreation(package, documentType);
            DocX document = DocX.Load(ms);
            document.filename = filename;
            return document;
        }