Exemple #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            set_enable_printbuttons(false);
            dataGridView5.Rows.Clear();

            if (comboBox2.SelectedIndex >= 0)
            {
                string _path     = "cms" + inc.Carpark[comboBox2.SelectedIndex].id.ToString();
                string _name     = dateTimePicker9.Value.ToString("yyyyMMdd") + ".trans";
                string _cms_name = cms_id2name(inc.Carpark[comboBox2.SelectedIndex].id);
                string _data     = "";

                dataGridView5.Rows.Clear();

                if (fn_global.fn_get_file(_path, _name, _name))
                {
                    MyFile f1 = new MyFile(fn_global.get_workdir(_path) + "\\" + _name);
                    int    i  = 0;

                    while ((_data = f1.read_file_line()) != null)
                    {
                        string[] s_data = _data.Split('|');
                        dataGridView5.Rows.Add();

                        dataGridView5.Rows[i].Cells["time"].Value      = s_data[1];
                        dataGridView5.Rows[i].Cells["user"].Value      = _cms_name;
                        dataGridView5.Rows[i].Cells["occupancy"].Value = (int)(double.Parse(s_data[4]) / 10) + "%";
                        dataGridView5.Rows[i].Cells["lots"].Value      = s_data[2];
                        dataGridView5.Rows[i].Cells["limit"].Value     = s_data[3];
                        i++;

                        label29.Text = "Total: " + i.ToString();
                        Application.DoEvents();
                    }
                    f1.close();
                }
            }
            set_enable_printbuttons(true);
        }
Exemple #2
0
        private void set_value(int index)
        {
            string _path     = "cms" + inc.Carpark[index].id.ToString();
            string _name     = dateTimePicker13.Value.ToString("yyyyMMdd") + ".trans";
            string _cms_name = inc.Carpark[index].name;
            string _data     = "";

            if (fn_global.fn_get_file(_path, _name, _name))
            {
                MyFile f1 = new MyFile(fn_global.get_workdir(_path) + "\\" + _name);
                int    i  = 0;
                while ((_data = f1.read_file_line()) != null)
                {
                    string[] s_data = _data.Split('|');

                    DateTime line_time     = Tools.str_to_datetime(s_data[1], "yyyy-MM-dd HH:mm:ss");
                    DateTime cur_line_time = get_time(dataGridView8.Rows.Count - 1);

                    int mmm = line_time.Hour * 12 + line_time.Minute / 5;

                    if (radioButton1.Checked)
                    {
                        dataGridView8.Rows[mmm].Cells[index.ToString()].Value = s_data[2];
                    }
                    else
                    {
                        //dataGridView5.Rows[i].Cells["occupancy"].Value = (int)(double.Parse(s_data[4]) / 10) + "%";
                        dataGridView8.Rows[mmm].Cells[index.ToString()].Value = (int)(double.Parse(s_data[4]) / 10) + "%";
                    }

                    i++;
                    Application.DoEvents();
                }
                f1.close();
            }
        }
