Exemple #1
0
        private string generateDocName(DocumentKind kind)
        {
            string rslt;

            switch (kind.ID)
            {
            case 1012:
                rslt = "ДГ";
                break;

            case 1013:
                rslt = "ДС";
                break;

            case 1014:
                rslt = "ТС";
                break;

            case 1015:
                rslt = "ЗП";
                break;

            default:
                rslt = "ПР";
                break;
            }
            ;

            rslt += ("-" + Convert.ToInt32(this.CurrentContract.Code) + "-" + String.Format("{0:yyyyMdHms}", DateTime.Now));

            return(rslt);
        }
 private void SetDocumentKind(DocumentKind kind)
 {
     if (CurrentEditorView != null)
     {
         CurrentEditorView.Workspace.DocumentKind = kind;
     }
 }
Exemple #3
0
        public IEnumerable <NavigationInfo> ListByKind(Identity projectId, DocumentKind kind)
        {
            var projectFilter = Builders <MDocument> .Filter.Where(x => x.ProjectId == projectId.ToPersistenceIdentity());

            var kindFilter = Builders <MDocument> .Filter.Where(x => x.Kind == kind);

            return(_documentCollection.Find(projectFilter & kindFilter).ToEnumerable().Select(x => x.ToInfo()));
        }
Exemple #4
0
        public Document(Guid id, DocumentKind kind, string name)
        {
            Id     = id;
            Name   = name;
            Kind   = kind;
            Status = DocumentStatus.UnLocked;

            Pages        = new List <Page>();
            DomainEvents = new List <DomainEvent>();
        }
Exemple #5
0
 public Document(DocumentKind kind, string url, string path, int?year, string title, IReadOnlyList <DocumentOwner> owners, string contents)
 {
     Kind     = kind;
     Url      = url;
     Path     = path;
     Year     = year;
     Title    = title;
     Contents = contents;
     Owners   = owners.ToArray();
 }
Exemple #6
0
        void WriteList(DocumentKind kind, string header)
        {
            outputWriter.WriteLine($"## {header}");
            outputWriter.WriteLine();

            foreach (var design in designs.Where(d => d.Kind == kind)
                     .OrderBy(d => d.Year)
                     .ThenBy(d => d.Title))
            {
                var link = GetMarkdownLink(directoryPath, design.Path, design.Title);
                outputWriter.WriteLine($"* {link}");
            }
        }
Exemple #7
0
        public Document AddDocument(DocumentKind kind, string name)
        {
            if (Documents == null)
            {
                Documents = new List <Document>();
            }

            var document = new Document(Guid.NewGuid(), kind, name);

            Documents.Add(document);

            return(document);
        }
Exemple #8
0
 public Document(
     Identity id,
     DocumentKind kind,
     string name,
     Identity projectId,
     IEnumerable <string> links,
     string content) : base(id)
 {
     Name    = name;
     Kind    = kind;
     Project = projectId;
     Links   = links;
     Content = content;
 }
Exemple #9
0
        void WriteDetails(DocumentKind kind, string header)
        {
            outputWriter.WriteLine($"## {header}");
            outputWriter.WriteLine();
            outputWriter.WriteLine($"|Year|Title|Owners|");
            outputWriter.WriteLine($"|----|-----|------|");

            foreach (var design in designs.Where(d => d.Kind == kind)
                     .OrderBy(d => d.Year)
                     .ThenBy(d => d.Title))
            {
                var owners = string.Join(", ", design.Owners);
                var link   = GetMarkdownLink(directoryPath, design.Path, design.Title);
                outputWriter.WriteLine($"| {design.Year} | {link} | { owners } |");
            }
        }
        private async Task <IReadOnlyList <DocumentInfo> > GetGraphQLFiles(
            string path, ICollection <HCError> errors)
        {
            var documents = new List <DocumentInfo>();

            foreach (string file in Directory.GetFiles(path, "*.graphql"))
            {
                byte[] buffer = await File.ReadAllBytesAsync(file);

                try
                {
                    DocumentNode document = Utf8GraphQLParser.Parse(buffer);

                    if (document.Definitions.Count > 0)
                    {
                        DocumentKind kind =
                            document.Definitions.Any(t => t is ITypeSystemDefinitionNode)
                                ? DocumentKind.Schema
                                : DocumentKind.Query;

                        documents.Add(new DocumentInfo
                        {
                            Kind     = kind,
                            FileName = file,
                            Document = document
                        });
                    }
                }
                catch (SyntaxException ex)
                {
                    HCError error = HCErrorBuilder.New()
                                    .SetMessage(ex.Message)
                                    .AddLocation(ex.Line, ex.Column)
                                    .SetCode("SYNTAX_ERROR")
                                    .SetExtension("fileName", file)
                                    .Build();

                    errors.Add(error);
                    return(Array.Empty <DocumentInfo>());
                }
            }

            return(documents);
        }
