Exemplo n.º 1
0
        public Selection GetIRobotMotion(Form FM, DataType.Dsystem DSystem, int SelectType = 9, string Mess = "请选择一个机器人")
        {
            FM.WindowState = FormWindowState.Minimized;
            INFITF.Application CatApplication = DSystem.DSApplication;
            Selection          USelect        = null;

            try
            {
                ProcessDocument PPRP = DSystem.DSActiveDocument;
                if (PPRP == null)
                {
                    USelect = DSystem.CDSActiveDocument.Selection;
                }
                else
                {
                    USelect = PPRP.Selection;
                }
            }
            catch (Exception)
            {
            }
            USelect.Clear();
            var Result = USelect.SelectElement2(DataType.InputObjectType(SelectType), Mess, true);

            if (Result == "Cancel")
            {
                return(null);
            }
            if (USelect.Count < 1)
            {
                MessageBox.Show("请先选择对象后再点此命令!");
                return(null);
            }
            return(USelect);
        }
        public Message addUpdateProcessDocument(ProcessDocument processDocument)
        {
            Message msg = null;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                msg = new Message();
                connection.Open();
                SqlCommand command = new SqlCommand(Helper.sp_CreateUpdateProcessDocuments, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Id", processDocument.Id);
                command.Parameters.AddWithValue("@StudentId", processDocument.StudentId);
                command.Parameters.AddWithValue("@Application", processDocument.Application);
                command.Parameters.AddWithValue("@Status", processDocument.Status);
                command.Parameters.AddWithValue("@Notes", processDocument.Notes);
                command.Parameters.AddWithValue("@CreatedBy", processDocument.CreateBy);
                command.Parameters.AddWithValue("@UpdatedBy", processDocument.UpdatedBy);
                command.Parameters.AddWithValue("@CreatedDate", processDocument.CreatedDate);
                command.Parameters.AddWithValue("@UpdatedDate", processDocument.UpdatedDate);



                msg.status = command.ExecuteNonQuery();
            }

            return(msg);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delmia 在仿真示教模式下使用
        /// </summary>
        /// <param name="FM"></param>
        /// <param name="DSystem"></param>
        /// <returns></returns>
        public Selection GetInitTargetProduct(Form FM, DataType.Dsystem DSystem, int dType = 9, string Msg = "请选择初始化对象")
        {
            FM.WindowState = FormWindowState.Minimized;
            ProcessDocument PPRP    = DSystem.DSActiveDocument;
            Selection       USelect = null;

            if (PPRP == null)
            {
                return(null);
            }
            USelect = PPRP.Selection;
            USelect.Clear();
            var Result = USelect.SelectElement2(DataType.InputObjectType(dType), Msg, true);

            if (Result == "Cancel")
            {
                return(null);
            }
            if (USelect.Count < 1)
            {
                MessageBox.Show("请先选择对象后再点此命令!");
                return(null);
            }
            return(USelect);
        }
Exemplo n.º 4
0
        //-------------------------------------------
        //Method : GetDocument
        //-------------------------------------------
        /// <summary>
        /// GetDocument
        /// </summary>
        internal void GetDocument()
        {
            DocumentDetails     = null;
            IsSuccessful        = false;
            DocumentServiceType = DocumentServiceType.NONE;


            //check for Input
            if (!ValidateInput())
            {
                IsSuccessful = false;
                return;
            }


            try
            {
                if (DocumentServiceType == DocumentServiceType.NONE)
                {
                    ErrorMessage = "Invalid Document Service Type";
                }
                else
                {
                    //process document request
                    ProcessDocument.Start(DocumentServiceType, this);
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
            }
        }
Exemplo n.º 5
0
        public BaseApiResponse SaveDocument(int UserId, ProcessDocument ProcessDocumentObj)
        {
            var response = new BaseApiResponse();

            try
            {
                object[] paramList =
                {
                    new SqlParameter("DocumentId", (object)ProcessDocumentObj.DocumentId ?? (object)DBNull.Value)
                    ,                              new SqlParameter("ProcessId", (object)ProcessDocumentObj.ProcessId ?? (object)DBNull.Value)
                    ,                              new SqlParameter("SubProcessId", (object)ProcessDocumentObj.SubProcessId ?? (object)DBNull.Value)
                    ,                              new SqlParameter("RegionId", (object)ProcessDocumentObj.RegionId ?? (object)DBNull.Value)
                    ,                              new SqlParameter("DocumentCode", (object)ProcessDocumentObj.DocumentCode ?? (object)DBNull.Value)
                    ,                              new SqlParameter("DocumentTitle", (object)ProcessDocumentObj.DocumentTitle ?? (object)DBNull.Value)
                    ,                              new SqlParameter("DocumentPath", (object)ProcessDocumentObj.DocumentPath ?? (object)DBNull.Value)
                    ,                              new SqlParameter("ReleaseDate", (object)ProcessDocumentObj.ReleaseDate ?? (object)DBNull.Value)
                    ,                              new SqlParameter("IsActive", (object)ProcessDocumentObj.IsActive ?? (object)DBNull.Value)
                    ,                              new SqlParameter("DisplayOrder", (object)ProcessDocumentObj.DisplayOrder ?? (object)DBNull.Value)
                    ,                              new SqlParameter("UserId", (object)UserId ?? (object)DBNull.Value)
                };

                var result = _repository.ExecuteSQL <int>("AddOrUpdateDocument", paramList).FirstOrDefault();
                response.Success = (result > 0);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                response.Message.Add(ex.Message);
            }

            return(response);
        }
Exemplo n.º 6
0
        public void ProcessDocumentTestInvalidData()
        {
            Console.WriteLine("ProcessDocumentTestInvalidData");
            string xml = "</////trtgrg xml version=\"1.0\"?><doc></doc>";

            Assert.Throws <XmlException>(() => ProcessDocument.GetProcess(xml, "XML"));
        }
Exemplo n.º 7
0
        public ActionResult ExportToCSV()
        {
            var objProcessDocument = new ProcessDocument <landingPage>();

            objProcessDocument.ExportToCsv(landingPageRepositiry.getData().ToList(), out string outputString, HttpContext);

            return(Content(""));
        }
Exemplo n.º 8
0
        public void ProcessTest()
        {
            Console.WriteLine("ProcessTest");
            string xml  = "<?xml version=\"1.0\"?><doc></doc>";
            string type = "XML";

            Assert.IsNotNull(ProcessDocument.GetProcess(xml, type));
        }
Exemplo n.º 9
0
        public ActionResult DeleteAssociatedDocumentsConfirmed(int id)
        {
            ProcessDocument pdoc      = db.ProcessDocuments.Find(id);
            int             processID = pdoc.processID;

            db.ProcessDocuments.Remove(pdoc);
            db.SaveChanges();
            return(RedirectToAction("Edit", new { id = processID }));
        }
Exemplo n.º 10
0
        public void ProcessDocumentTestXMLReturnsTypeOfNode()
        {
            Console.WriteLine("ProcessDocumentTestXMLReturnsTypeOfNode");
            string          xml  = "<?xml version=\"1.0\"?><doc></doc>";
            string          type = "XML";
            ProcessDocument pro  = ProcessDocument.GetProcess(xml, type);

            Assert.AreEqual(typeof(Node), pro.Process().GetType());
        }
Exemplo n.º 11
0
        public void ProcessDocumentTestJSONReturnsTypeOfNode()
        {
            Console.WriteLine("ProcessDocumentTestJSONReturnsTypeOfNode");
            string          json = "{ 'name':'jones'}";
            string          type = "JSON";
            ProcessDocument pro  = ProcessDocument.GetProcess(json, type);

            Assert.AreEqual(typeof(Node), pro.ProcessParallel().GetType());
        }
Exemplo n.º 12
0
 public QueueController(
     ILogger <QueueController> logger,
     ProcessDocument processDocument,
     IBackgroundJobClient backgroundJobs)
 {
     _logger          = logger;
     _processDocument = processDocument;
     _backgroundJobs  = backgroundJobs;
 }
Exemplo n.º 13
0
        public ActionResult AssociatedDocuments(int id)
        {
            ProcessDocument model = new ProcessDocument();

            model.processID = id;
            int?companyID = db.Users.Find(WebSecurity.CurrentUserId).companyID;

            ViewBag.documentID = new SelectList(db.Documents.Where(d => d.companyID == companyID), "ID", "title");
            return(View(model));
        }
Exemplo n.º 14
0
        public ActionResult DeleteAssociatedDocuments(int id = 0)
        {
            ProcessDocument process = db.ProcessDocuments.Find(id);

            if (process == null)
            {
                return(HttpNotFound());
            }
            return(View(process));
        }
Exemplo n.º 15
0
 public ProcessDocumentTest()
 {
     _fileManager       = A.Fake <FileManager>();
     _extractionManager = A.Fake <ExtractionManager>();
     _callback          = A.Fake <Callback>();
     _processDocument   = new ProcessDocument(_fileManager, _extractionManager, _callback);
     _newFileToProcess  = new NewFileToProcess {
         Url = string.Empty
     };
 }
Exemplo n.º 16
0
        public void OutputTest()
        {
            Console.WriteLine("OutputTest");
            string          xml     = "<?xml version=\"1.0\"?><doc></doc>";
            string          type    = "XML";
            ProcessDocument process = ProcessDocument.GetProcess(xml, type);
            Node            n       = process.Process();
            Output          output  = new Output(n);

            Assert.IsNotNull(output);
            Assert.AreEqual(typeof(Output), output.GetType());
        }
Exemplo n.º 17
0
        public void CreateGridTest()
        {
            Console.WriteLine("CreateGridTest");
            JObject expected = JObject.Parse("{\"text\":\"doc\",\"id\":1,\"state\":{\"selected\":true}}");
            string  xml      = "<?xml version=\"1.0\"?><doc></doc>";
            string  type     = "XML";

            ProcessDocument process = ProcessDocument.GetProcess(xml, type);
            Node            n       = process.Process();
            Output          output  = new Output(n);

            Assert.AreEqual(expected, output.CreateGrid());
        }
Exemplo n.º 18
0
        public override void ExecuteResult(ControllerContext context)
        {
            List <Customer> list = new List <Customer>
            {
                new Customer {
                    ID            = 1,
                    Name          = "Rishab",
                    ContactNumber = "576-634-2781",
                    Address       = "877-7502 Venenatis Av.",
                    Country       = "Sao Tome and Principe",
                    Email         = "*****@*****.**"
                },
                new Customer {
                    ID            = 2,
                    Name          = "Shellie",
                    ContactNumber = "264-859-6466",
                    Address       = "Ap #783-3534 Mollis St.",
                    Country       = "Papua New Guinea",
                    Email         = "*****@*****.**"
                },
                new Customer {
                    ID            = 3,
                    Name          = "Jameson",
                    ContactNumber = "832-637-6796",
                    Address       = "254-9752 Feugiat Avenue",
                    Country       = "Italy",
                    Email         = "*****@*****.**"
                },
                new Customer {
                    ID            = 4,
                    Name          = "Odette",
                    ContactNumber = "408-328-0174",
                    Address       = "8765 Est. Road",
                    Country       = "Antigua and Barbuda",
                    Email         = "*****@*****.**"
                },
                new Customer {
                    ID            = 5,
                    Name          = "Carlos",
                    ContactNumber = "572-378-2718",
                    Address       = "8365 Sodales Rd.",
                    Country       = "Guyana",
                    Email         = "*****@*****.**"
                },
            };

            ProcessDocument <Customer> objProcessDocument = new ProcessDocument <Customer>();
            string outputString = string.Empty;

            objProcessDocument.ExportToCsv(list, out outputString, context.HttpContext);
        }
Exemplo n.º 19
0
        public static void CloneDocument(string FileName, string NewFileName, ProcessDocument ProcessDocumentIn)
        {
            try
            {

                File.Copy(FileName, NewFileName);

                object o = Missing.Value;
                object oFalse = false;
                object oTrue = true;

                Word._Application app = null;
                Word.Documents docs = null;
                Word.Document doc = null;

                object path = NewFileName;

                try
                {
                    app = new Word.Application();
                    app.Visible = false;
                    app.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone;

                    docs = app.Documents;
                    doc = docs.Open(ref path, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o);
                    doc.Activate();

                    ProcessDocumentIn(ref doc);

                    doc.Save();
                    ((Word._Document)doc).Close(ref o, ref o, ref o);
                    app.Quit(ref o, ref o, ref o);
                }
                finally
                {
                    if (doc != null)
                        Marshal.FinalReleaseComObject(doc);

                    if (docs != null)
                        Marshal.FinalReleaseComObject(docs);

                    if (app != null)
                        Marshal.FinalReleaseComObject(app);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 20
0
        public void CreateViewTest()
        {
            Console.WriteLine("CreateViewTest");
            string expected = "<div class='text-center ui-layout-center ui-layout-pane ui-layout-pane-center'><div style ='display:inline-block' class='ui-selectable ui-droppable'><div id='1'class='node type ui-draggable ui-selectee' style='left:100px; top:130px;'><div class='head'><span><button class='nameBtn' onclick='GetNode(1)'>doc</button></span></div></div></div></div></div>";
            string xml      = "<?xml version=\"1.0\"?><doc></doc>";
            string type     = "XML";

            ProcessDocument process = ProcessDocument.GetProcess(xml, type);
            Node            n       = process.Process();
            Output          output  = new Output(n);

            Console.WriteLine(expected);
            Console.WriteLine(output.CreateView());
            Assert.AreEqual(expected, output.CreateView());
        }
 protected async Task DownloadDocument()
 {
     status = $"Calling Download";
     if (root != null)
     {
         ProcessDocument processDocument = new ProcessDocument();
         MemoryStream    stream          = processDocument.GenerateDocument(root);
         status = $"Loaded Stream {stream.Length}";
         await FileUtil.SaveAs(jSRuntime, "Document.Docx", stream.ToArray());
     }
     else
     {
         status = $"Root is null ";
     }
 }
Exemplo n.º 22
0
        public void TestingCorrectXML()
        {
            Console.WriteLine("TestingCorrectXML");
            string          xml     = "<?xml version=\"1.0\"?><doc></doc>";
            string          type    = "XML";
            ProcessDocument process = ProcessDocument.GetProcess(xml, type);
            Node            test    = new Node();

            test.Name    = "doc";
            test.Number  = 1;
            test.Visited = true;
            Node n = process.ProcessParallel();

            Assert.AreEqual(test.Value, n.Value);
            Assert.AreEqual(test.Name, n.Name);
            Assert.AreEqual(test.Children.Count, n.Children.Count);
            Assert.AreEqual(test.Visited, n.Visited);
        }
Exemplo n.º 23
0
        public void TestingSingleThreadAndMultiThreadSimularity(string json)
        {
            Console.WriteLine("TestingSingleThreadAndMultiThreadSimularity");
            string          type    = "JSON";
            ProcessDocument process = ProcessDocument.GetProcess(json, type);

            Console.WriteLine(process);

            Node n = process.Process();

            process = ProcessDocument.GetProcess(json, type);
            Node n2 = process.ProcessParallel();

            Console.WriteLine(process);

            Assert.AreEqual(n2.Value, n.Value);
            Assert.AreEqual(n2.Name, n.Name);
            Assert.AreEqual(n2.Children.Count, n.Children.Count);
            Assert.AreEqual(n2.Visited, n.Visited);
        }
Exemplo n.º 24
0
        public void TestingCorrectJSON()
        {
            Console.WriteLine("TestingCorrectJSON");
            string          json    = "{ 'name':'jones'}";
            string          type    = "JSON";
            ProcessDocument process = ProcessDocument.GetProcess(json, type);

            Node root = new Node();

            root.Name    = "name";
            root.Number  = 1;
            root.Visited = true;
            root.Value   = "jones";

            Node n = process.ProcessParallel();

            Assert.AreEqual(root.Value, n.Value);
            Assert.AreEqual(root.Name, n.Name);
            Assert.AreEqual(root.Visited, n.Visited);
        }
Exemplo n.º 25
0
        public ActionResult EditAssociatedDocument(ProcessDocument model, bool isUnlinked)
        {
            if (ModelState.IsValid)
            {
                if (isUnlinked)
                {
                    model.documentID = null;
                }
                else
                {
                    model.text = null;
                }
                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Edit", new { id = model.processID }));
            }
            int?companyID = db.Users.Find(WebSecurity.CurrentUserId).companyID;

            ViewBag.documentID = new SelectList(db.Documents.Where(d => d.companyID == companyID), "ID", "title");

            return(View(model));
        }
Exemplo n.º 26
0
        public async Task <Model.Process.Process> GetByTypeAsync(int processTypeId, string userId)
        {
            Model.Process.Process process = new Model.Process.Process();

            var user = await this.UserManager.FindByIdAsync(userId);

            Model.ProcessType.ProcessType type = this.ProcessTypeService.GetById(processTypeId);
            process.Type = type;

            List <ProcessField> fields = new List <ProcessField>();

            foreach (ProcessTypeField ptField in type.Fields)
            {
                object       value    = null;
                PropertyInfo property = user.GetType().GetProperty(ptField.Type.ToString());
                if (property != null)
                {
                    value = property.GetValue(user);

                    switch (ptField.Type)
                    {
                    case FieldType.Date:
                    case FieldType.BirthDate:
                        value = ((DateTime)value).ToString(@"dd\/MM\/yyyy");
                        break;

                    case FieldType.Gender:
                        value = EnumHelper <Gender> .GetDisplayValue((Gender)Enum.Parse(typeof(Gender), value.ToString()));

                        break;

                    case FieldType.MaritalStatus:
                        value = EnumHelper <MaritalStatus> .GetDisplayValue((MaritalStatus)Enum.Parse(typeof(MaritalStatus), value.ToString()));

                        break;

                    case FieldType.Country:
                        value = user.CountryId.HasValue ? this.CountryService.GetById(user.CountryId.Value).Name : null;
                        break;

                    default:
                        break;
                    }
                }

                ProcessField field = new ProcessField
                {
                    Name       = ptField.Name,
                    IsRequired = ptField.IsRequired,
                    Type       = ptField.Type,
                    Value      = (value == null ? string.Empty : value.ToString())
                };

                fields.Add(field);
            }

            process.Fields = fields;

            List <ProcessDocument> documents = new List <ProcessDocument>();

            foreach (ProcessTypeDocument ptDocument in type.Documents)
            {
                ProcessDocument document = new ProcessDocument
                {
                    Name        = ptDocument.Name,
                    IsRequired  = ptDocument.IsRequired,
                    IsAvailable = false
                };

                documents.Add(document);
            }

            process.Documents = documents;

            return(process);
        }
Exemplo n.º 27
0
 public ProcessController(ProcessDocument processDocument,
                          IBackgroundJobClient backgroundJobs)
 {
     _processDocument = processDocument;
     _backgroundJobs  = backgroundJobs;
 }
Exemplo n.º 28
0
 public Message addUpdateProcessDocument(ProcessDocument processDocument)
 {
     return(_backOfficeRepository.addUpdateProcessDocument(processDocument));
 }
Exemplo n.º 29
0
        /// <summary>
        /// Handles a POST request.
        /// </summary>
        /// <param name="req">The request to be processed.</param>
        /// <returns>A Response object to send to the user</returns>
        private Response HandlePost(HttpListenerRequest req)
        {
            JObject eRes = new JObject();

            if (SegmentNormalize(req.RawUrl).Equals("Process"))
            {
                if (req.HasEntityBody)
                {
                    Request r = null;
                    try
                    {
                        r = GetData(req);
                        if (r == null)
                        {
                            return(Response.GetInvalidRequestResponse());
                        }
                    }
                    catch
                    {
                        return(Response.GetInvalidRequestResponse());
                    }



                    try
                    {
                        Validation.GetInstance().CheckDocument(r.Data, r.Type);
                    }
                    catch (Exception e)
                    {
                        eRes.Add("Error", e.Message);
                        return(Response.GetErrorResponse(eRes.ToString()));
                    }

                    string          id  = Guid.NewGuid().ToString();
                    ProcessDocument pro = ProcessDocument.GetProcess(r.Data, r.Type);
                    Node            n   = pro.ProcessParallel();
                    Output          o   = new Output(n); //new output object
                    try
                    {
                        CacheManager.GetInstance().saveFile(id, JsonConvert.SerializeObject(n));
                        JObject response = new JObject();

                        n = null; //remove node as its completed;

                        response.Add("filename", id);
                        response.Add("grid", o.CreateGrid());
                        response.Add("view", o.CreateView());



                        byte[] bytes = Encoding.UTF8.GetBytes(response.ToString());
                        return(Response.GetResponse(200, "application/json", bytes));
                    }
                    catch (Exception e)
                    {
                        Logger.GetInstance().WriteError(e.Message);
                        eRes.Add("Error", "Error Creating Response");
                        return(Response.GetErrorResponse(eRes.ToString()));
                    }
                }
                eRes.Add("Error", "No File Recieved By Server");
                return(Response.GetErrorResponse(eRes.ToString()));
            }
            else if (req.RawUrl.Equals("/Output"))
            {
                return(Response.GetInvalidRequestResponse());
            }
            else
            {
                return(Response.GetInvalidRequestResponse());
            }
        }
Exemplo n.º 30
0
 public BaseApiResponse SaveDocument(int UserId, ProcessDocument ProcessDocumentObj)
 {
     return(this._iSubProcessService.SaveDocument(UserId, ProcessDocumentObj));
 }
Exemplo n.º 31
0
 public void ProcessTestNull()
 {
     Console.WriteLine("ProcessTestNull");
     Assert.Throws <ArgumentException>(() => ProcessDocument.GetProcess(null, null));
 }