//Aceasta fereastra primeste parametru pentru a apela functia de select corespunzatoare si afiseaza rezultatul
        public ShowData(string s)
        {
            AutoClass A = new AutoClass();

            InitializeComponent();
            DataTable dt = new DataTable();

            dt = A.Select(s);
            RezultateData.DataSource = dt;
        }
Exemplo n.º 2
0
        private void UpdateList()
        {
            AutoList = new List <AutoClass>();
            try
            {
                response = JsonConvert.DeserializeObject <Message>(server.SendMsg("GetAutostart", Data.ServiceSel));
                if (response.args[0] == "error")
                {
                    return;
                }
                for (var i = 0; i < response.args.Count; i += 8)
                {
                    AutoClass auto = new AutoClass();
                    auto.ID   = response.args[i];
                    auto.Name = response.args[i + 1];
                    if (response.args[i + 5] == "regular")
                    {
                        auto.Type = "Регулярно";
                    }
                    else if (response.args[i + 5] == "one")
                    {
                        auto.Type = "Единоразово";
                    }
                    Message packs = JsonConvert.DeserializeObject <Message>(response.args[i + 7]);
                    auto.Pack = String.Join("\n", packs.args.ToArray());
                    auto.Time = response.args[i + 3];
                    Message days = JsonConvert.DeserializeObject <Message>(response.args[i + 2]);
                    auto.Day    = String.Join("-", days.args.ToArray());
                    auto.Status = response.args[i + 6];

                    AutoList.Add(auto);
                }
            }
            catch
            {
                MessageBox.Show("Произошла ошибка! Обратитесь к поддержке!");
            }
        }