/// <summary> /// Creates a new document from a Stream of HTML using the options passed. /// </summary> /// /// <param name="html"> /// The HTML input. /// </param> /// <param name="parsingMode"> /// (optional) the parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> /// /// <returns> /// A new document. /// </returns> public static IDomDocument Create(TextReader html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) { return GetNewParser(parsingMode, parsingOptions, docType).Parse(html); }
private static ElementFactory GetNewParser(HtmlParsingMode parsingMode, HtmlParsingOptions parsingOptions, DocType docType) { var parser = new ElementFactory(); parser.HtmlParsingMode = parsingMode; parser.DocType = GetDocType(docType); parser.HtmlParsingOptions = MergeOptions(parsingOptions); return parser; }
/// <summary> /// Get an individual document for editing /// </summary> public void Document(int id, DocType type) { JObject record = document(id, type); // implemented in base class record["detail"] = Database.Query("idJournal, DocumentId, ProductId, Line.VatCodeId, VatRate, JournalNum, Journal.AccountId, Memo, UnitPrice, Qty, LineAmount, VatAmount, Unit", "WHERE Journal.DocumentId = " + id + " AND idLine IS NOT NULL ORDER BY JournalNum", "Document", "Journal", "Line"); record.Add("Products", new Select().Product("")); Record = record; }
public DocumentStruct(string title, User user, string ID, string path, bool modified, bool deleted) { id = ID; fileType = DocType.Document; this.title = title; this.path = path; this.modified = modified; this.deleted = deleted; }
/// <summary> /// Creates a new DomDocument (or derived) object. /// </summary> /// /// <param name="html"> /// The HTML source for the document. /// </param> /// <param name="encoding"> /// (optional) the character set encoding. /// </param> /// <param name="parsingMode"> /// (optional) the HTML parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// The DocType for this document. /// </param> /// /// <returns> /// A new IDomDocument object. /// </returns> public static IDomDocument Create(Stream html, Encoding encoding = null, HtmlParsingMode parsingMode = HtmlParsingMode.Content, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) { return ElementFactory.Create(html, encoding, parsingMode, parsingOptions, docType); }
/// <summary> /// Create a new CQ object from an HTML stream. /// <see cref="CQ.Create(char[])"/> /// </summary> /// /// <param name="html"> /// The html source of the new document. /// </param> /// <param name="encoding"> /// The character set encoding. /// </param> /// <param name="parsingMode"> /// The HTML parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> public CQ(Stream html, Encoding encoding, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions =HtmlParsingOptions.Default, DocType docType = DocType.Default) { CreateNew(this, html, encoding, parsingMode, parsingOptions, docType); }
/// <summary> /// Create a new CQ object from an HTML stream. /// <see cref="CQ.Create(char[])"/> /// </summary> /// /// <param name="html"> /// The html source of the new document. /// </param> /// <param name="parsingMode"> /// The HTML parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> public CQ(Stream html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions =HtmlParsingOptions.Default, DocType docType = DocType.Default) { using (var reader = new StreamReader(html)) { CreateNew(this, reader, parsingMode, parsingOptions, docType); } }
/// <summary> /// Creates a new document from a Stream of HTML using the options passed. /// </summary> /// /// <param name="html"> /// The HTML input. /// </param> /// <param name="streamEncoding"> /// The character set encoding used by the stream. If null, the BOM will be inspected, and it /// will default to UTF8 if no encoding can be identified. /// </param> /// <param name="parsingMode"> /// (optional) the parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> /// /// <returns> /// A new document. /// </returns> public static IDomDocument Create(Stream html, Encoding streamEncoding, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) { return GetNewParser(parsingMode, parsingOptions, docType) .Parse(html, streamEncoding); }
/// <summary> /// Create a new CQ object from an HTML string. /// </summary> /// /// <param name="html"> /// The HTML source. /// </param> /// <param name="parsingMode"> /// The HTML parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> public CQ(string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions=HtmlParsingOptions.Default, DocType docType = DocType.Default) { var encoding = new UTF8Encoding(false); using (var stream = Support.GetEncodedStream(html ?? "", encoding)) { CreateNew(this, stream, encoding, parsingMode, parsingOptions, docType); } }
public DocumentManager(DocType docType) { this.docType = docType; switch (docType) { case DocType.excel: document = new ExcelWorker(); break; default: break; } }
/// <summary> /// Creates a new DomDocument (or derived) object /// </summary> /// /// <param name="html"> /// The HTML source for the document /// </param> /// <param name="parsingMode"> /// (optional) the parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// The DocType for this document. /// </param> /// /// <returns> /// A new IDomDocument object /// </returns> public static IDomDocument Create(string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) { var encoding = Encoding.UTF8; using (var stream = new MemoryStream(encoding.GetBytes(html))) { return ElementFactory.Create(stream, encoding, parsingMode, parsingOptions, docType); } }
/// <summary> /// Create a new CQ object from an HTML string. /// </summary> /// /// <param name="html"> /// The HTML source. /// </param> /// <param name="parsingMode"> /// The HTML parsing mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> public CQ(string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions=HtmlParsingOptions.Default, DocType docType = DocType.Default) { //CreateNew(this, html, parsingMode,parsingOptions, docType); using (var reader = new StringReader(html ?? "")) { CreateNew(this,reader, parsingMode, parsingOptions, docType); } }
/// <summary> /// Get a document for editing /// </summary> public void Document(int id, DocType type) { Title = Title.Replace("Document", type.UnCamel()); JObject record = GetDocument(id, type); dynamic header = ((dynamic)record).header; Database.NextPreviousDocument(record, "JOIN Journal ON DocumentId = idDocument WHERE DocumentTypeId = " + (int)type + (header.DocumentAccountId > 0 ? " AND AccountId = " + header.DocumentAccountId : "")); Select s = new Select(); record.AddRange("Accounts", s.Account(""), "VatCodes", s.VatCode(""), "Names", s.Other("")); Record = record; }
public Ast(DocType doctype, /*Language language,*/ Tag root) { if (!Enum.IsDefined(typeof(DocType), doctype)) throw new ArgumentOutOfRangeException("doctype"); //if (!Enum.IsDefined(typeof(Language), language)) // throw new ArgumentOutOfRangeException("language"); if (root == null) throw new ArgumentNullException("tags"); DocType = doctype; //Language = language; Root = root; }
/// <summary> /// Creates a new fragment in a given context. /// </summary> /// /// <param name="html"> /// The elements. /// </param> /// <param name="context"> /// (optional) the context. If omitted, will be automatically determined. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> /// /// <returns> /// A new fragment. /// </returns> public static IDomDocument Create(string html, string context=null, DocType docType = DocType.Default) { var factory = new ElementFactory(); factory.FragmentContext = context; factory.HtmlParsingMode = HtmlParsingMode.Fragment; factory.HtmlParsingOptions = HtmlParsingOptions.AllowSelfClosingTags; factory.DocType = docType; using (var reader = new StringReader(html)) { return factory.Parse(new StringReader(html)); } }
/// <summary> /// Creates a new fragment in a given context. /// </summary> /// /// <param name="html"> /// The elements. /// </param> /// <param name="context"> /// (optional) the context. If omitted, will be automatically determined. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> /// /// <returns> /// A new fragment. /// </returns> public static IDomDocument Create(string html, string context=null, DocType docType = DocType.Default) { var factory = new ElementFactory(); factory.FragmentContext = context; factory.HtmlParsingMode = HtmlParsingMode.Fragment; factory.HtmlParsingOptions = HtmlParsingOptions.AllowSelfClosingTags; factory.DocType = docType; Encoding encoding = Encoding.UTF8; using (var stream = new MemoryStream(encoding.GetBytes(html))) { return factory.Parse(stream, encoding); } }
public IHttpActionResult PostDocTyp(int id, DocType model) { var context = unitOfWork.DbContext.Set<DocType>(); var entitiy = context.Single(e => e.DocTypeId == id); entitiy.Name = model.Name; entitiy.IsActive = model.IsActive; entitiy.PrimaryRegisterIndexId = model.PrimaryRegisterIndexId; entitiy.DocTypeGroupId = model.DocTypeGroupId; entitiy.ExecutionDeadline = model.ExecutionDeadline; entitiy.RemoveIrregularitiesDeadline = model.RemoveIrregularitiesDeadline; unitOfWork.Save(); return Ok(); }
public CustomerSupplier(string nameType, Acct ledgerAccount, DocType invoiceDoc, DocType creditDoc, DocType paymentDoc) { NameType = nameType; Name = NameType.NameType(); LedgerAccount = ledgerAccount; InvoiceDoc = invoiceDoc; CreditDoc = creditDoc; PaymentDoc = paymentDoc; string module = nameType == "C" ? "/customer/" : "/supplier/"; Menu = new MenuOption[] { new MenuOption("Listing", module + "default.html"), new MenuOption("VAT codes", module + "vatcodes.html"), new MenuOption("New " + Name, module + "detail.html?id=0"), new MenuOption("New " + InvoiceDoc.UnCamel(), module + "document.html?id=0&type=" + (int)InvoiceDoc), new MenuOption("New " + CreditDoc.UnCamel(), module + "document.html?id=0&type=" + (int)CreditDoc), new MenuOption("New " + PaymentDoc.UnCamel(), module + "payment.html?id=0") }; }
/// <summary> /// To start the presentation /// </summary> /// <param name="fileName"></param> public static void StartPresentation(String fileName) { try { if (!DocumentPresentation.HelperMethods.HasPresentationStarted()) { //Set focus for the Floor window RippleCommonUtilities.HelperMethods.ClickOnFloorToGetFocus(); //Set focus for screen window also Utilities.Helper.ClickOnScreenToGetFocus(); //Find document type g_doctype = GetDocumentType(fileName); switch (g_doctype) { case DocType.PPT: g_documentClass = new PPTDocumentClass(fileName); break; } if (g_documentClass == null) return; g_documentClass.StartPresentation(); g_documentClass.SetApplicationStatus(true); //Speak out myBackgroundWorker = new BackgroundWorker(); myBackgroundWorker.DoWork += myBackgroundWorkerForSpeech_DoWork; myBackgroundWorker.RunWorkerAsync(); //Set focus for screen window also //Utilities.Helper.ClickOnScreenToGetFocus(); } } catch (Exception ex) { //Do nothing RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in StartPresentation for Screen {0}", ex.Message); } }
public string ExpandAbbreviation(string abbreviation, DocType docType, out int relativeInsertionPoint) { return ProcessInsertPoint(ExpandAbbreviation(abbreviation, docType), out relativeInsertionPoint); }
/// <summary> /// Constructor to create based on one of several common predefined types. /// </summary> /// /// <param name="docType"> /// Type of the document. /// </param> public DomDocumentType(DocType docType) : base() { SetDocType(docType); }
private void SaveInvio(string FileName, DocType TipoDoc) { S_ControlsCollection _SColl = new S_ControlsCollection(); S_Object p = new S_Object(); p.ParameterName = "p_id"; p.DbType = CustomDBType.Integer; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Value = 0; _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_NOME_DOC"; p.DbType = CustomDBType.VarChar; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Size = 255; p.Value = Path.GetFileName(FileName); _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_DATA_INVIO"; p.DbType = CustomDBType.Date; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Size = 15; p.Value = DateTime.Now; _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_USERS"; p.DbType = CustomDBType.VarChar; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Size = 255; p.Value = Context.User.Identity.Name; _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_TIPO_DOC"; p.DbType = CustomDBType.VarChar; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Size = 32; p.Value = TipoDoc.ToString(); _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_CODICE"; p.DbType = CustomDBType.VarChar; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Size = 255; p.Value = this.HSga.ToString(); _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_ID_WR"; p.DbType = CustomDBType.Integer; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Value = this.txtWrHidden.Text; _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_ID_BL"; p.DbType = CustomDBType.Integer; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Value = this.id_bl; _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_CODICE_BL"; p.DbType = CustomDBType.VarChar; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Size = 255; p.Value = lblCodiceEdificio.Text; _SColl.Add(p); p = new S_Object(); p.ParameterName = "p_Operazione"; p.DbType = CustomDBType.VarChar; p.Direction = ParameterDirection.Input; p.Index = _SColl.Count; p.Size = 255; p.Value = "Insert"; _SColl.Add(p); int result = _ClManCorrettiva.ExecuteTracciaDoc(_SColl); }
private static DocType GetDocType(DocType docType) { return docType == DocType.Default ? Config.DocType : docType; }
private void SetUpVariables() { _manCo1 = new ManCo { Id = 1 }; _manCo2 = new ManCo { Id = 2 }; _manCo3 = new ManCo { Id = 3 }; this._manCos = new List <ManCo>(); this._manCos.Add(_manCo1); this._manCos.Add(_manCo2); this._manCos.Add(_manCo3); _docType1 = new DocType { Id = 1, Code = "Code1" }; _docType2 = new DocType { Id = 2, Code = "Code2" }; _docType3 = new DocType { Id = 3, Code = "Code3" }; this._docTypes = new List <DocType>(); this._docTypes.Add(_docType1); this._docTypes.Add(_docType2); this._docTypes.Add(_docType3); this._subDocType1 = new SubDocType { Id = 1, DocType = _docType1, Code = "SubCode1" }; this._subDocType2 = new SubDocType { Id = 2, DocType = _docType1, Code = "subCode2" }; this._subDocType3 = new SubDocType { Id = 3, DocType = _docType1, Code = "SubCode3" }; this._subDocType4 = new SubDocType { Id = 4, DocType = _docType2, Code = "SubCode4" }; this._subDocType5 = new SubDocType { Id = 5, DocType = _docType2, Code = "SubCode5" }; this._subDocType6 = new SubDocType { Id = 6, DocType = _docType3, Code = "SubCode6" }; this._subDocType7 = new SubDocType { Id = 7, DocType = _docType3, Code = "SubCode7" }; this._subDocType8 = new SubDocType { Id = 8, DocType = _docType3, Code = "SubCode8" }; this._subDocTypes = new List <SubDocType>(); this._subDocTypes.Add(_subDocType1); this._subDocTypes.Add(_subDocType2); this._subDocTypes.Add(_subDocType3); this._subDocTypes.Add(_subDocType4); this._subDocTypes.Add(_subDocType5); this._subDocTypes.Add(_subDocType6); this._subDocTypes.Add(_subDocType7); this._subDocTypes.Add(_subDocType8); this._approval1 = new AutoApproval { Id = 1, DocType = _docType1, SubDocType = _subDocType1, Manco = _manCo1 }; this._approval2 = new AutoApproval { Id = 2, DocType = _docType1, SubDocType = _subDocType2, Manco = _manCo1 }; this._approval3 = new AutoApproval { Id = 3, DocType = _docType1, SubDocType = _subDocType3, Manco = _manCo1 }; this._approval4 = new AutoApproval { Id = 4, DocType = _docType2, SubDocType = _subDocType4, Manco = _manCo1 }; this._approval5 = new AutoApproval { Id = 5, DocType = _docType3, SubDocType = _subDocType7, Manco = _manCo1 }; this._approvals = new List <AutoApproval>(); this._approvals.Add(_approval1); this._approvals.Add(_approval2); this._approvals.Add(_approval3); this._approvals.Add(_approval4); this._approvals.Add(_approval5); }
/// <summary> /// Sets the <see cref="AsciiDoctorJRunnerSettings.DocType"/> /// Possible Values <seealso cref="DocType"/> /// </summary> /// <param name="this"></param> /// <param name="docType"></param> /// <returns></returns> public static AsciiDoctorJRunnerSettings WithDocType(this AsciiDoctorJRunnerSettings @this, DocType docType) { @this.DocType = docType; return(@this); }
public NewDocLayout(DocType type) { InitializeComponent(); this.DataContext = new NewDocLayoutViewModel(type); }
internal static void DocumentoUnico(this OpenFileDialog openFile, string filtro, DocType documento) { openFile.Multiselect = false; openFile.InitialDirectory = @"C:\"; openFile.DefaultExt = documento == DocType.DOCUMENT ? ".doc|.pdf" : ".png|.jpg"; openFile.Filter = filtro; openFile.CheckFileExists = true; openFile.CheckPathExists = true; }
public RadioButton(HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(InputType.Radio, parsingMode, parsingOptions, docType) { }
public ButtonElement(ButtonType type, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(HtmlTag.Button, parsingMode, parsingOptions, docType) { Type = type; }
public string WrapWithAbbreviation(string abbreviation, string text, DocType docType, out int relativeInsertionPoint) { return ProcessInsertPoint(WrapWithAbbreviation(abbreviation, text, docType), out relativeInsertionPoint); }
public SelectedForm(DocType doctype) { InitializeComponent(); _doctype = PMS.Libraries.ToolControls.PMSPublicInfo.PublicFunctionClass.GetByteTypeFromDocType(doctype); }
public TableCell(bool isHeaderCell = false, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(isHeaderCell ? HtmlTag.Th : HtmlTag.Td, parsingMode, parsingOptions, docType) { }
// -------------------------------------------------------------------------------------------------------------- // TransformResolver // ------------------------------------------------------------------------------------------------------------- public int TransformResolver(string szXmlFile, TransformType transformType, DocType docType, XmlResolver xr) { // Default value of errorCase is false return(TransformResolver(szXmlFile, xr, false, transformType, docType)); }
private static List <DocumentViewModel> GetDocumentViewModel(ApplicationDbContext context, ICollection <Document> UserDocs, DocType DocumentType) { List <DocumentViewModel> JobSeekerCVs = new List <DocumentViewModel>(); DocumentViewModel NewDoc; foreach (var item in UserDocs) { if (item.DocumentTypeId != (int)DocumentType) { continue; } NewDoc = new DocumentViewModel(); NewDoc.DocumentId = item.DocumentId; NewDoc.DocumentDescription = item.DocumentDescription; NewDoc.DocumentPath = item.DocumentLocation; NewDoc.DocumentStatus = context.DocumentStatus.Where(DS => DS.DocumentStatusId == item.DocumentStatus).ToList().First().DocumentStatusDescription; NewDoc.DocumentType = context.DocumentsTypes.Where(DT => DT.DocumentTypeId == item.DocumentTypeId).ToList().First().DocumentTypeDescription; JobSeekerCVs.Add(NewDoc); } return(JobSeekerCVs); }
// -------------------------------------------------------------------------------------------------------------- // Transform_ArgList // ------------------------------------------------------------------------------------------------------------- public int Transform_ArgList(string szXmlFile, TransformType transformType, DocType docType) { // Default value of errorCase is false return(Transform_ArgList(szXmlFile, false, transformType, docType)); }
public TableBody(HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(HtmlTag.Tbody, parsingMode, parsingOptions, docType) { }
public override string ToString() { return("DOM Root (" + DocType.ToString() + ", " + DescendantCount().ToString() + " elements)"); }
public int TransformResolver(string szXmlFile, XmlResolver xr, bool errorCase, TransformType transformType, DocType docType) { lock (s_outFileMemoryLock) { szXmlFile = FullFilePath(szXmlFile); _output.WriteLine("Loading XML {0}", szXmlFile); IXPathNavigable xd = LoadXML(szXmlFile, docType); _output.WriteLine("Executing transform"); xrXSLT = null; Stream strmTemp = null; switch (transformType) { case TransformType.Reader: xrXSLT = xslt.Transform(xd, null, xr); using (FileStream outFile = new FileStream(_strOutFile, FileMode.Create, FileAccess.ReadWrite)) using (XmlWriter writer = XmlWriter.Create(outFile)) { writer.WriteNode(xrXSLT, true); } if (errorCase) { try { while (xrXSLT.Read()) { } } catch (Exception ex) { throw (ex); } finally { if (xrXSLT != null) { xrXSLT.Dispose(); } } } break; case TransformType.Stream: try { strmTemp = new FileStream(_strOutFile, FileMode.Create, FileAccess.ReadWrite); xslt.Transform(xd, null, strmTemp, xr); } catch (Exception ex) { throw (ex); } finally { if (strmTemp != null) { strmTemp.Dispose(); } } break; case TransformType.Writer: XmlWriter xw = null; try { xw = new XmlTextWriter(_strOutFile, Encoding.UTF8); xw.WriteStartDocument(); xslt.Transform(xd, null, xw, xr); } catch (Exception ex) { throw (ex); } finally { if (xw != null) { xw.Dispose(); } } break; case TransformType.TextWriter: TextWriter tw = null; try { using (FileStream outFile = new FileStream(_strOutFile, FileMode.Create, FileAccess.Write)) { tw = new StreamWriter(outFile, Encoding.UTF8); xslt.Transform(xd, null, tw, xr); } } catch (Exception ex) { throw (ex); } break; } return(1); } }
public BaseDocumentWrapper(BaseIntegration <AppType, DocType> integ, DocType doc) { this.integ = integ; this.doc = doc; }
/// <summary> /// Инициализация /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { if (!V4Page.Listeners.Contains(this)) { V4Page.Listeners.Add(this); } LinkedDocCmdListnerIndex = V4Page.Listeners.IndexOf(this); base.OnInit(e); if (V4Page.V4IsPostBack) { return; } _currentTypeSelectCtrlText = new Label { Text = $"{V4Page.Resx.GetString("LinkedDocs_lbl_ТипВытекающего")}:" }; _currentTypeSelectCtrl = new DropDownList { V4Page = V4Page, ID = "type_" + ID, Width = new Unit("350px"), IsReadOnly = true }; _currentTypeSelectCtrl.Changed += TypeChanged; V4Page.V4Controls.Add(_currentTypeSelectCtrl); _dtSequelTypes = DocType.GetSettingsLinkedDocsInfo(CurrentDocType); LoadDropDownListData(); SetDefaultLinkedDocType(); _currentRadioCtrl = new Radio { V4Page = V4Page, ID = "radio_" + ID, IsRow = false, Name = "DocRadio", HtmlID = "radio_" + ID }; _currentRadioCtrl.Changed += _currentRadioCtrl_OnChanged; _currentRadioCtrl.Items.Add(new Item("0", $" {V4Page.Resx.GetString("LinkedDocs_lbl_НовыйВытекающий")}")); _currentRadioCtrl.Items.Add(new Item("1", $" {V4Page.Resx.GetString("LinkedDocs_lbl_Существующий")}")); _currentRadioCtrl.Value = "0"; V4Page.V4Controls.Add(_currentRadioCtrl); _currentDbSelectCtrl = new DBSDocument { V4Page = V4Page, ID = "dbsDocument_" + ID, HtmlID = "linkedDoc", Width = new Unit("350px") }; _currentDbSelectCtrl.OnRenderNtf += LinkedDocumentOnOnRenderNtf; _currentDbSelectCtrl.ValueChanged += LinkedDocumentOnValueChanged; _currentDbSelectCtrl.BeforeSearch += DBSelect_BeforeSearch; _currentDbSelectCtrl.IsDisabled = true; V4Page.V4Controls.Add(_currentDbSelectCtrl); }
/// <summary> /// Creates and returns an <see cref="HtmlDocument"/>. /// </summary> /// <param name="namespaceURI">Is a string containing the namespace URI of the document to be created, or null if the document doesn't belong to one.</param> /// <param name="qualifiedNameStr">Is a string containing the qualified name, that is an optional prefix and colon plus the local root element name, of the document to be created.</param> /// <param name="documentType">Is the DocumentType of the document to be created.</param> public XmlDocument CreateDocument(string namespaceURI, string qualifiedNameStr, DocType documentType = null) { if (qualifiedNameStr == null) { throw new ArgumentNullException(nameof(qualifiedNameStr)); } /*The HTML namespace is: http://www.w3.org/1999/xhtml * The MathML namespace is: http://www.w3.org/1998/Math/MathML * The SVG namespace is: http://www.w3.org/2000/svg * The XLink namespace is: http://www.w3.org/1999/xlink * The XML namespace is: http://www.w3.org/XML/1998/namespace * The XMLNS namespace is: http://www.w3.org/2000/xmlns/*/ //todo: we have to do something with namespaceURI and qualifiedNameStr fields. return(new XmlDocument(namespaceURI, qualifiedNameStr, documentType, null)); }
public DataGrid(string name, string href, bool autoGenerateColumns = true, bool hasFooter = true, IEnumerable <int> pageSizes = null, GridTheme theme = null, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(parsingMode, parsingOptions, docType) { Initialize(name, href, autoGenerateColumns, hasFooter, pageSizes, theme); }
public DocTypeEdit() { InitializeComponent(); DocTypeItem = new DocType(); DataContext = this; }
private static DocType GetDocType(DocType docType) { return(docType == DocType.Default ? Config.DocType : docType); }
/// <summary> /// Retrieve document, or prepare new one /// </summary> public JObject document(int id, DocType type) { Title = Title.Replace("Document", type.UnCamel()); Extended_Document header = getDocument<Extended_Document>(id); if (header.idDocument == null) { header.DocumentTypeId = (int)type; header.DocType = type.UnCamel(); header.DocumentDate = Utils.Today; header.DocumentName = ""; header.DocumentIdentifier = Settings.NextNumber(type).ToString(); if (GetParameters["name"].IsInteger()) { JObject name = Database.QueryOne("*", "WHERE Type = " + Database.Quote(NameType) + " AND idNameAddress = " + GetParameters["name"], "NameAddress"); if (name != null) { checkNameType(name.AsString("Type"), NameType); header.DocumentNameAddressId = name.AsInt("idNameAddress"); header.DocumentAddress = name.AsString("Address"); header.DocumentName = name.AsString("Name"); } } } else { checkDocType(header.DocumentTypeId, type); checkNameType(header.DocumentNameAddressId, NameType); } JObject record = new JObject().AddRange("header", header); Database.NextPreviousDocument(record, "WHERE DocumentTypeId = " + (int)type); Select s = new Select(); record.AddRange("VatCodes", s.VatCode(""), "Names", s.Name(NameType, "")); return record; }
public void ShouldThrowAnArgumentNullExceptionWhenWhenCreatingATemplateAndTheElementsAreNull() { var docType = new DocType("hello"); new Template(docType, null); }
public string ExpandAbbreviation(string abbreviation, DocType docType) { return expandAbbr(abbreviation, docType.ToString().ToLowerInvariant()); }
/* doctype: omit | auto | strict | loose | <fpi> where the fpi is a string similar to "-//ACME//DTD HTML 3.14159//EN" */ /* protected internal */ internal string ParseDocType(string s, string option) { s = s.Trim(); /* "-//ACME//DTD HTML 3.14159//EN" or similar */ if (s.StartsWith("\"")) { DocType = TidyNet.DocType.User; return s; } /* read first word */ string word = ""; Tokenizer t = new Tokenizer(s, " \t\n\r,"); if (t.HasMoreTokens()) { word = t.NextToken(); } if (String.Compare(word, "omit") == 0) { DocType = TidyNet.DocType.Omit; } else if (String.Compare(word, "strict") == 0) { DocType = TidyNet.DocType.Strict; } else if (String.Compare(word, "loose") == 0 || String.Compare(word, "transitional") == 0) { DocType = TidyNet.DocType.Loose; } else if (String.Compare(word, "auto") == 0) { DocType = TidyNet.DocType.Auto; } else { DocType = TidyNet.DocType.Auto; Report.BadArgument(option); } return null; }
public string WrapWithAbbreviation(string abbreviation, string text, DocType docType) { return wrapWithAbbr(abbreviation, text, docType.ToString().ToLowerInvariant()); }
/// <summary> /// Create a new CQ object from a stream of HTML, treating the HTML as a content document. /// </summary> /// /// <param name="html"> /// An open Stream. /// </param> /// <param name="encoding"> /// The character set encoding. /// </param> /// <param name="parsingMode"> /// (optional) the mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> /// /// <returns> /// A new CQ object. /// </returns> public static CQ Create(Stream html, Encoding encoding = null, HtmlParsingMode parsingMode=HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) { return new CQ(html, encoding,parsingMode,parsingOptions, docType); }
/// <summary> /// Creates the document type node. /// </summary> /// /// <param name="docType"> /// The DocType for this document. /// </param> /// /// <returns> /// The new document type. /// </returns> public IDomDocumentType CreateDocumentType(DocType docType) { return(new DomDocumentType(docType)); }
public TableHeader(HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(HtmlTag.Thead, parsingMode, parsingOptions, docType) { }
private string GetQuerySqlByDocType(DocType type) { string sql = string.Empty; if (type == DocType.DASH) { sql = "select * from searchIndex where name like '%{0}%' order by name = '{0}' desc, name like '{0}%' desc limit 30"; } if (type == DocType.ZDASH) { sql = @"select ztokenname as name, zpath as path from ztoken join ztokenmetainformation on ztoken.zmetainformation = ztokenmetainformation.z_pk join zfilepath on ztokenmetainformation.zfile = zfilepath.z_pk where (ztokenname like '%{0}%') order by length(ztokenname), lower(ztokenname) asc, zpath asc limit 30"; } return sql; }
private void GenerateType(DocType dt, StringBuilder output) { string typeLink = GetEntityLink(dt.Name); output.Append("### "); if (typeLink != null) { output.Append("["); } output.Append(dt.SanitisedNameWithoutNamespace.HtmlEncode()); if (typeLink != null) { output.Append("]("); output.Append(typeLink); output.Append(")"); } output.AppendLine(); output.AppendLine(); output.Append(dt.Summary); output.AppendLine(); output.AppendLine(); if (dt.TypeParameters != null) { foreach (DocPrimitive tp in dt.TypeParameters.Where(t => !string.IsNullOrEmpty(t.Summary))) { output.Append(" - **"); output.Append(tp.Name); output.Append("** - *"); output.Append(tp.Summary); output.Append("*"); output.AppendLine(); } } if (dt.Fields != null) { output.Append("#### Fields"); output.AppendLine(); output.AppendLine(); output.AppendLine("|Name|Summary|"); output.AppendLine("|----|-------|"); foreach (DocPrimitive f in dt.Fields.OrderBy(f => f.NameWithoutNamespace)) { GenerateField(f, output); } } if (dt.Properties != null) { output.Append("#### Properties"); output.AppendLine(); output.AppendLine(); output.AppendLine("|Name|Summary|"); output.AppendLine("|----|-------|"); foreach (DocPrimitive f in dt.Properties.OrderBy(f => f.NameWithoutNamespace)) { GenerateField(f, output); } } if (dt.Methods != null) { output.Append("#### Methods"); output.AppendLine(); output.AppendLine(); output.AppendLine("|Name|Summary|"); output.AppendLine("|----|-------|"); foreach (DocMethod m in dt.Methods.OrderBy(m => m.MethodNameWithoutParametersAndNamespace)) { GenerateMethodShort(m, output); } } }
/// <summary> /// Create a new CQ object from a TextReader containg HTML /// </summary> /// /// <param name="html"> /// A string of HTML. /// </param> /// <param name="parsingMode"> /// (optional) the mode. /// </param> /// <param name="parsingOptions"> /// (optional) options for controlling the parsing. /// </param> /// <param name="docType"> /// (optional) type of the document. /// </param> /// /// <returns> /// The new fragment. /// </returns> public static CQ Create(TextReader html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) { return new CQ(html, parsingMode, parsingOptions, docType); }
public OptionElement(HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(HtmlTag.Option, parsingMode, parsingOptions, docType) { }
private static ElementFactory GetNewParser(HtmlParsingMode parsingMode, HtmlParsingOptions parsingOptions, DocType docType) { var parser = new ElementFactory(); parser.HtmlParsingMode = parsingMode; parser.DocType = GetDocType(docType); parser.HtmlParsingOptions = MergeOptions(parsingOptions); return(parser); }
private static async Task PostIndexDocument(RequestMetadata md) { #region Variables string header = "[Komodo.Server] " + md.Http.Request.Source.IpAddress + ":" + md.Http.Request.Source.Port + " PostIndexDocument "; string tempFile = _Settings.TempStorage.Disk.Directory + Guid.NewGuid().ToString(); string indexName = md.Http.Request.Url.Elements[0]; string sourceGuid = null; if (md.Http.Request.Url.Elements.Length == 2) { sourceGuid = md.Http.Request.Url.Elements[1]; } #endregion #region Check-Index-Existence Index index = _Daemon.GetIndex(indexName); if (index == null) { _Logging.Warn(header + "index " + indexName + " does not exist"); md.Http.Response.StatusCode = 404; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(new ErrorResponse(404, "Unknown index.", null, null).ToJson(true)); return; } #endregion #region Check-Supplied-GUID if (!String.IsNullOrEmpty(sourceGuid)) { if (_Daemon.SourceDocumentExists(indexName, sourceGuid)) { _Logging.Warn(header + "document " + indexName + "/" + sourceGuid + " already exists"); md.Http.Response.StatusCode = 409; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(new ErrorResponse(409, "Requested GUID already exists.", null, null).ToJson(true)); return; } } #endregion #region Retrieve-DocType-from-QS if (String.IsNullOrEmpty(md.Params.Type)) { _Logging.Warn(header + "no 'type' value found in querystring"); md.Http.Response.StatusCode = 400; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(new ErrorResponse(400, "Supply 'type' [json/xml/html/sql/text] in querystring.", null, null).ToJson(true)); return; } DocType docType = DocType.Json; switch (md.Params.Type) { case "json": docType = DocType.Json; break; case "xml": docType = DocType.Xml; break; case "html": docType = DocType.Html; break; case "sql": docType = DocType.Sql; break; case "text": docType = DocType.Text; break; case "unknown": docType = DocType.Unknown; break; default: _Logging.Warn(header + "invalid 'type' value found in querystring: " + md.Params.Type); md.Http.Response.StatusCode = 400; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(new ErrorResponse(400, "Supply 'type' [json/xml/html/sql/text] in querystring.", null, null).ToJson(true)); return; } #endregion try { #region Write-Temp-File long contentLength = 0; string md5 = null; CrawlResult crawlResult = null; if (!String.IsNullOrEmpty(md.Params.Url) || !String.IsNullOrEmpty(md.Params.Filename)) { #region Crawl if (!String.IsNullOrEmpty(md.Params.Url)) { HttpCrawler httpCrawler = new HttpCrawler(md.Params.Url); crawlResult = httpCrawler.Download(tempFile); if (!crawlResult.Success) { _Logging.Warn(header + "failed to crawl URL " + md.Params.Url); md.Http.Response.StatusCode = 500; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(new ErrorResponse(400, "Failed to crawl supplied URL.", null, crawlResult).ToJson(true)); return; } contentLength = crawlResult.ContentLength; md5 = Common.Md5File(tempFile); } else { FileCrawler fileCrawler = new FileCrawler(md.Params.Filename); crawlResult = fileCrawler.Download(tempFile); if (!crawlResult.Success) { _Logging.Warn(header + "failed to crawl filename " + md.Params.Filename); md.Http.Response.StatusCode = 500; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(new ErrorResponse(400, "Failed to crawl supplied filename.", null, crawlResult).ToJson(true)); return; } contentLength = crawlResult.ContentLength; md5 = Common.Md5(tempFile); } #endregion } else { using (FileStream fs = new FileStream(tempFile, FileMode.Create, FileAccess.ReadWrite)) { await md.Http.Request.Data.CopyToAsync(fs); } contentLength = md.Http.Request.ContentLength; md5 = Common.Md5File(tempFile); } #endregion #region Build-Source-Document string sourceUrl = null; if (!String.IsNullOrEmpty(md.Params.Url)) { sourceUrl = md.Params.Url; } else if (!String.IsNullOrEmpty(md.Params.Filename)) { sourceUrl = md.Params.Filename; } List <string> tags = null; if (!String.IsNullOrEmpty(md.Params.Tags)) { tags = Common.CsvToStringList(md.Params.Tags); } SourceDocument src = new SourceDocument( sourceGuid, md.User.GUID, index.GUID, md.Params.Name, md.Params.Title, tags, docType, sourceUrl, md.Http.Request.ContentType, contentLength, md5); #endregion if (!md.Params.Async) { #region Sync IndexResult result = await _Daemon.AddDocument( indexName, src, Common.ReadBinaryFile(tempFile), new ParseOptions(), !md.Params.Bypass); if (!result.Success) { _Logging.Warn(header + "unable to store document in index " + indexName); md.Http.Response.StatusCode = 500; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(new ErrorResponse(500, "Unable to store document in index '" + indexName + "'.", null, result).ToJson(true)); return; } md.Http.Response.StatusCode = 200; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(Common.SerializeJson(result, md.Params.Pretty)); return; #endregion } else { #region Async IndexResult result = new IndexResult(); result.Success = true; result.GUID = src.GUID; result.Type = docType; result.ParseResult = null; result.Time = null; Task unawaited = _Daemon.AddDocument( index.Name, src, Common.ReadBinaryFile(tempFile), new ParseOptions(), !md.Params.Bypass); md.Http.Response.StatusCode = 200; md.Http.Response.ContentType = "application/json"; await md.Http.Response.Send(Common.SerializeJson(result, md.Params.Pretty)); return; #endregion } } finally { if (File.Exists(tempFile)) { File.Delete(tempFile); } } }
/// <summary> /// Get a Buy or Sell document for editing /// </summary> public void Document(int id, DocType type) { Title = Title.Replace("Document", type.UnCamel()); InvestmentDocument header = getDocument<InvestmentDocument>(id); if (header.idDocument == null) { header.DocumentTypeId = (int)type; header.DocType = type.UnCamel(); header.DocumentDate = Utils.Today; header.DocumentName = ""; if (GetParameters["acct"].IsInteger()) { FullAccount acct = Database.QueryOne<FullAccount>("*", "WHERE idAccount = " + GetParameters["acct"], "Account"); if (acct.idAccount != null) { header.DocumentAccountId = (int)acct.idAccount; header.DocumentAccountName = acct.AccountName; header.FeeAccount = Database.QueryOne("SELECT idAccount FROM Account WHERE AccountName = " + Database.Quote(acct.AccountName + " fees")).AsInt("idAccount"); } } } else { checkDocType(header.DocumentTypeId, DocType.Buy, DocType.Sell); List<JObject> journals = Database.Query(@"SELECT * FROM Journal LEFT JOIN StockTransaction ON idStockTransaction = idJournal LEFT JOIN Security ON idSecurity = SecurityId WHERE JournalNum > 1 AND DocumentId = " + id).ToList(); header.SecurityId = journals[0].AsInt("SecurityId"); header.SecurityName = journals[0].AsString("SecurityName"); header.Quantity = journals[0].AsDouble("Quantity"); header.Price = journals[0].AsDouble("Price"); if (journals.Count > 1) { header.FeeAccount = journals[1].AsInt("AccountId"); header.Fee = journals[1].AsDecimal("Amount"); header.FeeMemo = journals[1].AsString("Memo"); } if (type == DocType.Sell) header.Quantity = -header.Quantity; } JObject record = new JObject().AddRange("header", header); Database.NextPreviousDocument(record, "JOIN Journal ON DocumentId = idDocument WHERE DocumentTypeId " + Database.In(DocType.Buy, DocType.Sell) + (header.DocumentAccountId > 0 ? " AND AccountId = " + header.DocumentAccountId : "")); Select s = new Select(); record.AddRange("Accounts", s.ExpenseAccount(""), "Names", s.Other(""), "Securities", s.Security("")); Record = record; }
public DbEntityEntry <DocType> Entry(DocType doctype) { return(Context.Entry(doctype)); }