public static ProcessParameterArray GetSomeProcessParams(string url, string sessionid)
        {
            Guid   g      = Guid.NewGuid();
            string suffix = g.ToString().Replace('-', '_');
            ProcessParameterArray parameters = new ProcessParameterArray();
            ProcessParameter      param1     = new ProcessParameter(
                Name: "Batch" + suffix,
                Description: "a description",
                ContextLabel: "top",
                OutlineParameterName: "batch",
                DisplayUnit: null,
                Mandatory: true
                );
            ProcessParameter param2 = new ProcessParameter(
                Name: "Conc" + suffix,
                Description: "a description",
                ContextLabel: "top",
                OutlineParameterName: "conc",
                DisplayUnit: null,
                Mandatory: true
                );

            parameters.Add(param1);
            parameters.Add(param2);
            return(parameters);
        }
Exemple #2
0
        public override void BeforeSave()
        {
            string metaKey = "anchors," + m_End.Name + "," + m_StartPort + "," + m_EndPort;

            StringBuilder anchors = new StringBuilder();

            for (int i = 0; i < m_Anchors.Count; i++)
            {
                Anchor a = m_Anchors[i];
                if (i > 0)
                {
                    anchors.Append(";");
                }
                anchors.Append(a.Origin.X.ToString());
                anchors.Append("," + a.Origin.Y.ToString());
                anchors.Append("," + a.Angle.ToString("0.####", GEF.CultureInfo));
                anchors.Append("," + a.InputLength.ToString("0.####", GEF.CultureInfo));
                anchors.Append("," + a.OutputLength.ToString("0.####", GEF.CultureInfo));
            }

            string result = anchors.ToString();

            m_Start.Base.Meta[metaKey] = result;

            string value = "";

            if (m_Start.Base is Node)
            {
                value = "$" + m_Start.Name + "[\"" + m_StartPort + "\"]";
            }
            else if (m_Start.Base is Variable)
            {
                value = "$" + m_Start.Name;
            }


            if (m_Start.Base is Node && m_StartPort == "")
            {
                Node nStart = m_Start.Base as Node;
                if (!nStart.FindNextNode(m_End.Name))
                {
                    nStart.NewNextNode(m_End.Name);
                }
            }

            if (m_End.Base is Node && m_EndPort != "")
            {
                Node nEnd = m_End.Base as Node;
                nEnd.NewParameter(m_EndPort);
                ProcessParameter p = nEnd.FindParameter(m_EndPort);
                p.Value = value;
            }

            if (m_End.Base is Variable)
            {
                Node nStart = m_Start.Base as Node;
                nStart.Function += "$" + m_End.Name + " = " + value + ";\n";
            }
        }
Exemple #3
0
        public ProcessForm(ProcessParameter parm)
        {
            InitializeComponent();

            Text            = Properties.strings.str009;
            buttonStop.Text = Properties.strings.str010;

            _parm                              = parm;
            _worker.DoWork                    += worker_DoWork;
            _worker.RunWorkerCompleted        += worker_RunWorkerCompleted;
            _worker.WorkerSupportsCancellation = true;
            buttonStop.Enabled                 = false;
        }
        //public override string FormatSelect(string selectedPropertiesSql, string fromSql, string whereSql, string orderBySql, string groupBySql, string havingSql, int topSelectedRecords)
        //{
        //    return base.FormatSelect(selectedPropertiesSql, fromSql, whereSql, orderBySql, groupBySql, havingSql, topSelectedRecords);
        //}

        //public override string FormatSelect(string selectedPropertiesSql, string fromSql, string whereSql, string orderBySql, string groupBySql, string havingSql, int skipSelectedRecords, int topSelectedRecords)
        //{
        //    return base.FormatSelect(selectedPropertiesSql, fromSql, whereSql, orderBySql, groupBySql, havingSql, skipSelectedRecords, topSelectedRecords);
        //}

        public override string FormatFunction(ProcessParameter processParameter, FunctionOperatorType operatorType, params object[] operands)
        {
            switch (operatorType)
            {
            case FunctionOperatorType.StartsWith:
            case FunctionOperatorType.Contains:
                var secondOperand = operands[1];
                if (((OperandValue)secondOperand)?.Value is string)
                {
                    var operandString = (string)((OperandValue)secondOperand).Value;
                    var prefix        = operatorType == FunctionOperatorType.Contains ? "%" : "";
                    return(string.Format(CultureInfo.InvariantCulture, "({0} ilike {1})", processParameter(operands[0]), processParameter(new ConstantValue($"{prefix}{operandString}%"))));;
                }
                break;
            }
            return(base.FormatFunction(processParameter, operatorType, operands));
        }
