private HtmlTableRow AddChartsToCell(UserControlGraph ucg, HtmlTableRow row, int graphsInRow)
        {
            HtmlTableRow  newTRow = new HtmlTableRow();
            HtmlTableCell tCell   = null;

            if (row.Cells.Count < graphsInRow)
            {
                if (row.Cells.Count == 0)//we add bottom border only the first time
                {
                    row.Style.Add("border-bottom", "solid 1px black");
                }

                tCell = new HtmlTableCell();
                tCell.Controls.Add(ucg);
                row.Cells.Add(tCell);
            }
            else
            {
                tCell = new HtmlTableCell();
                tCell.Controls.Add(ucg);
                newTRow.Cells.Add(tCell);
                newTRow.Style.Add("border-bottom", "solid 1px black");

                return(newTRow);
            }

            return(row);
        }
Exemplo n.º 2
0
        protected void ASPxCallbackPanel1_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
        {
            List <GraphBinding> bindingCollection = new List <GraphBinding>();

            bindingCollection.Select(item => item.control).ToList();//get all controls and only controls from list

            Session["MainContentDivWidth"] = hiddenField["browserWidth"];

            UserControlGraph ucf2 = (UserControlGraph)LoadControl("~/UserControls/UserControlGraph.ascx");

            ucf2.btnPostClk          += ucf2_btnPostClk;
            ucf2.btnDeleteGraphClick += ucf2_btnDeleteGraphClick;
            ucf2.btnAddEventClick    += ucf2_btnAddEventClick;
            if (Session["GraphCollection"] != null)
            {
                bindingCollection = (List <GraphBinding>)Session["GraphCollection"];

                RefresGraphsCallbackPanel();

                //bindingCollection.Add(new GraphBinding() { control = ucf2, graphDataTable = null });
                ASPxCallbackPanel1.Controls.Add(ucf2);
            }
            else
            {
                //bindingCollection.Add(new GraphBinding() { control = ucf2, graphDataTable = null });
                ASPxCallbackPanel1.Controls.Add(ucf2);
            }

            Session["GraphCollection"] = bindingCollection;//ASPxCallbackPanel1.Controls;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lab">Parent graph label</param>
 public FormGraph(Labels.GraphLabel lab)
     : this()
 {
     child      = new UserControlGraph(false);
     this.label = lab;
     l          = lab;
     UpdateFormUI();
     child.Dock = DockStyle.Fill;
     panelGraph.Controls.Add(child);
 }
Exemplo n.º 4
0
 private void AddControlsToPanel(List <GraphBinding> collection)
 {
     foreach (GraphBinding item in collection)
     {
         UserControlGraph ucf2 = (UserControlGraph)LoadControl("~/UserControls/UserControlGraph.ascx");
         ucf2.btnPostClk          += ucf2_btnPostClk;
         ucf2.btnDeleteGraphClick += ucf2_btnDeleteGraphClick;
         ucf2.btnAddEventClick    += ucf2_btnAddEventClick;
         ASPxCallbackPanel1.Controls.Add(ucf2);
     }
 }
Exemplo n.º 5
0
        private void ucf2_btnDeleteGraphClick(object sender, EventArgs e)
        {
            UserControlGraph id = (UserControlGraph)sender;

            ASPxCallbackPanel1.Controls.Remove(id);

            List <GraphBinding> bindingCollection = new List <GraphBinding>();

            if (Session["GraphCollection"] != null)
            {
                bindingCollection = (List <GraphBinding>)Session["GraphCollection"];


                Control[] array = new Control[ASPxCallbackPanel1.Controls.Count];
                ASPxCallbackPanel1.Controls.CopyTo(array, 0);
                List <Control> collection = array.ToList();

                bool eraseControl = false;
                for (int i = bindingCollection.Count - 1; i >= 0; i--)
                {
                    if (collection.Count == 0)//TODO: Ulovi robni primer če izbišre zadnjega!
                    {
                        bindingCollection.RemoveAt(i);
                    }

                    foreach (Control callbackControls in collection)
                    {
                        if (bindingCollection[i].control.UniqueID.Equals(callbackControls.UniqueID))
                        {
                            collection.Remove(callbackControls);
                            break;
                        }
                        else
                        {
                            int index = collection.IndexOf(callbackControls);
                            if ((index + 1) == collection.Count)
                            {
                                eraseControl = true;
                            }
                        }
                    }

                    if (eraseControl)
                    {
                        bindingCollection.RemoveAt(i);
                        eraseControl = false;
                    }
                }
            }
            //ControlCollection collection = ASPxCallbackPanel1.Controls;
            Session["GraphCollection"] = bindingCollection;//collection.Count > 0 ? collection : null;
            RefresGraphsCallbackPanel();
        }
Exemplo n.º 6
0
        void UpdateCadr(int cadrNumber)
        {
            UserControlCadr  userControlCadr  = this.FindChild <UserControlCadr>();
            UserControlGraph userControlGraph = this.FindChild <UserControlGraph>();

            userControlGraph.StartIterator(cadrNumber);
            Dictionary <string, object> values = userControlGraph.CadrMeasurements;
            Dictionary <string, object> vals   = userControlGraph.CadrExternal;

            values = values.Concat(vals).ToDictionary(x => x.Key, x => x.Value);
            userControlCadr.Dictionary = values;
        }
        private void ucf2_btnAddEventClick(object sender, EventArgs e)
        {
            UserControlGraph ucf2 = (UserControlGraph)sender;

            if (PrincipalHelper.GetUserPrincipal().HasSupervisor&& (model.StrankaZaposleni != null && model.StrankaZaposleni.Count > 0))
            {
                List <QueryStrings> queryList = new List <QueryStrings>();

                int employeeID = 0;
                if (model != null)
                {
                    employeeID = model.StrankaZaposleni[0].idOsebe;
                }

                QueryStrings item = new QueryStrings()
                {
                    Attribute = Enums.QueryStringName.action.ToString(), Value = "1"
                };
                queryList.Add(item);
                item = new QueryStrings()
                {
                    Attribute = Enums.QueryStringName.recordId.ToString(), Value = "0"
                };
                queryList.Add(item);
                item = new QueryStrings()
                {
                    Attribute = Enums.QueryStringName.eventClientId.ToString(), Value = clientID.ToString()
                };
                queryList.Add(item);
                item = new QueryStrings()
                {
                    Attribute = Enums.QueryStringName.eventCategorieId.ToString(), Value = ucf2 != null?ucf2.CategorieID.ToString() : (-1).ToString()
                };
                queryList.Add(item);
                item = new QueryStrings()
                {
                    Attribute = Enums.QueryStringName.eventEmployeeId.ToString(), Value = employeeID.ToString()
                };
                queryList.Add(item);

                ClearSessionsAndRedirect(true, GenerateURI("../Events/EventsForm.aspx", queryList));
            }
            else
            {
                ErrorLabel.Text = "Skrbnik in zaposlen za stranko ni izbran!";
            }
        }
        private void ucf2_btnPostClk(object sender, EventArgs e)
        {
            UserControlGraph ucf2 = (UserControlGraph)sender;

            int period = CommonMethods.ParseInt(ucf2.Period.SelectedItem.Value);
            int type   = CommonMethods.ParseInt(ucf2.Type.SelectedItem.Value);

            if (period != (int)Enums.ChartRenderPeriod.TEDENSKO)
            {
                DateTime?selectedDateFrom = null;
                DateTime?selectedDateTo   = null;

                if (!ucf2.DateEdit_OD.Date.Equals(DateTime.MinValue))
                {
                    selectedDateFrom = ucf2.DateEdit_OD.Date;
                }
                if (!ucf2.DateEdit_DO.Date.Equals(DateTime.MinValue))
                {
                    selectedDateTo = ucf2.DateEdit_DO.Date;
                }

                ChartRenderModel chart = CheckModelValidation(GetDatabaseConnectionInstance().GetChartDataFromSQLFunction(clientID, ucf2.CategorieID, period, type, selectedDateFrom, selectedDateTo));

                if (period == (int)Enums.ChartRenderPeriod.MESECNO)
                {
                    chart.chartRenderData = CheckForMissingMoths(chart.chartRenderData, period, type, ucf2.CategorieID, 0);
                }


                GetClientDataProviderInstance().GetGraphBindingList().Find(gb => gb.CategorieID == ucf2.CategorieID).chartData  = chart;
                GetClientDataProviderInstance().GetGraphBindingList().Find(gb => gb.CategorieID == ucf2.CategorieID).YAxisTitle = chart.chartRenderData.Count > 0 ? chart.chartRenderData[0].EnotaMere : "";
                GetClientDataProviderInstance().GetGraphBindingList().Find(gb => gb.CategorieID == ucf2.CategorieID).obdobje    = period;
                GetClientDataProviderInstance().GetGraphBindingList().Find(gb => gb.CategorieID == ucf2.CategorieID).tip        = type;
                GetClientDataProviderInstance().GetGraphBindingList().Find(gb => gb.CategorieID == ucf2.CategorieID).dateFrom   = ucf2.DateEdit_OD.Date;
                GetClientDataProviderInstance().GetGraphBindingList().Find(gb => gb.CategorieID == ucf2.CategorieID).dateTo     = ucf2.DateEdit_DO.Date;

                ucf2.CreateGraph(chart);
            }
            else
            {
                int previousPeriod = GetClientDataProviderInstance().GetGraphBindingList().Find(gb => gb.CategorieID == ucf2.CategorieID).obdobje;
                ucf2.Period.SelectedIndex = ucf2.Period.Items.IndexOf(ucf2.Period.Items.FindByValue(previousPeriod.ToString()));
            }
        }
        private void AddControlsToPanel(List <GraphBinding> collection)
        {
            HtmlTableRow tRow  = new HtmlTableRow();
            HtmlTable    table = new HtmlTable();

            table.Style.Add("width", "100%");

            foreach (GraphBinding item in collection)
            {
                UserControlGraph ucf2 = (UserControlGraph)LoadControl("~/UserControls/UserControlGraph.ascx");
                //ucf2.ID = model.KodaStranke + "_UserControlGraph_" + (collection.Count + 1).ToString();
                ucf2.btnPostClk          += ucf2_btnPostClk;
                ucf2.btnDeleteGraphClick += ucf2_btnDeleteGraphClick;
                ucf2.btnAddEventClick    += ucf2_btnAddEventClick;

                tRow = AddChartsToCell(ucf2, tRow, GetClientDataProviderInstance().GetChartsCoutInRow());
                table.Rows.Add(tRow);

                ChartsCallback.Controls.Add(table);
                ucf2.Period.SelectedIndex  = ucf2.Period.Items.FindByValue((item.obdobje >= 0 ? item.obdobje : 0).ToString()).Index;
                ucf2.Period.Visible        = btnDisplayAllCharts.Checked ? false : true;
                ucf2.Type.SelectedIndex    = ucf2.Type.Items.FindByValue((item.tip >= 0 ? item.tip : 0).ToString()).Index;
                ucf2.Type.Visible          = btnDisplayAllCharts.Checked ? false : true;
                ucf2.HeaderName.HeaderText = item.HeaderText;
                ucf2.HeaderLink.Visible    = false;
                ucf2.RenderChart.Text      = "Izriši " + item.HeaderText;
                ucf2.RenderChart.Visible   = btnDisplayAllCharts.Checked ? false : true;
                ucf2.CategorieID           = item.CategorieID;
                ucf2.YAxisTitle            = item.YAxisTitle;
                ucf2.ShowFromToDateFilteringUserControl = item.ShowFilterFromToDate;

                if (item.chartData != null)
                {
                    ucf2.CreateGraph(item.chartData);
                }
                else if (item.chartDataMultiplePanes != null & item.chartDataMultiplePanes.Count > 0)
                {
                    //rbTypeDetail.SelectedIndex = rbTypeDetail.Items.FindByValue((item.obdobje != null ? item.obdobje : 0).ToString()).Index;
                    ucf2.CreateGraphMultiPane(item.chartDataMultiplePanes);
                }
            }
        }
Exemplo n.º 10
0
        private void ucf2_btnPostClk(object sender, EventArgs e)
        {
            DatabaseConnection dbconnection = new DatabaseConnection();

            UserControlGraph ucf2 = ((UserControlGraph)(sender));

            int       index = ASPxCallbackPanel1.Controls.IndexOf(ucf2);
            DataTable dt    = dbconnection.GetDataForGraphRendering();

            if (index >= 0)
            {
                //TODO: Call web service metods to get data for grapf rendering
                List <GraphBinding> bindingCollection = (List <GraphBinding>)Session["GraphCollection"];
                //bindingCollection.Find(p => p.control.UniqueID == ASPxCallbackPanel1.Controls[index].UniqueID).graphDataTable = dt;
                Session["GraphCollection"] = bindingCollection;
            }

            // ucf2.CreateGraph(/*ucf2.Points.Text, ucf2.LineColor.Text*/dt);
            RefresGraphsCallbackPanel();
        }
Exemplo n.º 11
0
        void IRealTimeStartStop.Start()
        {
            if (calculationReason.IsRealtimeAnalysis())
            {
                return;
            }
            disassemblyDictionary.Clear();
            Dictionary <IMeasurement, BaseTypes.Interfaces.IDisassemblyObject> disassemblyDict =
                dataConsumer.CreateDisassemblyObjectDictionary();

            foreach (IMeasurement key in disassemblyDict.Keys)
            {
                disassemblyDictionary[key] = new
                                             Portable.MeasurementsDisasseblyWrapper(disassemblyDict[key], key);
            }
            add.Clear();
            calc.Clear();
            dObject.Clear();
            dArray.Clear();
            performer.Clear();
            performer.Reset();
            realtime.Item1[0]  = double.Parse(textBoxChartInterval.Text);
            performer.Interval = realtime.Item1[0];
            List <Tuple <Tuple <string, IMeasurement, object[]>, Tuple <Color[], bool, double[]> > > output =
                userControlRealtimeMeasurements.Output;
            List <Tuple <string, object[]> > measurementsList = new List <Tuple <string, object[]> >();
            Dictionary <string, Tuple <Func <object, double>, Tuple <Tuple <string, IMeasurement, object[]>,
                                                                     Tuple <Color[], bool, double[]> > > > dd =
                new Dictionary <string, Tuple <Func <object, double>,
                                               Tuple <Tuple <string, IMeasurement, object[]>, Tuple <Color[], bool, double[]> > > >();
            List <IMeasurement> lm = new List <IMeasurement>();

            foreach (Tuple <Tuple <string, IMeasurement, object[]>, Tuple <Color[], bool, double[]> > t in output)
            {
                string       na  = t.Item1.Item1;
                IMeasurement mea = t.Item1.Item2;
                lm.Add(mea);
                measurementsList.Add(new Tuple <string, object[]>(t.Item1.Item1, t.Item1.Item3));
                calc[mea] = t.Item1.Item3;
                Func <object, double> f = mea.GetDoubleFunction();
                if (f == null)
                {
                    add[t.Item1.Item1] = mea;
                    continue;
                }
                dd[t.Item1.Item1] = new Tuple <Func <object, double>,
                                               Tuple <Tuple <string, IMeasurement, object[]>,
                                                      Tuple <Color[], bool, double[]> > >(f, t);
                dArray[na] = t.Item1.Item3;
                Color cw = t.Item2.Item1[0];
                System.Windows.Media.Color cp = System.Windows.Media.Color.FromRgb(cw.R, cw.G, cw.B);
                Tuple <System.Windows.Media.Color, bool, double[], Func <object, double> > tp =
                    new Tuple <System.Windows.Media.Color, bool, double[], Func <object, double> >(
                        cp, t.Item2.Item2, t.Item2.Item3, f);
                performer[na] = tp;
            }
            performer.Reset();
            realtime.Item1[0] = double.Parse(textBoxChartInterval.Text);
            userControlRealtimeList.Set(measurementsList);
            Labels.GraphLabel lab = this.FindParent <Labels.GraphLabel>();
            lab.data.Item6[0] = realtime;
            UserControlGraph uc = this.FindParent <UserControlGraph>();
        }
        private GraphBinding IncializeChartAndChartData(HtmlTable table, HtmlTableRow tRow, ClientCategorieModel item,
                                                        Enums.ChartRenderType type     = Enums.ChartRenderType.KOLICINA,
                                                        Enums.ChartRenderPeriod period = Enums.ChartRenderPeriod.MESECNO,
                                                        bool showFilterOnChart         = true,
                                                        DateTime?dateFROM = null,
                                                        DateTime?dateTO   = null)
        {
            UserControlGraph ucf2 = (UserControlGraph)LoadControl("~/UserControls/UserControlGraph.ascx");

            ChartRenderModel        chart = null;
            List <ChartRenderModel> list  = null;

            if (showFilterOnChart)
            {
                chart = CheckModelValidation(GetDatabaseConnectionInstance().GetChartDataFromSQLFunction(clientID, item.Kategorija.idKategorija, (int)period, (int)type));
            }
            else//if we want to see all types
            {
                list = CheckModelValidation(GetDatabaseConnectionInstance().GetChartDataForAllTypesSQLFunction(clientID, item.Kategorija.idKategorija, (int)period, dateFROM, dateTO));
            }

            if ((chart != null && chart.chartRenderData.Count > 0) || (list != null && list.Count > 0 && list.Exists(c => c.chartRenderData.Count > 0)))
            {
                item.HasChartDataForCategorie = true;
                //ucf2.ID = model.KodaStranke + "_UserControlGraph_" + (bindingCollection.Count + 1).ToString();
                ucf2.btnPostClk          += ucf2_btnPostClk;
                ucf2.btnDeleteGraphClick += ucf2_btnDeleteGraphClick;
                ucf2.btnAddEventClick    += ucf2_btnAddEventClick;


                tRow = AddChartsToCell(ucf2, tRow, 1);
                table.Rows.Add(tRow);

                ChartsCallback.Controls.Add(table);

                GraphBinding instance = new GraphBinding();

                if (period.Equals(Enums.ChartRenderPeriod.MESECNO))
                {
                    if (chart != null)
                    {
                        chart.chartRenderData = CheckForMissingMoths(chart.chartRenderData, (int)period, (int)type, item.Kategorija.idKategorija, 0);
                    }
                    else
                    {
                        foreach (var obj in list)
                        {
                            if (obj.chartRenderData.Count > 0)
                            {
                                obj.chartRenderData = CheckForMissingMoths(obj.chartRenderData, (int)period, obj.chartRenderData[0].Tip, item.Kategorija.idKategorija, 0);
                            }
                        }
                    }
                }

                ucf2.HeaderName.HeaderText = item.Kategorija.Naziv;
                ucf2.HeaderLink.Visible    = false;
                ucf2.Period.SelectedIndex  = ucf2.Period.Items.FindByValue(((int)period).ToString()).Index;
                ucf2.Period.Visible        = showFilterOnChart ? true : false;
                ucf2.Type.SelectedIndex    = ucf2.Type.Items.FindByValue(((int)type).ToString()).Index;
                ucf2.Type.Visible          = showFilterOnChart ? true : false;
                ucf2.RenderChart.Text      = "Izriši " + item.Kategorija.Koda;
                ucf2.RenderChart.Visible   = showFilterOnChart ? true : false;
                ucf2.CategorieID           = item.Kategorija.idKategorija;
                ucf2.YAxisTitle            = (chart != null && chart.chartRenderData.Count > 0) ? chart.chartRenderData[0].EnotaMere : "";
                ucf2.ShowFromToDateFilteringUserControl = showFilterOnChart ? true : false;

                if (chart != null)
                {
                    ucf2.CreateGraph(chart);
                }
                else if (list != null && list.Count > 0)
                {
                    //rbTypeDetail.SelectedIndex = rbTypeDetail.Items.FindByValue(((int)period).ToString()).Index;
                    ucf2.CreateGraphMultiPane(list);
                }

                instance.obdobje                = (int)period;
                instance.tip                    = (int)type;
                instance.YAxisTitle             = ucf2.YAxisTitle;
                instance.chartData              = chart;
                instance.chartDataMultiplePanes = list;
                instance.control                = ucf2;
                instance.HeaderText             = item.Kategorija.Koda;
                instance.CategorieID            = item.Kategorija.idKategorija;
                instance.ShowFilterFromToDate   = showFilterOnChart ? true : false;
                instance.dateFrom               = DateEdit_OD.Date;
                instance.dateTo                 = DateEdit_DO.Date;

                return(instance);
            }

            return(null);
        }