예제 #1
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            var dp = new data_provider();

            dp.delete();
            tbl_rings.Rows.Clear();
        }
예제 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            label1.Parent    = pictureBox1;
            label1.BackColor = Color.Transparent;
            label2.Parent    = pictureBox1;
            label2.BackColor = Color.Transparent;
            var dp = new data_provider();

            try
            {
                if (dp.proverka_connect() == "Какая-то база данных пустая. Производится заполнение...")
                {
                    dp.add_database();
                }
                else
                {
                    //всё в порядке
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка");
                string mess = ex.Message.Substring(0, 11);
                if (mess == "Нет доступа")
                {
                    dp.add_database();
                    MessageBox.Show("БД обновлена.");
                }
            }
        }
예제 #3
0
        private void btn_inn_Click(object sender, EventArgs e)
        {
            var      dp = new data_provider();
            Abonents f2 = new Abonents();

            try
            {
                var dtAbon_info = dp.info_abon(txt_inn.Text); //загрузка данных абонента из t_Abonents
                foreach (DataRow lo_row in dtAbon_info.Rows)
                {
                    f2.txt_address.Text = Convert.ToString(lo_row["address"]);
                    f2.txt_inn.Text     = Convert.ToString(lo_row["inn"]);
                    f2.txt_phone.Text   = Convert.ToString(lo_row["phone"]);
                }
                var dtAbon_rings = dp.abon_rings(txt_inn.Text);//исключения не нужно, т.к. абонент уже существует
                foreach (DataRow lo_row in dtAbon_rings.Rows)
                {
                    f2.tbl_abon_rings.Rows.Add(lo_row["City_name"], lo_row["datetime"], lo_row["minutes"], lo_row["time_of_day"], lo_row["sale"], lo_row["cost"]);
                }
                f2.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка");
            }
        }
예제 #4
0
        public string adding()
        {
            var    dp   = new data_provider();
            string aid  = dp.get_rand("AID");
            string City = dp.get_rand("City_name");
            Random rand = new Random();

            //select adding('A00040','Туапсе', '2020-10-15 19:59:29',32);
            return(t_Rings(aid, City, datetime(), rand.Next(1, 41).ToString()));
        }
예제 #5
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            var dp = new data_provider();

            tbl_rings.Rows.Clear();
            var dtRings = dp.update();

            foreach (DataRow lo_row in dtRings.Rows)
            {
                tbl_rings.Rows.Add(lo_row["inn"], lo_row["City_name"], lo_row["datetime"], lo_row["minutes"], lo_row["time_of_day"], lo_row["sale"], lo_row["cost"]);
            }
        }
예제 #6
0
        private void btn_ring_Click(object sender, EventArgs e)
        {
            var tg = new to_generate();

            try
            {
                string a  = tg.adding();
                var    dp = new data_provider();
                dp.new_call(a);
                btn_update_Click(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка");
            }
        }
예제 #7
0
        private void btn_auth_Click(object sender, EventArgs e)
        {
            var dp = new data_provider();

            if (!(txt_login.Text == "" || txt_pass.Text == ""))
            {
                byte[] cp = dp.CalcHash(txt_pass.Text);
                if (dp.authorization(txt_login.Text, cp))
                {
                    detalization f2 = new detalization();
                    f2.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Невалидный login or pass");
                }
            }
            else
            {
                MessageBox.Show("Не оставляйте поля пустыми!");
            }
        }
예제 #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            var dp = new data_provider();

            dp.add_database();
        }