Exemple #5
0
        private void buttonProcess_Click(object sender, EventArgs e)
        {
            ProcessParameter parm = new ProcessParameter();

            parm.DistPath    = textDistPath.Text;
            parm.UseFromDate = checkDateFrom.Checked;
            parm.UseToDate   = checkDateTo.Checked;
            parm.FromDate    = dateFromTimePicker.Value;
            parm.ToDate      = dateToTimePicker.Value;
            parm.FileIgnore  = checkIgnore.Checked;
            foreach (var s in listBoxSource.Items)
            {
                parm.SrcPath.Add((string)s);
            }
            ProcessForm process = new ProcessForm(parm);

            process.ShowDialog(this);
        }
Exemple #6
0
        public MainViewModel()
        {
            PlayTestMovieCommand =
                TestMovieSourcePath.Select(x => File.Exists(x))
                .CombineLatest(CurrentFrame.Select(x => x == 0), (a, b) => a & b)
                .ToReactiveCommand(false);

            PlayTestMovieCommand.Subscribe(async _ => await playTestMovie(TestMovieSourcePath.Value));

            var param = new ProcessParameter();

            ProcessParameters.Add(param);
            ProcessParameters.Add(new ProcessParameter());
            ProcessParameters.Add(new ProcessParameter());
            ProcessParam.Value = param;

            PlayTestMovieCommand.Execute();
        }
        // vinay bhatt window id

        /// <summary>
        /// Excecute Process
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="AD_Process_ID"></param>
        /// <param name="Name"></param>
        /// <param name="AD_Table_ID"></param>
        /// <param name="Record_ID"></param>
        /// <param name="WindowNo"></param>
        /// <param name="fileType"></param>
        /// <param name="AD_Window_ID"></param>
        /// <returns></returns>
        internal static ProcessReportInfo Process(Ctx ctx, Dictionary <string, string> processInfo)
        {
            ProcessReportInfo ret      = new ProcessReportInfo();
            MPInstance        instance = null;

            try
            {
                instance = new MPInstance(ctx, Util.GetValueOfInt(processInfo["Process_ID"]), Util.GetValueOfInt(processInfo["Record_ID"]));
            }
            catch (Exception e)
            {
                ret.IsError = true;
                ret.Message = e.Message;
                return(ret);
            }

            if (!instance.Save())
            {
                ret.IsError = true;
                ret.Message = Msg.GetMsg(ctx, "ProcessNoInstance");
                return(ret);
            }
            ret.AD_PInstance_ID = instance.GetAD_PInstance_ID();

            //	Get Parameters (Dialog)
            //Check If Contaon Parameter

            List <GridField> fields = ProcessParameter.GetParametersList(ctx, Util.GetValueOfInt(processInfo["Process_ID"]), Util.GetValueOfInt(processInfo["WindowNo"]));

            if (fields.Count < 1) //no Parameter
            {
                processInfo["AD_PInstance_ID"] = ret.AD_PInstance_ID.ToString();
                ret = ExecuteProcessCommon(ctx, processInfo, null);
            }
            else
            {
                ret.ShowParameter = true;
                ret.ProcessFields = fields;
            }
            return(ret);
        }
        internal static ProcessReportInfo Process(Ctx ctx, int AD_Process_ID, string Name, int AD_Table_ID, int Record_ID, int WindowNo, bool csv, bool pdf)
        {
            ProcessReportInfo ret      = new ProcessReportInfo();
            MPInstance        instance = null;

            try
            {
                instance = new MPInstance(ctx, AD_Process_ID, Record_ID);
            }
            catch (Exception e)
            {
                ret.IsError = true;
                ret.Message = e.Message;
                return(ret);
            }

            if (!instance.Save())
            {
                ret.IsError = true;
                ret.Message = Msg.GetMsg(ctx, "ProcessNoInstance");
                return(ret);
            }
            ret.AD_PInstance_ID = instance.GetAD_PInstance_ID();

            //	Get Parameters (Dialog)
            //Check If Contaon Parameter

            List <GridField> fields = ProcessParameter.GetParametersList(ctx, AD_Process_ID, WindowNo);

            if (fields.Count < 1) //no Parameter
            {
                ret = ExecuteProcess(ctx, AD_Process_ID, Name, ret.AD_PInstance_ID, AD_Table_ID, Record_ID, null, csv, pdf);
            }
            else
            {
                ret.ShowParameter = true;
                ret.ProcessFields = fields;
            }
            return(ret);
        }
