Beispiel #1
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            Loader.Show();
            if (!string.IsNullOrEmpty(txtFilePath.Text))
            {
                Algo Algo = new Algo(txtFilePath.Text);
                Algo.Process();

                lblW.Text = Algo.AllProcess.GetText(Algo.Occurences.ToList());
                lblT_W.Text = Algo.T_W.GetText();
                lblT_I.Text = Algo.T_I.GetText();
                lblT_O.Text = Algo.T_O.GetText();
                lblX_W.Text = Algo.X_W.GetText();
                lblY_W.Text = Algo.Y_W.GetText();
                lblP_W.Text = Algo.GetP_W();
                lblF_W.Text = Algo.GetF_W();
                gridEvents.DataSource = Algo.GetEventsReport();
                gridTransition.DataSource = Algo.GetTransitionReport();
                gridTransition.Columns["TotalTime"].Visible = false;
                gridTransition.Columns["Occurance"].Visible = false;
            }
            else
            {
                MessageBox.Show("Please provide excel file");
            }
            Loader.Hide();
        }
Beispiel #2
0
        public static List <EventGridItem> GetEventsReport(this Algo algo)
        {
            var retVal = new List <EventGridItem>();

            foreach (var t in algo.T_W)
            {
                var obj = new EventGridItem {
                    Activity = t.EventName, Originators = string.Empty
                };
                var occurences = algo.Logs.Where(s => s.EventId == t.Id);
                int totalTime  = 0;
                int minTime    = int.MaxValue;
                int maxTime    = 0;
                foreach (var occurence in occurences)
                {
                    obj.Originators += obj.Originators.Contains(occurence.Employee.Name) ? "" : occurence.Employee.Name + ", ";
                    var time = (occurence.EndTime - occurence.StartTime).Milliseconds;
                    totalTime += time;
                    minTime    = minTime > time ? time : minTime;
                    maxTime    = maxTime < time ? time : maxTime;
                }
                obj.Originators = obj.Originators.Trim().TrimEnd(',');
                obj.MaxTime     = maxTime;
                obj.MinTime     = minTime;
                obj.AvgTime     = totalTime / occurences.Count();
                retVal.Add(obj);
            }
            return(retVal);
        }
Beispiel #3
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            Loader.Show();
            if (!string.IsNullOrEmpty(txtFilePath.Text))
            {
                Algo Algo = new Algo(txtFilePath.Text);
                Algo.Process();

                lblW.Text                 = Algo.AllProcess.GetText(Algo.Occurences.ToList());
                lblT_W.Text               = Algo.T_W.GetText();
                lblT_I.Text               = Algo.T_I.GetText();
                lblT_O.Text               = Algo.T_O.GetText();
                lblX_W.Text               = Algo.X_W.GetText();
                lblY_W.Text               = Algo.Y_W.GetText();
                lblP_W.Text               = Algo.GetP_W();
                lblF_W.Text               = Algo.GetF_W();
                gridEvents.DataSource     = Algo.GetEventsReport();
                gridTransition.DataSource = Algo.GetTransitionReport();
                gridTransition.Columns["TotalTime"].Visible = false;
                gridTransition.Columns["Occurance"].Visible = false;
            }
            else
            {
                MessageBox.Show("Please provide excel file");
            }
            Loader.Hide();
        }
Beispiel #4
0
        public static List <TransitionGridItem> GetTransitionReport(this Algo algo)
        {
            List <KeyValuePair <int, int> > dictTransitions  = new List <KeyValuePair <int, int> >();
            List <TransitionGridItem>       listTransactions = new List <TransitionGridItem>();

            foreach (var process in algo.AllProcess)
            {
                for (int i = 0; i < process.Count - 1; i++)
                {
                    var from      = process.ElementAt(i).EventId;
                    var to        = process.ElementAt(i + 1).EventId;
                    var fromEvent = algo.T_W.Where(t => t.Id == from).First();
                    var toEvent   = algo.T_W.Where(t => t.Id == to).First();

                    var time = (process.ElementAt(i + 1).StartTime - process.ElementAt(i).EndTime).Milliseconds;
                    var tran = new KeyValuePair <int, int>(from, to);
                    if (!dictTransitions.Contains(tran))
                    {
                        dictTransitions.Add(tran);
                        listTransactions.Add(new TransitionGridItem
                        {
                            From      = fromEvent.EventName,
                            To        = toEvent.EventName,
                            MaxTime   = time,
                            MinTime   = time,
                            Occurance = 1,
                            TotalTime = time
                        });
                    }
                    else
                    {
                        var objTran = listTransactions.Where(t => t.From == fromEvent.EventName && t.To == toEvent.EventName).First();
                        objTran.MaxTime    = objTran.MaxTime < time ? time : objTran.MaxTime;
                        objTran.MinTime    = objTran.MinTime > time ? time : objTran.MinTime;
                        objTran.TotalTime += time;
                        objTran.Occurance++;
                    }
                }
            }
            listTransactions.ForEach(t => t.AvgTime = t.TotalTime / t.Occurance);
            return(listTransactions);
        }
Beispiel #5
0
        public static string GetF_W(this Algo algo)
        {
            var pairs  = algo.Y_W;
            var retVal = " { ";

            foreach (var obj in algo.T_I)
            {
                retVal += "(i_W , " + obj.EventCode + " ), ";
            }
            foreach (var obj in pairs)
            {
                var pathText = " P({";
                foreach (var events in obj.Left)
                {
                    pathText += events.EventCode + (obj.Left.IndexOf(events) == obj.Left.Count() - 1 ? "" : ", ");
                }
                pathText += "},{";
                foreach (var events in obj.Right)
                {
                    pathText += events.EventCode + (obj.Right.IndexOf(events) == obj.Right.Count() - 1 ? "" : ", ");
                }
                pathText += "})";

                foreach (var events in obj.Left)
                {
                    retVal += "(" + events.EventCode + "," + pathText + "), ";
                }
                foreach (var events in obj.Right)
                {
                    retVal += "(" + pathText + ", " + events.EventCode + "), ";
                }
            }
            foreach (var obj in algo.T_O)
            {
                retVal += "( " + obj.EventCode + " , o_W ), ";
            }
            retVal = retVal.Trim().TrimEnd(',') + " } ";
            return(retVal);
        }
Beispiel #6
0
        public static string GetP_W(this Algo algo)
        {
            var pairs  = algo.Y_W;
            var retVal = " { i_W, o_W, ";

            foreach (var obj in pairs)
            {
                retVal += "P({";
                foreach (var events in obj.Left)
                {
                    retVal += events.EventCode + (obj.Left.IndexOf(events) == obj.Left.Count() - 1 ? "" : ", ");
                }
                retVal += "},{";
                foreach (var events in obj.Right)
                {
                    retVal += events.EventCode + (obj.Right.IndexOf(events) == obj.Right.Count() - 1 ? "" : ", ");
                }
                retVal += "})" + (pairs.IndexOf(obj) == pairs.Count() - 1 ? "" : ", ");
            }
            retVal += " } ";
            return(retVal);
        }