Beispiel #1
0
        public ActionResult DeleteWidget()
        {
            bool ret = true;

            try
            {
                DashboardWidget qw = new DashboardWidget(ConnectionString);

                GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"];
                WidgetObject       PostDataArrived = CS.GetPostData <WidgetObject>(this.Request);

                ret = qw.DeleteWidget(PostDataArrived.id);

                DashboardRow dRow = DashBoardObject.rows.Find(r => r.widgets.Find(w => w.id == PostDataArrived.id) != null);

                dRow.widgets.Remove(dRow.widgets.Find(w => w.id == PostDataArrived.id));

                Session["DashBoard"] = DashBoardObject;

                return(CS.ReturnForJQuery(ret));
            }
            catch (Exception ex)
            {
                return(CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult()
                {
                    Msg = ex.Message
                })));
            }
        }
    public void PopulateRow()
    {
        foreach (GameObject row in rows)
        {
            //0 - 3 == idy = 0
            // 3 -7 == idy = 1

            //planeCount = 6, j == 6
            int          j            = rows.IndexOf(row);// + (height * idy);
            DashboardRow dashboardrow = row.GetComponent <DashboardRow>();
            if (plane.Count != table.RowCount())
            {
                emptyRow(table.RowCount());
            }
            if (j > table.GetTable().Count)
            {
                emptyRow(j);
                //dashboardrow.SetIndex(idx);
            }

            if (j < table.GetTable().Count)
            {
                List <string> data = table.GetTable() [j];

                //dashboardrow.SetPlane(plane[j + (height * idy)]);
                dashboardrow.ChangeIdentifier(data [0]);

                dashboardrow.SetData(data.Skip(1).ToArray());
                dashboardrow.SetIndex(idx);
            }
        }
    }
Beispiel #3
0
        public ActionResult AddWidget()
        {
            WidgetObject woRet;

            try
            {
                DashboardWidget qw = new DashboardWidget(ConnectionString);

                GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"];
                WidgetObject       PostDataArrived = CS.GetPostData <WidgetObject>(this.Request);

                woRet = qw.AddWidget(PostDataArrived);

                DashboardRow dbRow = DashBoardObject.rows.Find(r => r.id == woRet.rowID);

                if (dbRow.widgets == null)
                {
                    dbRow.widgets = new List <WidgetObject>();
                }

                dbRow.widgets.Add(woRet);

                Session["DashBoard"] = DashBoardObject;

                return(CS.ReturnForJQuery(woRet));
            }
            catch (Exception ex)
            {
                return(CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult()
                {
                    Msg = ex.Message
                })));
            }
        }
Beispiel #4
0
        public ActionResult DeleteRow()
        {
            DashboardRow DBRow = CS.GetPostData <DashboardRow>(this.Request);

            try
            {
                DashboardWidget qw = new DashboardWidget(ConnectionString);

                GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"];

                qw.DeleteRow(DBRow.id);

                DashBoardObject.rows.Remove(DashBoardObject.rows.Find(c => c.id == DBRow.id));

                Session["DashBoard"] = DashBoardObject;

                return(CS.ReturnForJQuery(DBRow));
            }
            catch (Exception ex)
            {
                return(CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult()
                {
                    Msg = ex.Message
                })));
            }
        }
