Пример #1
0
        private void btnCompare_Click(object sender, EventArgs e)
        {
            ServiceHistory firstHistory;
            ServiceHistory secondHistory;
            string         query1 = string.Format("SELECT * FROM dbo.ServiceHistory WHERE ID = {0}", int.Parse(this.cbFirst.Text));
            DataTable      data1  = DataProvider.Instance.ExecuteQuery(query1);

            firstHistory = new ServiceHistory(data1.Rows[0]);

            string    query2 = string.Format("SELECT * FROM dbo.ServiceHistory WHERE ID = {0}", int.Parse(this.cbSecond.Text));
            DataTable data2  = DataProvider.Instance.ExecuteQuery(query2);

            secondHistory = new ServiceHistory(data2.Rows[0]);

            switch (firstHistory > secondHistory)
            {
            case 0:
                this.txbCompare.Text = "The same";
                break;

            case 1:
                this.txbCompare.Text = "After";
                break;

            case -1:
                this.txbCompare.Text = "Before";
                break;

            default:
                break;
            }
        }
        public void ShowJsonReport()
        {
            ServiceHistory sh1  = ServiceController.Instance.GetServiceHistorToJsonShowMess();
            string         Json = JsonConvert.SerializeObject(sh1);

            MessageBox.Show(Json, "Json Document!");
        }
Пример #3
0
        private void btnSub_Click(object sender, EventArgs e)
        {
            ServiceHistory firstHistory;
            ServiceHistory secondHistory;
            string         query1 = string.Format("SELECT * FROM dbo.ServiceHistory WHERE ID = {0}", int.Parse(this.cbFirst.Text));
            DataTable      data1  = DataProvider.Instance.ExecuteQuery(query1);

            firstHistory = new ServiceHistory(data1.Rows[0]);

            string    query2 = string.Format("SELECT * FROM dbo.ServiceHistory WHERE ID = {0}", int.Parse(this.cbSecond.Text));
            DataTable data2  = DataProvider.Instance.ExecuteQuery(query2);

            secondHistory = new ServiceHistory(data2.Rows[0]);

            this.txbDistance.Text = (firstHistory - secondHistory).ToString() + " km";
        }