static ParagonDesktop() { if (WindowsVersion.IsWin7OrNewer) { RunningProcessTable = new ProcessTable(); } }
public IQueryable <ProcessSequenceLineIndexViewModel> GetProcessSequenceLineListForProductCollectionIndex(int ProductCollectionId) { int RefDocTypeId = new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.ProductCollection).DocumentTypeId; var temp = from L in db.ProcessSequenceLine join P in db.Process on L.ProcessId equals P.ProcessId into ProcessTable from ProcessTab in ProcessTable.DefaultIfEmpty() join t in db.ProcessSequenceHeader on L.ProcessSequenceHeaderId equals t.ProcessSequenceHeaderId where t.ReferenceDocId == ProductCollectionId && t.ReferenceDocTypeId == RefDocTypeId orderby L.Sequence select new ProcessSequenceLineIndexViewModel { ProcessSequenceHeaderId = L.ProcessSequenceHeaderId, ProcessSequenceLineId = L.ProcessSequenceLineId, ProcessId = L.ProcessId, ProcessName = ProcessTab.ProcessName, Sequence = L.Sequence, Days = L.Days, CreatedBy = L.CreatedBy, CreatedDate = L.CreatedDate, ModifiedBy = L.ModifiedBy, ModifiedDate = L.ModifiedDate, }; return(temp); }
public ProductUidDetail FGetProductUidDetail(string ProductUidNo) { ProductUidDetail UidDetail = (from Pu in _productRepository.Instance join P in _unitOfWork.Repository <Product>().Instance on Pu.ProductId equals P.ProductId into ProductTable from Producttab in ProductTable.DefaultIfEmpty() join Pr in _unitOfWork.Repository <Process>().Instance on Pu.CurrenctProcessId equals Pr.ProcessId into ProcessTable from ProcessTab in ProcessTable.DefaultIfEmpty() join Pe in _unitOfWork.Repository <Person>().Instance on Pu.LastTransactionPersonId equals Pe.PersonID into PersonTable from PersonTab in PersonTable.DefaultIfEmpty() where Pu.ProductUidName == ProductUidNo select new ProductUidDetail { ProductUidId = Pu.ProductUIDId, ProductId = Pu.ProductId, ProductName = Producttab.ProductName, PrevProcessId = Pu.CurrenctProcessId, PrevProcessName = ProcessTab.ProcessName, LastTransactionDocNo = Pu.LastTransactionDocNo, LastTransactionDocDate = Pu.LastTransactionDocDate, LastTransactionPersonName = PersonTab.Name, CurrenctGodownId = Pu.CurrenctGodownId, Status = Pu.Status, GenDocTypeId = Pu.GenDocTypeId, DivisionId = Producttab.DivisionId }).FirstOrDefault(); return(UidDetail); }
public ActionResult ShowDocument(Guid id, string approveDoc, string rejectDoc, IDictionary <string, object> documentData, string lastComment = "") { DocumentTable docuTable = _DocumentService.Find(id); if (docuTable == null) { return(HttpNotFound()); } if (lastComment != "") { _CommentService.SaveDomain(new CommentTable { Comment = lastComment, DocumentTableId = id }); } if (rejectDoc != String.Empty) { ApplicationUser userTable = _AccountService.FirstOrDefault(x => x.UserName == User.Identity.Name); if (userTable == null) { return(HttpNotFound()); } DateTime checkRejectDate = DateTime.UtcNow.AddMinutes(-5); if (!_CommentService.Contains(x => x.ApplicationUserCreatedId == userTable.Id && x.DocumentTableId == id && x.CreatedDate >= checkRejectDate)) { EmplTable emplTable = _EmplService.FirstOrDefault(x => x.ApplicationUserId == docuTable.ApplicationUserCreatedId); ProcessView process = _ProcessService.FindView(docuTable.ProcessTableId); object viewModel = InitialViewShowDocument(id, process, docuTable, userTable, emplTable); ModelState.AddModelError(string.Empty, UIElementRes.UIElement.RejectReason); return(View("~/Views/Document/ShowDocument.cshtml", viewModel)); } } ProcessTable processTable = docuTable.ProcessTable; if (_DocumentService.isSignDocument(id, processTable.Id)) { if (approveDoc != String.Empty) { _WorkflowService.AgreementWorkflowApprove(id, processTable.TableName, documentData); } else if (rejectDoc != String.Empty) { _WorkflowService.AgreementWorkflowReject(id, processTable.TableName, documentData); } } return(RedirectToAction("Index", "Home")); }
public void Save(ProcessView viewTable) { if (viewTable.Id == null) { var domainTable = new ProcessTable(); Mapper.Map(viewTable, domainTable); SaveDomain(domainTable); } else { var domainTable = Find(viewTable.Id); Mapper.Map(viewTable, domainTable); SaveDomain(domainTable); } }
public IEnumerable <ProcessSequenceLineIndexViewModel> GetProcessSequenceLineList(int ProcessSequenceHeaderId) { return(from L in db.ProcessSequenceLine join P in db.Process on L.ProcessId equals P.ProcessId into ProcessTable from ProcessTab in ProcessTable.DefaultIfEmpty() where L.ProcessSequenceHeaderId == ProcessSequenceHeaderId orderby L.Sequence select new ProcessSequenceLineIndexViewModel { ProcessSequenceHeaderId = L.ProcessSequenceHeaderId, ProcessSequenceLineId = L.ProcessSequenceLineId, ProcessId = L.ProcessId, ProcessName = ProcessTab.ProcessName, Sequence = L.Sequence, Days = L.Days, CreatedBy = L.CreatedBy, CreatedDate = L.CreatedDate, ModifiedBy = L.ModifiedBy, ModifiedDate = L.ModifiedDate, } ); }
public void SaveDomain(ProcessTable domainTable, string currentUserName = "") { string localUserName = getCurrentUserName(currentUserName); ApplicationUser user = _AccountService.FirstOrDefault(x => x.UserName == localUserName); if (domainTable.Id == Guid.Empty) { domainTable.Id = Guid.NewGuid(); domainTable.CreatedDate = DateTime.UtcNow; domainTable.ModifiedDate = domainTable.CreatedDate; domainTable.CompanyTableId = user.CompanyTableId; domainTable.ApplicationUserCreatedId = user.Id; domainTable.ApplicationUserModifiedId = user.Id; repo.Add(domainTable); } else { domainTable.ModifiedDate = DateTime.UtcNow; domainTable.ApplicationUserModifiedId = user.Id; repo.Update(domainTable); } _uow.Save(); }
public ProcessSequenceLineViewModel GetProcessSequenceLineModel(int id) { return((from L in db.ProcessSequenceLine join P in db.Process on L.ProcessId equals P.ProcessId into ProcessTable from ProcessTab in ProcessTable.DefaultIfEmpty() where L.ProcessSequenceLineId == id select new ProcessSequenceLineViewModel { ProcessSequenceHeaderId = L.ProcessSequenceHeaderId, ProcessSequenceLineId = L.ProcessSequenceLineId, ProcessId = L.ProcessId, ProcessName = ProcessTab.ProcessName, Sequence = L.Sequence, CreatedBy = L.CreatedBy, CreatedDate = L.CreatedDate, ModifiedBy = L.ModifiedBy, ModifiedDate = L.ModifiedDate, }).FirstOrDefault()); }
public void Process(string templateName, string fileName, string measured, float operatorValue, float inspectorValue, float sigma) { // first read document in as stream byte[] original = File.ReadAllBytes(templateName); string[] switches = new string[] {}; var template = GetReport(1); Populate(template); using (var stream = new MemoryStream()) { stream.Write(original, 0, original.Length); using (var docx = WordprocessingDocument.Open(stream, true)) { ConvertFieldCodes(docx.MainDocumentPart.Document); foreach (var detail in template.Charts) { var fieldName = (detail.DetailName.ToUpper().StartsWith("CRT") ? detail.DetailName: "CRT_" + detail.DetailName); var dcInfo = BaseProcess.GetColumnInfo(fieldName); if (!GetTableName(template, dcInfo)) { continue; } if (dcInfo.FieldType == FieldType.Chart) { ProcessChart.Process(docx, dcInfo, detail, detail.DetailName); } } foreach (var field in docx.MainDocumentPart.Document.Descendants <SimpleField>()) { var fieldname = BaseProcess.GetFieldName(field, out switches); if (string.IsNullOrEmpty(fieldname)) { continue; } var dcInfo = BaseProcess.GetColumnInfo(fieldname); if (dcInfo.FieldType == FieldType.Chart) { continue; } if (dcInfo.FieldType == FieldType.Table) { if (!GetTableName(template, dcInfo)) { continue; } var table = template.DataSet.Tables[dcInfo.TableNameInDb]; if (dcInfo.FieldType == FieldType.Table) { ProcessTable.Process(docx, dcInfo, table, field, fieldname); } } else if (dcInfo.FieldType == FieldType.Image) { ProcessImage.ShowIndicator(docx, field, measured, operatorValue, inspectorValue, sigma); } } ProcessTable.RemoveEmptyTables(docx); docx.MainDocumentPart.Document.Save(); } stream.Seek(0, SeekOrigin.Begin); byte[] data = stream.ToArray(); File.WriteAllBytes(fileName, data); } }
public IQueryable <FinishedProductPrevProcess> FGetFinishedProductPrevProcess(int ProductId, int ProcessId) { int Sequence = (from L in db.ProcessSequenceLine where L.ProcessSequenceHeaderId == (from P in db.FinishedProduct where P.ProductId == ProductId select new { ProcessSequenceHeaderId = P.ProcessSequenceHeaderId }).FirstOrDefault().ProcessSequenceHeaderId && L.ProcessId == ProcessId select new { Sequence = L.Sequence }).FirstOrDefault().Sequence; IQueryable <FinishedProductPrevProcess> FinishedProductprevprocess = (from P in db.FinishedProduct join Ps in db.ProcessSequenceLine on P.ProcessSequenceHeaderId equals Ps.ProcessSequenceHeaderId into ProcessSequenceLineTable from ProcessSequenceLineTab in ProcessSequenceLineTable.DefaultIfEmpty() join Pr in db.Process on ProcessSequenceLineTab.ProcessId equals Pr.ProcessId into ProcessTable from ProcessTab in ProcessTable.DefaultIfEmpty() where P.ProductId == ProductId && ProcessSequenceLineTab.Sequence == Sequence select new FinishedProductPrevProcess { ProductId = P.ProductId, PrevProcessId = ProcessSequenceLineTab.ProcessId, PrevProcessName = ProcessTab.ProcessName }); return(FinishedProductprevprocess); }