Beispiel #5
0
        public ActionResult UpdateRow()
        {
            try
            {
                DashboardWidget qw = new DashboardWidget(ConnectionString);
                DashboardRow    UpdatedDashBoardRow;

                DashboardRow PostDataArrived = CS.GetPostData <DashboardRow>(this.Request);

                GetDashboardObject DashBoardObject = (GetDashboardObject)Session["DashBoard"];

                UpdatedDashBoardRow = qw.UpdateRow(PostDataArrived);

                var row_widget = DashBoardObject.rows.Find(c => c.id == PostDataArrived.id);

                UpdatedDashBoardRow.widgets = row_widget.widgets;

                DashBoardObject.rows.Remove(row_widget);
                DashBoardObject.rows.Add(UpdatedDashBoardRow);

                Session["DashBoard"] = DashBoardObject;

                return(CS.ReturnForJQuery(UpdatedDashBoardRow));
            }
            catch (Exception ex)
            {
                return(CS.ReturnForJQuery(new JavaScriptSerializer().Serialize(new ISTAT.WebClient.Models.ControllerSupport.StringResult()
                {
                    Msg = ex.Message
                })));
            }
        }
        public async Task <TelegramReplyMessage> Handle(CompleteTransactionQuery request, CancellationToken cancellationToken)
        {
            if (request.Transaction.Type == Transaction.TypeTransfer || request.Transaction.Category == "Available to budget")
            {
                return(TelegramReplyMessage.OperationCompletedMessage(request.Message));
            }

            var dashboard = await _apiService.GetDashboardAsync();

            var row = dashboard.FirstOrDefault(x => x.Name == request.Transaction.Category &&
                                               x.Type == DashboardRowType.Category);

            if (row == null)
            {
                _logger.LogError($"No dashboard category found to send for {request.Transaction.Category}: " +
                                 $"{string.Join(", ", dashboard.Select(x => x.Name).ToArray())}");
                row = new DashboardRow(
                    "Error", DashboardRowType.Category, 0, 0, 0, 0, 0, false
                    );
            }
            var sb = new StringBuilder();

            sb.AppendLine("👌 Available | 💸 Spent | 💰 Budgeted");
            sb.AppendLine(row.ToHtmlSummary());

            var reply = new TelegramReplyMessage
            {
                ChatId      = request.Message.ChatId,
                ReplyMarkup = new ReplyKeyboardRemove(),
                Text        = sb.ToString()
            };

            return(reply);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dashboardId"></param>
        /// <param name="splitted"></param>
        /// <param name="order">if -1 = next order</param>
        public DashboardRow AddRow(int dashboardId, bool split, int order)
        {
            DashboardRow DBRowRet;

            try
            {
                using (SqlCommand oComm = new SqlCommand())
                {
                    if (Sqlconn.State == ConnectionState.Closed)
                    {
                        Sqlconn.Open();
                    }
                    oComm.Connection  = Sqlconn;
                    oComm.CommandType = CommandType.StoredProcedure;
                    oComm.CommandText = "DashBoard.AddRow";

                    SqlParameter pDSBID = new SqlParameter("@DSBID", SqlDbType.Int);
                    pDSBID.Value = dashboardId;
                    oComm.Parameters.Add(pDSBID);

                    SqlParameter pSplitted = new SqlParameter("@SPLITTED", SqlDbType.Bit);
                    pSplitted.Value = split;
                    oComm.Parameters.Add(pSplitted);

                    SqlParameter pOrder = new SqlParameter("@ORDER", SqlDbType.Int);
                    pOrder.Direction = ParameterDirection.InputOutput;
                    pOrder.Value     = order;
                    oComm.Parameters.Add(pOrder);

                    SqlParameter pRowID = new SqlParameter("@ROWID", SqlDbType.Int);
                    pRowID.Direction = ParameterDirection.Output;
                    oComm.Parameters.Add(pRowID);

                    oComm.ExecuteNonQuery();

                    DBRowRet = new DashboardRow()
                    {
                        id       = (int)pRowID.Value,
                        order    = (int)pOrder.Value,
                        splitted = split,
                        widgets  = null
                    };
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (Sqlconn.State == ConnectionState.Open)
                {
                    Sqlconn.Close();
                }
            }

            return(DBRowRet);
        }
 public void Reset()
 {
     resetIdy();
     plane.Clear();
     foreach (GameObject row in rows)
     {
         DashboardRow dashboardrow = row.GetComponent <DashboardRow>();
         dashboardrow.EmptyRow();
         dashboardrow.SetIndex(0);
     }
 }
 public static string ToHtmlSummary(this DashboardRow dashboardRow)
 {
     if (dashboardRow.Type == DashboardRowType.Group)
     {
         return($"<b>{dashboardRow.Name}</b>");
     }
     else
     {
         var emoji = dashboardRow.Available < 0 ? "❗️" : "";
         return($"{dashboardRow.Name}: {emoji}{dashboardRow.Available} | {dashboardRow.Spent} | {dashboardRow.Budgeted}");
     }
 }
 public void Reset()
 {
     resetIdy();
     plane.Clear();
     foreach (GameObject row in rows)
     {
         DashboardRow dashboardrow = row.GetComponent <DashboardRow>();
         dashboardrow.EmptyRow();
         dashboardrow.SetIndex(0);
     }
     transform.GetComponent <ReferenceSelection>().resetAll();
 }
        public List <DashboardRow> GetDashBoardRows(int dashboardId)
        {
            List <DashboardRow> lRows = new List <DashboardRow>();
            SqlDataReader       oReader;

            try
            {
                using (SqlCommand oComm = new SqlCommand())
                {
                    if (Sqlconn.State == ConnectionState.Closed)
                    {
                        Sqlconn.Open();
                    }

                    oComm.Connection  = Sqlconn;
                    oComm.CommandType = CommandType.StoredProcedure;
                    oComm.CommandText = "DashBoard.GetDashBoardRow";

                    SqlParameter pDashBoardID = new SqlParameter("@IDDASHBOARD", SqlDbType.Int);
                    pDashBoardID.Value = dashboardId;
                    oComm.Parameters.Add(pDashBoardID);

                    oReader = oComm.ExecuteReader();

                    while (oReader.Read())
                    {
                        DashboardRow dbRow = new DashboardRow()
                        {
                            id       = (int)oReader["dsb_row_id"],
                            splitted = (bool)oReader["splitted"],
                            order    = (int)oReader["order"]
                        };

                        lRows.Add(dbRow);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (Sqlconn.State == ConnectionState.Open)
                {
                    Sqlconn.Close();
                }
            }

            return(lRows);
        }
    public void PopulateRow()
    {
        foreach (GameObject row in rows)
        {
            //string [] data =Aircraft_parent.transform.GetChild(i).GetComponent<movement>().GetData();
            int j = rows.IndexOf(row);

            DashboardRow dashboardrow = row.GetComponent <DashboardRow>();

            if (j + (height * idy) > plane.Count - 1)
            {
                dashboardrow.EmptyRow();
                dashboardrow.SetIndex(idx);
            }
            else
            {
                //Debug.Log("Here");
                dashboardrow.SetPlane(plane[j + (height * idy)]);

                //Debug.Log("Plane======================="+ plane[0]);

                var scene = SceneManager.GetActiveScene().name;

                if (scene == "ARScene")
                {
                    string[] data = dashboardrow.GetPlane().GetComponent <movement>().GetData();

                    dashboardrow.ChangeIdentifier(data[0]);       // SET TAIL ID
                    dashboardrow.SetData(data.Skip(1).ToArray()); //
                    dashboardrow.SetIndex(idx);
                }
                else if (scene == "LiveData")
                {
                    string[] data = dashboardrow.GetPlane().GetComponent <AircraftDataManager>().GetData();


                    dashboardrow.ChangeIdentifier(data[0]);       // SET TAIL ID
                    dashboardrow.SetData(data.Skip(1).ToArray()); //
                    dashboardrow.SetIndex(idx);
                }
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        //headingTransform = transform.Find("headingRow");
        PopulateHeadings();
        int i = 0;

        //foreach(Transform child in Aircraft_parent.transform)
        //{


        //    GameObject rowGameObject = Instantiate(rowPrefab, transform) as GameObject;
        //    DashboardRow row = rowGameObject.GetComponent<DashboardRow>();
        //    row.SetIndex(0);
        //    row.SetWidth(width);
        //    row.Init();
        //    //row.SetPlane(child);
        //    //row.SetIdentifierName(child.transform.GetComponent<movement>().callsign);
        //    rowGameObject.transform.position = new Vector3(transform.position.x  + Xoffset, transform.position.y+ Yoffset, transform.position.z + (i * spacing) + Zoffset );

        //    rows.Add(rowGameObject);
        //    i++;
        //}
        //foreach (Transform child in Aircraft_parent.transform)
        //   plane.Add(child);

        while (i != height)
        {
            GameObject   rowGameObject = Instantiate(rowPrefab, transform) as GameObject;
            DashboardRow row           = rowGameObject.GetComponent <DashboardRow>();
            row.SetIndex(0);
            row.SetWidth(width);
            row.Init();
            //row.SetPlane(plane[i + (height * idy)].transform);
            //rowGameObject.transform.position = new Vector3(transform.position.x + Xoffset, transform.position.y + Yoffset, transform.position.z + (i * spacing) + Zoffset);
            rowGameObject.transform.position = new Vector3(transform.position.x + Xoffset, transform.position.y + (i * spacing) + Yoffset, transform.position.z + Zoffset);
            rows.Add(rowGameObject);
            i++;
        }

        transform.Rotate(new Vector3(75, 0, 0));
        //transform.parent.localScale = new Vector3(transform.parent.localScale.x - 0.2f, transform.parent.localScale.y, transform.parent.localScale.z);
    }
    // Use this for initialization
    void Start()
    {
        headingTransform = transform.Find("headingRow");
        PopulateHeadings();
        int i = 0;


        while (i != height)
        {
            GameObject   rowGameObject = Instantiate(rowPrefab, transform) as GameObject;
            DashboardRow row           = rowGameObject.GetComponent <DashboardRow>();
            row.SetIndex(0);
            row.SetWidth(width);
            row.Init();
            //row.SetPlane(plane[i + (height * idy)].transform);
            //rowGameObject.transform.position = new Vector3(transform.position.x + Xoffset, transform.position.y + Yoffset, transform.position.z + (i * spacing) + Zoffset);
            rowGameObject.transform.position = new Vector3(transform.position.x + Xoffset, transform.position.y + (i * spacing) + Yoffset, transform.position.z + Zoffset);
            rows.Add(rowGameObject);
            i++;
        }

        transform.Rotate(new Vector3(75, 0, 0));
    }
Beispiel #15
0
        public async Task <List <DashboardRow> > GetDashboardAsync()
        {
            var categories = await GetCategoriesAsync();

            var request = _sheetsService.Spreadsheets.Values.Get(_spreadSheetId, Options.DashboardRange);

            request.ValueRenderOption = SpreadsheetsResource.ValuesResource.GetRequest.ValueRenderOptionEnum.UNFORMATTEDVALUE;
            var response = await request.ExecuteAsync();

            var values = response.Values;

            var result = new List <DashboardRow>();

            if (values == null || values.Count == 0)
            {
                return(result);
            }

            foreach (var row in values)
            {
                try
                {
                    var dashboardRow = DashboardRow.FromGoogleRow(row);
                    if (!categories.Contains(dashboardRow.Name))
                    {
                        dashboardRow.SetType(DashboardRowType.Group);
                    }
                    result.Add(dashboardRow);
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "DashboardRow instancing error");
                }
            }

            return(result);
        }