public WinFormDataParkings(User user)
        {
            InitializeComponent();
            парковкиDataGridView.DataError += new DataGridViewDataErrorEventHandler(DataGridView_DataError);
            DataBaseCenter dataBase = DataBaseCenter.Create();

            if (dataBase.CheckRigth(user, Rights.редПольз))
            {
                парковкиDataGridView.ReadOnly            = false;
                bindingNavigatorAddNewItem.Enabled       = true;
                bindingNavigatorDeleteItem.Enabled       = true;
                парковкиBindingNavigatorSaveItem.Enabled = true;
            }
        }
Beispiel #2
0
        private void button8_Click(object sender, EventArgs e)
        {
            DataBaseCenter dataBase = DataBaseCenter.Create();

            if (!dataBase.CheckRigth(user, Rights.группы))
            {
                MessageBox.Show("Недостаточно прав!", "Предупреждение");
                return;
            }

            try
            {
                (new WinFormDataGroups()).Show();
            }
            catch { }
        }
Beispiel #3
0
        private void button10_Click(object sender, EventArgs e)
        {
            DataBaseCenter dataBase = DataBaseCenter.Create();

            if (!dataBase.CheckRigth(user, Rights.настройки))
            {
                MessageBox.Show("Недостаточно прав!", "Предупреждение");
                return;
            }

            try
            {
                (new WinFormQiwiSetting()).Show();
            }
            catch { }
        }
        public WinFormDataClients(User user)
        {
            InitializeComponent();
            клиентыDataGridView.DataError          += new DataGridViewDataErrorEventHandler(DataGridView_DataError);
            контактыклиентовDataGridView.DataError += new DataGridViewDataErrorEventHandler(DataGridView_DataError);
            DataBaseCenter dataBase = DataBaseCenter.Create();

            if (dataBase.CheckRigth(user, Rights.редКлиенты))
            {
                клиентыDataGridView.ReadOnly          = false;
                bindingNavigatorDeleteItem.Enabled    = true;
                toolStripButton2.Enabled              = true;
                контактыклиентовDataGridView.ReadOnly = false;
            }

            клиентыDataGridView.Columns[3].ReadOnly = true;
        }
Beispiel #5
0
        private void WinFormSettings_Load(object sender, EventArgs e)
        {
            try
            {
                FileStream stream    = new FileStream("Настройки\\Камеры.cfg", FileMode.Open);
                byte[]     byte_buff = new byte[(int)stream.Length];
                stream.Read(byte_buff, 0, (int)stream.Length);
                string str_buff = Encoding.Default.GetString(byte_buff);
                cameras = JsonConvert.DeserializeObject <List <Camera> >(str_buff);
                stream.Close();
            }
            catch { }

            for (int i = 0; i < cameras.Count; i++)
            {
                listBox1.Items.Add(cameras[i].camName + " // " + cameras[i].url);
                listBox2.Items.Add(cameras[i].camName + " // " + cameras[i].url);
            }

            if (cameras.Count != 0)
            {
                listBox1.SelectedIndex = 0;
                listBox2.SelectedIndex = 0;
            }

            DataBaseCenter dataBase = DataBaseCenter.Create();

            if (!dataBase.CheckRigth(user, Rights.настройки))
            {
                button5.Enabled = false;
                return;
            }

            DataTable dataTable = dataBase.GetDataTable("SELECT значение FROM Настройки WHERE название='vk'");

            if (dataTable.Rows.Count != 0)
            {
                string[] str = dataTable.Rows[0].ItemArray[0].ToString().Split("|".ToCharArray());
                Array.Resize(ref str, 4);
                textBox10.Text = str[0];
                textBox9.Text  = str[1];
                textBox11.Text = str[2];
                textBox12.Text = str[3];
            }
        }
Beispiel #6
0
        public int CameraControlCreate(User user)
        {
            this.user = user;
            int result = 0;

            try
            {
                FileStream stream    = new FileStream("Настройки\\Камеры.cfg", FileMode.Open);
                byte[]     byte_buff = new byte[(int)stream.Length];
                stream.Read(byte_buff, 0, (int)stream.Length);
                string str_buff = Encoding.Default.GetString(byte_buff);
                cameras = JsonConvert.DeserializeObject <List <Camera> >(str_buff);
                stream.Close();
            }
            catch { result += 2; }

            try
            {
                StreamReader reader = new StreamReader("Настройки\\ШаблоныНомеров.cfg");
                while (!reader.EndOfStream)
                {
                    numTemplate.Add(reader.ReadLine());
                }

                reader.Close();
            }
            catch { result += 4; }

            if (!vkControl.Authorization())
            {
                result += 8;
            }
            else
            {
                DataBaseCenter dataBase = DataBaseCenter.Create();
                if (dataBase.CheckRigth(user, Rights.чатБот))
                {
                    vkControl.vkBot.BotStart();
                }
            }

            if (dataBase.CheckRigth(user, Rights.qiwiБот))
            {
                qiwiWatcher = new QiwiWatcher();
                qiwiWatcher.StartAsync();
            }

            Task.Run(() =>
            {
                for (int i = 0; i < cameras.Count; i++)
                {
                    cameras[i].Reconnect();
                    numberDetectors.Add(new NumberDetector(cameras[i]));
                    numberDetectors.Last().NewNumberDetect += NewNumberDetected;
                    //numberDetectors.Last().NewNumbersDetect += NewNumbersDetected;
                    numberDetectors.Last().Start(); // добавить также обработчики
                }
            });

            return(result);
        }