/// <summary> /// Get entity from adoxio_documents by key /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='adoxioDocumentid'> /// key: adoxio_documentid of adoxio_document /// </param> /// <param name='select'> /// Select properties to be returned /// </param> /// <param name='expand'> /// Expand related entities /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <MicrosoftDynamicsCRMadoxioDocument> GetByKeyAsync(this IDocuments operations, string adoxioDocumentid, IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetByKeyWithHttpMessagesAsync(adoxioDocumentid, select, expand, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Create a new business partner /// </summary> /// <param name="sap">SAP connection</param> /// <param name="docDate">Document date</param> /// <param name="cardCode">Card name</param> /// <param name="items">Sales order items</param> /// <returns>Retrieve new object key</returns> public int Create( SAPConnection sap, DateTime docDate, string cardCode, List <Dictionary <string, string> > items ) { IDocuments document = sap.Company.GetBusinessObject(BoObjectTypes.oOrders); document.DocDate = docDate; document.DocDueDate = DateTime.Now; document.CardCode = cardCode; for (int i = 0; i < items.Count; i++) { Dictionary <string, string> current = items[i]; document.Lines.ItemCode = current["ItemCode"]; document.Lines.Quantity = double.Parse(current["Quantity"]); document.Lines.UnitPrice = double.Parse(current["Price"]); if (i < items.Count - 1) { document.Lines.Add(); } } sap.CheckResponse(document.Add()); return(int.Parse(sap.Company.GetNewObjectKey())); }
public IKompasDocument2D OpenDrawing(string pathDrawing) // открыть чертеж в компасе { IDocuments docs7 = TestKompas7(); if (docs7 == null) { //MessageBox.Show("Не удалось подключить интерфейс Компас.IDocuments."); return(null); } if (!File.Exists(pathDrawing)) { pathDrawing = DirProj + Path.DirectorySeparatorChar + "Чертежи" + Path.DirectorySeparatorChar + Path.GetFileName(pathDrawing); if (!File.Exists(pathDrawing)) { MessageBox.Show("Не удалось найти файл " + Path.GetFileName(pathDrawing) + "."); return(null); } } IKompasDocument2D doc2d = (IKompasDocument2D)docs7.Open(pathDrawing, true, false); if (doc2d == null) { MessageBox.Show("Не удалось открыть докумемент."); return(null); } doc2d.Active = true; return(doc2d); }
public DocsController(DomainContext context, ILogger <DocsController> log) { logger = log; docBO = new DocumentBO(context); docTypeBO = new DocumentTypeBO(context); configBO = new ConsecutiveConfigBO(context); }
public IPart7 GetPart7(string pathModel) // открыть модель и получить интерфейс IPart7 по пути к модели { IDocuments docs7 = TestKompas7(); if (docs7 == null) { //MessageBox.Show("Не удалось подключить интерфейс Компас.IDocuments."); return(null); } if (!File.Exists(pathModel)) { //MessageBox.Show("Не удалось найти файл " + Path.GetFileName(pathModel) + "."); return(null); } IKompasDocument3D doc = (IKompasDocument3D)docs7.Open(pathModel, true, false); if (doc == null) { //MessageBox.Show("Не удалось открыть докумемент."); return(null); } doc.Active = true; IPart7 part = doc.TopPart; if (part == null) { //MessageBox.Show("Не удалось подключить интерфейс Компас.IPart7."); return(null); } return(part); }
public IDocuments TestKompas7() // тест на поключение к компасу { if (Kompas == null) { //MessageBox.Show("Не удалось подключить интерфейс Компас. Проверьте, запущен ли Компас."); return(null); } IApplication kompas7 = Kompas.ksGetApplication7(); if (kompas7 == null) { //MessageBox.Show("Не удалось подключить интерфейс Компас.App7."); return(null); } IDocuments docs7 = kompas7.Documents; if (docs7 == null) { //MessageBox.Show("Не удалось подключить интерфейс Компас.IDocuments."); return(null); } return(docs7); }
/// <summary> /// Add new entity to adoxio_documents /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// New entity /// </param> /// <param name='prefer'> /// Required in order for the service to return a JSON representation of the /// object. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <MicrosoftDynamicsCRMadoxioDocument> CreateAsync(this IDocuments operations, MicrosoftDynamicsCRMadoxioDocument body, string prefer = "return=representation", CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(body, prefer, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Get entities from adoxio_documents /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='top'> /// </param> /// <param name='skip'> /// </param> /// <param name='search'> /// </param> /// <param name='filter'> /// </param> /// <param name='count'> /// </param> /// <param name='orderby'> /// Order items by property values /// </param> /// <param name='select'> /// Select properties to be returned /// </param> /// <param name='expand'> /// Expand related entities /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <DocumentsGetResponseModel> GetAsync(this IDocuments operations, int?top = default(int?), int?skip = default(int?), string search = default(string), string filter = default(string), bool?count = default(bool?), IList <string> orderby = default(IList <string>), IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(top, skip, search, filter, count, orderby, select, expand, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Search Document /// </summary> /// <param name="document"></param> /// <param name="table"></param> /// <param name="where"></param> /// <returns></returns> public static bool Search(this IDocuments document, string table, string where) { var recordSet = SboApp.Company.GetBusinessObject(BoObjectTypes.BoRecordset) as Recordset; recordSet.DoQuery($"SELECT * FROM [{table}] WHERE {where}"); document.Browser.Recordset = recordSet; return(recordSet.RecordCount != 0); }
/// <summary> /// Add Document. /// Throws Exeption if failed instead of returnCode. /// Returns DocEntry /// </summary> /// <param name="documents"></param> /// <returns>Document Entry Key</returns> public static int AddEx(this IDocuments documents) { var returnCode = documents.Add(); ErrorHelper.HandleErrorWithException(returnCode, "Could not Add Document"); return(int.Parse(SboApp.Company.GetNewObjectKey())); }
/// <summary> /// Search Document /// </summary> /// <param name="document"></param> /// <param name="table"></param> /// <param name="where"></param> /// <returns></returns> public static bool Search(this IDocuments document, string table, string where) { var recordSet = SboApp.Company.GetBusinessObject(BoObjectTypes.BoRecordset) as Recordset; recordSet.DoQuery(FrameworkQueries.Instance.SearchQuery(table, where)); document.Browser.Recordset = recordSet; return(recordSet.RecordCount != 0); }
public ActionResult UploadRMGDocument(HttpPostedFileBase doc, UploadHRDocumentsViewModel model) { UploadsDAL uploads = new UploadsDAL(); bool uploadStatus = false; if (doc.ContentLength > 0) { string uploadsPath = (UploadFileLocationRMG); uploadsPath = Path.Combine(uploadsPath, GetUploadTypeSelectedText(1)); string fileName = Path.GetFileName(doc.FileName); try { IDocuments document = null; if (!uploads.IsRMGDocumentExists(Path.GetFileName(doc.FileName), model.UploadTypeId)) { // Insert new record to parent document = new Tbl_RMG_Documents(); document.FileName = Path.GetFileName(doc.FileName); ((Tbl_RMG_Documents)document).FileDescription = model.FileDescription; ((Tbl_RMG_Documents)document).UploadTypeId = 1; } else { // Insert new record to child document = new Tbl_RMG_DocumentDetail(); int documentID = 0; string newNameForDocument = uploads.GetNewNameForRMGDocument(Path.GetFileName(doc.FileName), 1, out documentID); fileName = newNameForDocument; document.DocumentId = documentID; document.FileName = newNameForDocument; } document.FilePath = uploadsPath; document.Comments = model.Comments; document.FileDescription = model.FileDescription; document.UploadedBy = int.Parse(HttpContext.User.Identity.Name); document.UploadedDate = DateTime.Now; uploads.UploadRMGDocument(document); string filePath = Path.Combine(uploadsPath, fileName); if (!Directory.Exists(uploadsPath)) { Directory.CreateDirectory(uploadsPath); } doc.SaveAs(filePath); uploadStatus = true; } catch (Exception) { //throw; } } return(Json(new { status = uploadStatus }, "text/html", JsonRequestBehavior.AllowGet)); }
/// <summary> /// Add Document and load added entry into Business Object /// </summary> /// <param name="documents"></param> public static void AddAndLoadEx(this IDocuments documents) { var documentEntryKey = documents.AddEx(); if (!documents.GetByKey(documentEntryKey)) { throw new Exception($"Could not load document with DocEntry {documentEntryKey}"); } }
/// <summary> /// Delete SAP record if exist /// </summary> /// <param name="sap">SAP connection</param> /// <param name="docEntry">Doc entry to delete</param> /// <returns></returns> public bool Delete(SAPConnection sap, int docEntry) { IDocuments document = sap.Company.GetBusinessObject(BoObjectTypes.oOrders); if (document.GetByKey(docEntry)) { sap.CheckResponse(document.Cancel()); return(true); } return(false); }
/// <summary> /// Gets an item. /// </summary> /// <param name="documents"></param> /// <param name="id"></param> /// <param name="ct"></param> /// <param name="options"></param> /// <returns></returns> public static async Task <IDocumentInfo <T> > GetAsync <T>( this IDocuments documents, string id, CancellationToken ct = default, OperationOptions options = null) { var result = await documents.FindAsync <T>(id, ct, options); if (result == null) { throw new ResourceNotFoundException($"Resource {id} not found"); } return(result); }
public bool ClosePart(IPart7 part) // закрыть модель { IDocuments docs7 = TestKompas7(); IKompasDocument3D doc = (IKompasDocument3D)docs7.Open(part.FileName, true, false); doc.Active = true; if (doc == null) { return(false); } return(doc.Close(DocumentCloseOptions.kdSaveChanges)); }
/// <summary> /// Конструктор /// </summary> public DocumentsForm(IDocuments documents) : base() { InitializeComponent(); // Инициализировать компоненты формы _documents = documents; // Сохранить список документов в поле ConfigureEntitiesDataGridView(); // Настроить визуальное представление элемента отображения списка сущностей FillEntitiesDataGridView(); // Заполнить элемент отображения списка сущностей SetButtonActivity(); // Задать активность элементов управления }
public OvertimeRequestController(IOverTimeRequest _ioverTimeReques, IWorkflowDetail _iworkflowDetail, IWorkflowTracker _iworkflowTracker, IDepartment _idepartment, IDocuments _idocuments, IRole _irole, IUser _iuser, IHold _ihold, IMenu _imenu, IInsight _iinsight) { ioverTimeRequest = _ioverTimeReques; iworkflowDetail = _iworkflowDetail; iworkflowTracker = _iworkflowTracker; idepartment = _idepartment; idocuments = _idocuments; irole = _irole; iuser = _iuser; ihold = _ihold; imenu = _imenu; iinsight = _iinsight; }
/// <summary> /// Конструктор /// </summary> public ManForm(IMan man, IDocuments documents) : base() { InitializeComponent(); // Инициализировать компоненты формы _man = man; // Сохранить человека в поле _documents = documents; // Сохранить список документов в поле _documentAfterRelinking = man.Document; // Сохранить документ, связанный с человеком CleanAllData(); // Очистить компоненты всех групп CopyDataFromEntity(); // Скопировать данные человека в компоненты формы }
public static void InsertIntoNewDocument(string tmpFile, string address, string tooltip) { using (IWordApplication wordApplication = GetOrCreateWordApplication()) { if (wordApplication == null) { return; } wordApplication.Visible = true; wordApplication.Activate(); // Create new Document object template = string.Empty; object newTemplate = false; object documentType = 0; object documentVisible = true; using (IDocuments documents = wordApplication.Documents) { using (IWordDocument wordDocument = documents.Add(ref template, ref newTemplate, ref documentType, ref documentVisible)) { using (ISelection selection = wordApplication.Selection) { // Add Picture using (IInlineShape shape = AddPictureToSelection(selection, tmpFile)) { if (!string.IsNullOrEmpty(address)) { object screentip = Type.Missing; if (!string.IsNullOrEmpty(tooltip)) { screentip = tooltip; } try { using (IHyperlinks hyperlinks = wordDocument.Hyperlinks) { hyperlinks.Add(shape, screentip, Type.Missing, screentip, Type.Missing, Type.Missing); } } catch (Exception e) { LOG.WarnFormat("Couldn't add hyperlink for image: {0}", e.Message); } } } } try { wordDocument.Activate(); } catch { } try { wordDocument.ActiveWindow.Activate(); } catch { } } } } }
/// <summary> /// Конструктор /// </summary> public ReportForm(IReport report, IClients clients, IEmployees employees, IApartments apartments, IObjects objects, IHomes homes, IMans man, IDocuments document) { InitializeComponent(); // Инициализировать компоненты формы _report = report; // Сохранить отчет в поле _clients = clients; // Сохранить список клиентов в поле _employees = employees; // Сохранить список сотрудников в поле _apartments = apartments; // Сохранить список квартир в поле _objects = objects; _homes = homes; // Сохранить список домов с поле _man = man; // Сохранить чловека _document = document; // Сохранить документ _clientAfterRelinking = report.Client; // Сохранить клиента связанного с отчетов _employeeAfterRelinking = report.Employee; // Сохранить сотрудника связанного с отчетов _apartmentAfterRelinking = report.Apartment; // Сохранить квартиру связанного с отчетов CleanAllData(); // Очистить компоненты всех групп CopyDataFromEntity(); // Скопировать данные человека в компоненты формы }
/// <summary> /// Get the captions of all the open word documents /// </summary> /// <returns></returns> public static List <string> GetWordDocuments() { List <string> openDocuments = new List <string>(); try { using (IWordApplication wordApplication = GetWordApplication()) { if (wordApplication == null) { return(openDocuments); } using (IDocuments documents = wordApplication.Documents) { for (int i = 1; i <= documents.Count; i++) { using (IWordDocument document = documents.item(i)) { if (document.ReadOnly) { continue; } if (isAfter2003()) { if (document.Final) { continue; } } using (IWordWindow activeWindow = document.ActiveWindow) { openDocuments.Add(activeWindow.Caption); } } } } } } catch (Exception ex) { LOG.Warn("Problem retrieving word destinations, ignoring: ", ex); } openDocuments.Sort(); return(openDocuments); }
/// <summary> /// Конструктор /// </summary> public ReportsForm(IReports reports, IClients clients, IEmployees employees, IApartments apartments, IObjects objects, IHomes homes, IMans man, IDocuments document, string reportTemplatesFolderPath, string reportsFolderPath, CreateReportDocument createReportDocumentFunction) : base() { InitializeComponent(); // Инициализировать компоненты формы _reports = reports; // Сохранить список отчетов в поле _clients = clients; // Сохранить список клиентов в поле _employees = employees; // Сохранить список сотрудников в поле _apartments = apartments; // Сохранить список квартир в поле _objects = objects; _homes = homes; // Сохранить список домов с поле _man = man; // Сохранить человека _document = document; // Сохранить документ _reportTemplatesFolderPath = reportTemplatesFolderPath; // Сохранить путь к папке с шаблонами отчетов _reportsFolderPath = reportsFolderPath; // Сохранить путь к папке с отчетами _createReportDocument = createReportDocumentFunction; // Сохранить делегат метода создания отчета ConfigureEntitiesDataGridView(); // Настроить визуальное представление элемента отображения списка сущностей FillEntitiesDataGridView(); // Заполнить элемент отображения списка сущностей SetButtonActivity(); // Задать активность элементов управления }
/// <summary> /// Insert the bitmap stored under the tempfile path into the word document with the supplied caption /// </summary> /// <param name="wordCaption"></param> /// <param name="tmpFile"></param> /// <returns></returns> public static bool InsertIntoExistingDocument(string wordCaption, string tmpFile) { using (IWordApplication wordApplication = GetWordApplication()) { if (wordApplication == null) { return(false); } using (IDocuments documents = wordApplication.Documents) { for (int i = 1; i <= documents.Count; i++) { using (IWordDocument wordDocument = documents.item(i)) { using (IWordWindow activeWindow = wordDocument.ActiveWindow) { if (activeWindow.Caption.StartsWith(wordCaption)) { return(InsertIntoExistingDocument(wordApplication, wordDocument, tmpFile, null, null)); } } } } } } return(false); }
/// <summary> /// Copy document /// </summary> /// <param name="sourceDocument"></param> /// <param name="copyToType"></param> /// <param name="copyExpenses">Copy Expenses</param> /// <param name="setObjectProperties">Set extra target document properties</param> /// <returns>DocEntry</returns> public static int CopyTo(this IDocuments sourceDocument, BoObjectTypes copyToType, bool copyExpenses = true, Action <Documents> setObjectProperties = null) { using (var copyTo = SboApp.Company.GetBusinessObject <Documents>(copyToType)) { var targetDocument = copyTo.Object; targetDocument.CardCode = sourceDocument.CardCode; setObjectProperties?.Invoke(targetDocument); foreach (var sourceLine in sourceDocument.Lines.AsEnumerable()) { SboApp.Logger.Debug($"CopyTo.Line: DocEntry={sourceLine.DocEntry}, LineNum={sourceLine.LineNum}, DocObjectCode={sourceDocument.DocObjectCode}"); targetDocument.Lines.BaseEntry = sourceLine.DocEntry; targetDocument.Lines.BaseLine = sourceLine.LineNum; targetDocument.Lines.BaseType = (int)sourceDocument.DocObjectCode; targetDocument.Lines.Add(); } if (copyExpenses) { foreach (var sourceExpense in sourceDocument.Expenses.AsEnumerable().Where(e => e.LineTotal > 0)) { SboApp.Logger.Debug($"CopyTo.Expense: DocEntry={sourceDocument.DocEntry}, LineNum={sourceExpense.LineNum}, DocObjectCode={sourceDocument.DocObjectCode}"); targetDocument.Expenses.BaseDocEntry = sourceDocument.DocEntry; targetDocument.Expenses.BaseDocLine = sourceExpense.LineNum; targetDocument.Expenses.BaseDocType = (int)sourceDocument.DocObjectCode; targetDocument.Expenses.Add(); } } targetDocument.AddAndLoadEx(); return(targetDocument.DocEntry); } }
internal Index(string name, IndexDefinition definition, IDocuments documents) { this.Name = name; this.Definition = definition; this.Documents = documents; }
/// <summary> /// Update Document. /// Throws Exeption if failed instead of returnCode. /// </summary> /// <param name="documents"></param> public static void UpdateEx(this IDocuments documents) { var returnCode = documents.Update(); ErrorHelper.HandleErrorWithException(returnCode, "Could not Update Document"); }
/// <summary> /// Add Comment to document /// </summary> /// <param name="documents">IDocuments object</param> /// <param name="comment">Comment text</param> public static void AddComment(this IDocuments documents, string comment) { documents.Comments = documents.Comments.AddNewLine(comment); }
public Indexer(IDocuments docs) { _docs = docs; }
// USE CASE: Verifying recognized documents public static void Verifying_recognized_documents(IEngine engine) { trace("Open the sample project..."); IProject project = engine.OpenProject(SamplesFolder + "\\SampleProject\\Invoices_eng.fcproj"); try { trace("Prepare a new batch for verification..."); IBatch batch = PrepareNewRecognizedBatch(engine, project); try { traceBegin("Run verification..."); trace("Start verification session (all documents in the batch)..."); IVerificationSession verificationSession = batch.StartVerification(null); try { trace("Change verification options if required..."); IVerificationOptions verificationOptions = verificationSession.Options; verificationOptions.VerifyExtraSymbols = true; trace("Open a set of documents (a work set) and collect objects that need to be verified..."); IVerificationWorkSet verificationWorkSet = verificationSession.NextWorkSet(); while (verificationWorkSet != null) { trace("For each group of objects show the objects to the verification operator for confirmation..."); IVerificationGroup verificationGroup = verificationWorkSet.NextGroup(); while (verificationGroup != null) { trace("Verification Group: " + verificationGroup.Description + " (confirm all)"); for (int i = 0; i < verificationGroup.Count; i++) { IVerificationObject verificationObject = verificationGroup.Item(i); if (verificationObject.Type == VerificationObjectTypeEnum.VOT_Group) { verificationObject.State = VerificationObjectStateEnum.VOS_Confirmed; } else { IContextVerificationObject contextVerificationObject = verificationObject.AsContextVerificationObject(); // If field value is modified during verification you should recheck rules for // the corresponding field contextVerificationObject.CheckRules(); contextVerificationObject.Field.Value.SetVerified(); } } verificationGroup = verificationWorkSet.NextGroup(); } trace("Save verification results (all documents in the set)..."); verificationWorkSet.Commit(); trace("Open the next set of documents..."); verificationWorkSet = verificationSession.NextWorkSet(); } trace("Close the session..."); } finally { // Verification consumes considerable system resources (many simultaniously // open and loaded documents and images). So it is VERY important that // these resources should be released in timely manner and not left for // garbage collector to manage. verificationSession.Close(); } trace("Check that the documents do not need verification now..."); IDocuments batchDocuments = batch.Documents; for (int i = 0; i < batchDocuments.Count; i++) { IDocument document = batchDocuments.Item(i); document.Open(false); try { recursiveCheckVerified(engine, document.Sections); } finally { document.Close(false); } } traceEnd("OK"); } finally { batch.Close(); project.Batches.DeleteAll(); } } finally { project.Close(); } traceEnd("OK"); }
public static Index ToIndex(this AzureIndex azureIdx, IDocuments documents) { return new Index(azureIdx.Name, FieldsToIndexDefinition(azureIdx.Fields), documents); }
public ReviewsController(DomainContext context, ILogger <ReviewsController> log, UserManager <Users> userManag, RoleManager <Role> roleManag) : base(userManag, roleManag, context) { docBO = new DocumentBO(context); logger = log; }
public DocumentController(ICommonRepository <Document> commonRepository, IDocuments commonDocument) { documentRepository = commonRepository; document = commonDocument; }