Exemple #3
0
        private void Form_Dimming_Load(object sender, EventArgs e)
        {
            groupBox1.Text = inc._vms[fn_global.fn_vms_id2index(VMSid)].name + " Dimming Configuation";
            comboBox1.Items.AddRange(inc.Dimming_mode);
            if ((fn_type == 0) || (fn_type == 1))
            {
                button1.Visible = false;

                string _workdir = fn_global.get_workdir("gdm" + VMSid.ToString());
                string f_name   = "";
                if (fn_type == 1)
                {
                    f_name = _workdir + "\\dimupdate.txt";
                }
                else
                {
                    f_name = _workdir + "\\dimget.txt";
                }

                MyFile f1 = new MyFile(f_name);

                label20.Text = Tools.get_str_value(f1.read_file_line());
                string _temp0 = f1.read_file_line();
                string _temp  = Tools.get_str_value(_temp0);
                if (_temp == "Disconnect")
                {
                    comboBox1.Visible = false;
                    for (int i = 1; i < 9; i++)
                    {
                        ((TextBox)this.Controls.Find("textBox" + i, true)[0]).Visible = false;
                    }

                    for (int i = 2; i <= 19; i++)
                    {
                        ((Label)this.Controls.Find("label" + i, true)[0]).Visible = false;
                    }
                    textBox9.Visible = false;
                    label1.Text      = _temp0;
                }
                else
                {
                    comboBox1.Enabled = false;
                    for (int i = 1; i <= 9; i++)
                    {
                        ((TextBox)this.Controls.Find("textBox" + i, true)[0]).ReadOnly = true;
                    }
                    if (fn_type == 1)
                    {
                        comboBox1.Text = _temp;
                        for (int i = 1; i < 9; i++)
                        {
                            ((TextBox)this.Controls.Find("textBox" + i, true)[0]).Text = Tools.get_str_value(f1.read_file_line());
                        }
                        textBox9.Text = Tools.get_str_value(f1.read_file_line());
                    }
                    else
                    {
                        ((TextBox)this.Controls.Find("textBox" + 1, true)[0]).Text = _temp;
                        for (int i = 2; i < 9; i++)
                        {
                            ((TextBox)this.Controls.Find("textBox" + i, true)[0]).Text = Tools.get_str_value(f1.read_file_line());
                        }
                        comboBox1.Text = Tools.get_str_value(f1.read_file_line());
                        textBox9.Text  = Tools.get_str_value(f1.read_file_line());
                    }
                }
                f1.close();
            }
            else
            {
                button1.Visible = true;

                string _workdir = fn_global.get_workdir("gdm" + VMSid.ToString());
                string f_name   = "";

                f_name = _workdir + "\\dimming.txt";

                MyFile f1 = new MyFile(f_name);

                comboBox1.Text = Tools.get_str_value(f1.read_file_line());
                for (int i = 1; i < 9; i++)
                {
                    ((TextBox)this.Controls.Find("textBox" + i, true)[0]).Text
                        = Tools.get_str_value(f1.read_file_line());
                }
                textBox9.Text = Tools.get_str_value(f1.read_file_line());

                f1.close();
            }
        }
        private void Form_Config_CMS_Load(object sender, EventArgs e)
        {
            textBox8.Text = inc.Carpark[fn_global.fn_cms_id2index(CMS_id)].name;
            comboBox1.Items.AddRange(inc.WeekDays);
            comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;

            if (!fn_global.fn_get_file("setting", "cms_timezone.txt", "cms_timezone.txt"))
            {
                return;
            }

            string _workdir    = fn_global.get_workdir("setting");
            MyFile ftimezone   = new MyFile(_workdir + "\\cms_timezone.txt");
            string _temp       = "";
            int    j           = 0;
            int    _len        = 1;
            string time_string = "";

            dataGridView3.Columns.Add("VMS", "VMS");
            while ((_temp = ftimezone.read_file_line()) != null)
            {
                //int _index = 32;
                try
                {
                    bool _addj = false;
                    if (j >= 10)
                    {
                        _len = 2;
                    }

                    string _day = _temp.Substring(6, _len);
                    int    i    = int.Parse(_day);

                    if (_temp.IndexOf("start") > 0)
                    {
                        time_string = Tools.get_str_value(_temp) + "-";
                        //_addj = true;
                    }
                    else if (_temp.IndexOf("end") > 0)
                    {
                        time_string += Tools.get_str_value(_temp);
                        _addj        = true;
                    }
                    if (_addj)
                    {
                        dataGridView3.Columns.Add(time_string, time_string);
                        time_string = "";
                        j++;
                    }
                }
                catch { }
            }
            ftimezone.close();
            //ftimezone = new MyFile("temp");

            dataGridView3.Columns["VMS"].ReadOnly = true;
            dataGridView3.Columns["VMS"].Width    = 180;

            for (int i = 0; i < inc._vms.Length; i++)
            {
                if (!check_cms_in_vms(i))
                {
                    continue;
                }

                dataGridView3.Rows.Add();
                dataGridView3.Rows[dataGridView3.Rows.Count - 1].Cells["VMS"].Value = inc._vms[i].name;
            }

            //comboBox1.SelectedIndex = 0;
        }