Exemple #11
0
        private string generateDocName(DocumentKind kind)
        {
            string rslt;

            switch (kind.ID)
            {
            case 1:
                rslt = "ПП";
                break;

            case 2:
                rslt = "ИН";
                break;

            case 3:
                rslt = "СЗ";
                break;

            case 4:
                rslt = "СД";
                break;

            case 5:
                rslt = "ДГ";
                break;

            case 6:
                rslt = "ПД";
                break;

            default:
                rslt = "ПР";
                break;
            }
            ;

            rslt += ("-" + this.LS + "-" + String.Format("{0:yyyyMdHms}", DateTime.Now));

            return(rslt);
        }
Exemple #12
0
        private string DocumentKindToUserType(DocumentKind kind)
        {
            switch (kind)
            {
            case DocumentKind.Project:
                return("Project");

            case DocumentKind.WorkTask:
                return("Work task");

            case DocumentKind.Meeting:
                return("Meeting");

            case DocumentKind.Sprint:
                return("Sprint");

            case DocumentKind.Common:
                return("Common");
            }

            throw new ArgumentOutOfRangeException();
        }
Exemple #13
0
        public async Task <string> Uploadfile([FromForm] Models.FormFile objFile, DocumentKind documentKind)
        {
            try
            {
                if (objFile.file.Length > 0)
                {
                    switch (documentKind)
                    {
                    case DocumentKind.thesis:
                        var path = _environment.WebRootPath + "\\" + DocumentKind.thesis.ToString() + "\\" + objFile.file.FileName;
                        if (!Directory.Exists(_environment.WebRootPath + "\\" + DocumentKind.thesis.ToString()))
                        {
                            Directory.CreateDirectory(_environment.WebRootPath + "\\" + DocumentKind.thesis.ToString());
                        }
                        if (System.IO.File.Exists(_environment.WebRootPath + "\\" + DocumentKind.thesis.ToString() + "\\" + objFile.file.FileName))
                        {
                            Console.WriteLine("plik został nadpisany");
                        }
                        //walidacja nazwy pliku
                        using (FileStream fs = System.IO.File.Create(path))
                        {
                            objFile.file.CopyTo(fs);
                            fs.Flush();
                            return(path);
                        }
                        break;

                    case DocumentKind.proposal:
                        var path2 = _environment.WebRootPath + "\\" + DocumentKind.proposal.ToString() + "\\" + objFile.file.FileName;
                        if (!Directory.Exists(_environment.WebRootPath + "\\" + DocumentKind.proposal.ToString()))
                        {
                            Directory.CreateDirectory(_environment.WebRootPath + "\\" + DocumentKind.proposal.ToString());
                        }
                        if (System.IO.File.Exists(_environment.WebRootPath + "\\" + DocumentKind.proposal.ToString() + "\\" + objFile.file.FileName))
                        {
                            Console.WriteLine("plik został nadpisany");
                        }
                        //walidacja nazwy pliku
                        using (FileStream fs = System.IO.File.Create(path2))
                        {
                            objFile.file.CopyTo(fs);
                            fs.Flush();
                            return(path2);
                        }
                        break;

                    case DocumentKind.paymentConfirmation:
                        var path3 = _environment.WebRootPath + "\\" + DocumentKind.paymentConfirmation.ToString() + "\\" + objFile.file.FileName;
                        if (!Directory.Exists(_environment.WebRootPath + "\\" + DocumentKind.paymentConfirmation.ToString()))
                        {
                            Directory.CreateDirectory(_environment.WebRootPath + "\\" + DocumentKind.paymentConfirmation.ToString());
                        }
                        if (System.IO.File.Exists(_environment.WebRootPath + "\\" + DocumentKind.paymentConfirmation.ToString() + "\\" + objFile.file.FileName))
                        {
                            Console.WriteLine("plik został nadpisany");
                        }
                        //walidacja nazwy pliku
                        using (FileStream fs = System.IO.File.Create(path3))
                        {
                            objFile.file.CopyTo(fs);
                            fs.Flush();
                            return(path3);
                        }
                        break;

                    default:
                        var path4 = _environment.WebRootPath + "\\" + DocumentKind.Inne.ToString() + "\\" + objFile.file.FileName;
                        if (!Directory.Exists(_environment.WebRootPath + "\\" + DocumentKind.Inne.ToString()))
                        {
                            Directory.CreateDirectory(_environment.WebRootPath + "\\" + DocumentKind.Inne.ToString());
                        }
                        if (System.IO.File.Exists(_environment.WebRootPath + "\\" + DocumentKind.Inne.ToString() + "\\" + objFile.file.FileName))
                        {
                            Console.WriteLine("plik został nadpisany");
                        }
                        //walidacja nazwy pliku
                        using (FileStream fs = System.IO.File.Create(path4))
                        {
                            objFile.file.CopyTo(fs);
                            fs.Flush();
                            return(path4);
                        }
                        break;
                    }
                }
                else
                {
                    throw new FileNotFoundException("Nie znaleziono pliku");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message.ToString());
            }
        }