Exemple #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="processServiceURL">Url</param>
 /// <param name="dataIn">Data to send</param>
 public ProcessManager(string processServiceURL, IProcessParameter <TDataIn> dataIn) : base()
 {
     ProcessServiceURL = processServiceURL;
     DataIn            = dataIn.DirectCastSafe <ProcessParameter <TDataIn> >();
     Serializer.KnownTypes.Add(dataIn.GetType());
 }
Exemple #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="processServiceURL">Url</param>
 /// <param name="context">Context of user, device and app</param>
 /// <param name="dataIn">Data to send</param>
 public ProcessManager(string processServiceURL, SessionContext context, TDataIn dataIn) : base()
 {
     ProcessServiceURL = processServiceURL;
     DataIn            = new ProcessParameter <TDataIn>(context, dataIn);
     Serializer.KnownTypes.Add(dataIn.GetType());
 }
Exemple #11
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            Logger tlog = LogManager.GetCurrentClassLogger();

            tlog.Trace("Start thread.");
            long fileCount     = 0;
            long fileCountCopy = 0;

            try
            {
                ProcessParameter tparm = e.Argument as ProcessParameter;
                if (tparm == null)
                {
                    throw new ArgumentNullException("Parameter ist null.");
                }
                BackgroundWorker tworker = sender as BackgroundWorker;

                List <string> createdFolder = new List <string>();

                foreach (var src in tparm.SrcPath)
                {
                    if (tworker.CancellationPending)
                    {
                        e.Cancel = true;
                        throw new Exception("Cancel request detected.");
                    }
                    Invoke((Action <string>)JournalAddInfo, $"Process folder {src}");

                    foreach (string file in Directory.EnumerateFiles(src, "*.*", SearchOption.AllDirectories))
                    {
                        tlog.Trace($"Process file {file}");
                        FileInfo fi = new FileInfo(file);
                        fileCount++;

                        if (tparm.UseFromDate)
                        {
                            if (tparm.FromDate > fi.LastWriteTime)
                            {
                                tlog.Trace($"File {file} to old.");
                                continue;
                            }
                        }
                        if (tparm.UseToDate)
                        {
                            if (tparm.ToDate < fi.LastWriteTime)
                            {
                                tlog.Trace($"File {file} to jung.");
                                continue;
                            }
                        }

                        string year        = fi.LastWriteTime.ToString("yyyy");
                        string month       = fi.LastWriteTime.ToString("MM");
                        string yearFolder  = Path.Combine(tparm.DistPath, year);
                        string monthFolder = Path.Combine(yearFolder, month);

                        if (createdFolder.FirstOrDefault(x => x.Equals(yearFolder, StringComparison.OrdinalIgnoreCase)) == null)
                        {
                            if (!Directory.Exists(yearFolder))
                            {
                                tlog.Trace($"Create folder: {yearFolder}");
                                Directory.CreateDirectory(yearFolder);
                            }
                            createdFolder.Add(yearFolder);
                        }

                        if (createdFolder.FirstOrDefault(x => x.Equals(monthFolder, StringComparison.OrdinalIgnoreCase)) == null)
                        {
                            if (!Directory.Exists(monthFolder))
                            {
                                tlog.Trace($"Create folder: {monthFolder}");
                                Directory.CreateDirectory(monthFolder);
                            }
                            createdFolder.Add(monthFolder);
                        }

                        string copyFileName = Path.Combine(monthFolder, fi.Name);

                        if (File.Exists(copyFileName))
                        {
                            if (tparm.FileIgnore)
                            {
                                tlog.Trace($"Ignore {file} until file exists.");
                            }
                            else
                            {
                                int    count         = 1;
                                string fileName      = Path.GetFileNameWithoutExtension(copyFileName);
                                string copyFileName2 = Path.Combine(monthFolder, $"{fileName}-{count}{fi.Extension}");
                                while (File.Exists(copyFileName2))
                                {
                                    count++;
                                    if (count > 99)
                                    {
                                        throw new InvalidOperationException("Too many files count.");
                                    }
                                    copyFileName2 = Path.Combine(monthFolder, $"{fileName}-{count}{fi.Extension}");
                                }
                                File.Copy(file, copyFileName2);
                                string msg = $"{file} --> {copyFileName2}";
                                Invoke((Action <string>)JournalAddText, msg);
                                fileCountCopy++;
                            }
                        }
                        else
                        {
                            File.Copy(file, copyFileName);
                            string msg = $"{file} --> {copyFileName}";
                            Invoke((Action <string>)JournalAddText, msg);
                            fileCountCopy++;
                        }
                    }
                }
                Invoke((Action <string>)JournalAddText, $"Processed {fileCount} file(s).");
                Invoke((Action <string>)JournalAddText, $"Copy {fileCountCopy} file(s).");
            }
            catch (Exception ex)
            {
                tlog.Error(ex);
            }
            finally
            {
                tlog.Trace("End thread.");
            }
        }
        public static ProcessReportInfo GeneratePrint(Ctx ctx, int AD_Process_ID, string Name, int AD_Table_ID, int Record_ID, int WindowNo, bool csv)
        {
            ProcessReportInfo ret      = new ProcessReportInfo();
            MPInstance        instance = null;

            try
            {
                instance = new MPInstance(ctx, AD_Process_ID, Record_ID);
            }
            catch (Exception e)
            {
                ret.IsError = true;
                ret.Message = e.Message;
                return(ret);
            }

            if (!instance.Save())
            {
                ret.IsError = true;
                ret.Message = Msg.GetMsg(ctx, "ProcessNoInstance");
                return(ret);
            }
            ret.AD_PInstance_ID = instance.GetAD_PInstance_ID();

            List <GridField> fields = ProcessParameter.GetParametersList(ctx, AD_Process_ID, WindowNo);

            if (fields.Count < 1) //no Parameter
            {
                //ReportEngine_N re = null;

                string lang = ctx.GetAD_Language().Replace("_", "-");
                System.Globalization.CultureInfo original = System.Threading.Thread.CurrentThread.CurrentCulture;

                System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo(lang);
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lang);


                ////////log/////
                string clientName = ctx.GetAD_Org_Name() + "_" + ctx.GetAD_User_Name();
                string storedPath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "");
                storedPath += clientName;
                VLogMgt.Initialize(true, storedPath);
                ////////////////

                byte[] report      = null;
                string rptFilePath = null;
                // ProcessReportInfo rep = new ProcessReportInfo();
                try
                {
                    ProcessInfo pi = new ProcessInfo(Name, AD_Process_ID, AD_Table_ID, Record_ID);
                    pi.SetAD_User_ID(ctx.GetAD_User_ID());
                    pi.SetAD_Client_ID(ctx.GetAD_Client_ID());
                    pi.SetAD_PInstance_ID(ret.AD_PInstance_ID);

                    //report = null;
                    ProcessCtl ctl = new ProcessCtl();
                    ctl.SetIsPrintFormat(true);
                    ctl.IsArabicReportFromOutside = false;
                    ctl.SetIsPrintCsv(csv);
                    Dictionary <string, object> d = ctl.Process(pi, ctx, out report, out rptFilePath);
                    //rep = new ProcessReportInfo();
                    ret.ReportProcessInfo = d;
                    ret.Report            = report;
                    ret.ReportString      = ctl.ReportString;
                    ret.ReportFilePath    = rptFilePath;
                    ret.HTML         = ctl.GetRptHtml();
                    ret.IsRCReport   = ctl.IsRCReport();
                    ctl.ReportString = null;


                    //Env.GetCtx().Clear();
                }
                catch (Exception e)
                {
                    ret.IsError = true;
                    ret.Message = e.Message;
                }

                System.Threading.Thread.CurrentThread.CurrentCulture   = original;
                System.Threading.Thread.CurrentThread.CurrentUICulture = original;

                //return ret;
                //ret = ExecuteProcess(ctx, AD_Process_ID, Name, ret.AD_PInstance_ID, AD_Table_ID, Record_ID, null,true);
            }
            else
            {
                ret.ShowParameter = true;
                ret.ProcessFields = fields;
            }
            return(ret);
        }
 // Update is called once per frame
 void Update()
 {
     timeLeft -= Time.deltaTime;
     //when an animation is done
     if (timeLeft < 0)
     {
         //wait until the video rendering is done and rename it
         if (VideoCaptureCtrl.instance.status == VideoCaptureCtrl.StatusType.STARTED)
         {
             VideoCaptureCtrl.instance.StopCapture();
             while (VideoCaptureCtrl.instance.status != VideoCaptureCtrl.StatusType.FINISH)
             {
             }
             //wait one second for the video and audio files to merge
             //this number is arbitrary, feel free to experiment with the value here
             System.Threading.Thread.Sleep(1000);
             rename();
             clipCounter++;
         }
         //go to next animation if it exist
         if (clipCounter < clips.Length)
         {
             SwitchAnimation();
         }
         else
         {
             cameraCounter++;
             //go to next camera if it exist
             if (cameraCounter < cameras)
             {
                 clipCounter = 0;
                 //find the camera with the name DedicatedCapture numbered camera counter
                 GetComponentInParent <VideoCaptureCtrl>().videoCaptures[0] = GameObject.Find("DedicatedCapture (" + cameraCounter + ")").GetComponent <VideoCapture>();
                 SwitchAnimation();
             }
             else
             {
                 lightCounter++;
                 //go to next light if it exist
                 if (lightCounter < lights.Length)
                 {
                     clipCounter   = 0;
                     cameraCounter = 0;
                     GetComponentInParent <VideoCaptureCtrl>().videoCaptures[0] = GameObject.Find("DedicatedCapture").GetComponent <VideoCapture>();
                     Transform myTransform = GameObject.Find("Directional light").transform;
                     //add the difference in light values to the y rotational coordinate of the directional light
                     Vector3 rot = myTransform.rotation.eulerAngles;
                     rot = new Vector3(rot.x, rot.y + lights[lightCounter] - lights[lightCounter - 1], rot.z);
                     myTransform.rotation = Quaternion.Euler(rot);
                 }
                 else
                 {
                     characterCounter++;
                     //go to next character if it exist
                     if (characterCounter < characters.Count)
                     {
                         clipCounter   = 0;
                         cameraCounter = 0;
                         Transform myTransform = GameObject.Find("Directional light").transform;
                         Vector3   rot         = myTransform.rotation.eulerAngles;
                         rot                  = new Vector3(rot.x, rot.y + 360 - lights[lightCounter - 1], rot.z);
                         lightCounter         = 0;
                         myTransform.rotation = Quaternion.Euler(rot);
                         GetComponentInParent <VideoCaptureCtrl>().videoCaptures[0] = GameObject.Find("DedicatedCapture").GetComponent <VideoCapture>();
                         characters[characterCounter - 1].SetActive(false);
                         characters[characterCounter].SetActive(true);
                         Init(characterCounter);
                     }
                     else
                     {
                         //switch to the next scene if all combination is done for this scene
                         GameObject       handler = GameObject.Find("handler");
                         ProcessParameter pp      = handler.GetComponent <ProcessParameter>();
                         pp.finished = true;
                     }
                 }
             }
         }
     }
 }