Exemple #14
0
 public void SetKind(DocumentKind kind)
 {
     Kind = kind;
 }
        public bool ApprovePosting(long DocID, DocumentKind DocKind)
        {
            try
            {
                bool        isSuccess   = true;
                bool        ChangeState = false;
                SCGDocument doc         = ScgeAccountingQueryProvider.SCGDocumentQuery.GetSCGDocumentByDocumentID(DocID);

                if (doc == null)
                {
                }
                else if (!CanApprove(DocID, DocKind.ToString()))
                {
                }
                else if (this.GetPostingService(DocKind.ToString()).GetDocumentStatus(DocID, DocKind.ToString()) == "A")
                {
                }
                else
                {
                    #region Approve
                    IList <BAPIApproveReturn> bapiReturn = this.GetPostingService(DocKind.ToString()).BAPIApprove(DocID, DocKind.ToString(), this.UserAccount.UserID);

                    if (DocKind.ToString() == DocumentKind.ExpenseRemittance.ToString())
                    {
                        FnExpenseDocument docExpense = ScgeAccountingQueryProvider.FnExpenseDocumentQuery.GetExpenseDocumentByDocumentID(DocID);
                        if (GetPostingService(DocKind.ToString()).GetDocumentStatus(DocID, DocKind.ToString()) == "A")
                        {
                            docExpense.RemittancePostingStatus = "C";
                            FnExpenseDocumentService.SaveOrUpdate(docExpense);
                        }
                        else if (GetPostingService(DocKind.ToString()).GetDocumentStatus(DocID, DocKind.ToString()) == "PP")
                        {
                            docExpense.RemittancePostingStatus = "PP";
                            FnExpenseDocumentService.SaveOrUpdate(docExpense);
                        }
                    }
                    else
                    {
                        if (this.GetPostingService(DocKind.ToString()).GetDocumentStatus(DocID, DocKind.ToString()) == "A")
                        {
                            doc.PostingStatus = "C";
                            SCGDocumentService.SaveOrUpdate(doc);
                        }
                        else if (this.GetPostingService(DocKind.ToString()).GetDocumentStatus(DocID, DocKind.ToString()) == "PP")
                        {
                            doc.PostingStatus = "PP";
                            SCGDocumentService.SaveOrUpdate(doc);
                        }
                    }
                    #endregion Approve

                    #region Call WorkFlow
                    for (int i = 0; i < bapiReturn.Count; i++)
                    {
                        if (bapiReturn[i].ApproveStatus != "S")
                        {
                            isSuccess = false;
                            break;
                        }
                    }
                    if (isSuccess)
                    {
                        ChangeState = true;
                        WorkFlowApprove(DocKind.ToString());
                    }
                    #endregion Call WorkFlow

                    if (ChangeState)
                    {
                        string wfid = System.Web.HttpContext.Current.Request.QueryString["wfid"].ToString();
                        System.Web.HttpContext.Current.Response.Redirect("SubmitResult.aspx?wfid=" + wfid);
                    }
                }
                return(isSuccess);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #16
0
        public ActionResult <FileReadDto> UploadThesis([FromForm] Models.FormFile objFile, DocumentKind documentKind, bool accepted, Guid userId)
        {
            FileService service   = new FileService(_environment);
            var         path      = service.Uploadfile(objFile, documentKind);
            var         fileModel = new File
            {
                Id           = Guid.NewGuid(),
                Path         = path.Result,
                DocumentKind = documentKind,
                Accepted     = accepted,
                UserId       = userId,
                Date         = DateTime.Now,
                FileName     = objFile.file.FileName
            };

            _repository.SavePath(fileModel);
            _repository.SaveChanges();
            return(Ok());
        }
Exemple #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="file"></param>
 /// <param name="kind"></param>
 public AddDocMessage(string file, DocumentKind kind)
 {
     this.File = file;
     this.Kind = kind;
 }
Exemple #18
0
 public Document(DocumentKind kind, DataContext dataContext, SourceText text)
 {
     Kind        = kind;
     DataContext = dataContext;
     Text        = text;
 }
Exemple #19
0
        private async Task <Document <T>[]> PullByKindCore <T>(string familyId, int?after, int?before, DocumentKind kind, CancellationToken cancel)
        {
            var container      = _client.GetContainer(_databaseId, _containerId);
            var requestOptions = new QueryRequestOptions {
                PartitionKey = new PartitionKey(familyId)
            };
            var query = container.GetItemLinqQueryable <Document <T> >(requestOptions: requestOptions)
                        .Where(i => i.Timestamp > (after ?? int.MinValue))
                        .Where(i => i.Timestamp < (before ?? int.MaxValue))
                        .Where(i => i.DocumentKind == kind);
            var docs = new List <Document <T> >();

            using (var iterator = query.ToFeedIterator()) {
                while (iterator.HasMoreResults)
                {
                    foreach (var item in await iterator.ReadNextAsync(cancel))
                    {
                        docs.Add(item);
                    }
                }
            }
            return(docs.ToArray());
        }
Exemple #20
0
 public Document WithKind(DocumentKind kind)
 {
     return(kind == Kind ? this : new Document(kind, DataContext, Text));
 }