Exemple #1
0
        private void btaddDriver_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            try
            {
                if ((tbdrivername.Text != "") && (tbdriversecond.Text != "") && (tbdriverthird.Text != "") && (tbpasspot.Text != "") && (tbidentity.Text != "") && (tbidentity.Text != ""))
                {
                    m.AddDriver();
                }
                else
                {
                    MessageBox.Show("Введите данные");
                }
                dgvman.Rows.Clear();
                dgvman.Rows.Clear();

                m.LoadDrivers();
                m.ShowDrivers();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ИНН равен 10 символов");
            }
        }
Exemple #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            m.ChangeBus();
            this.dgvman.Rows.Clear();
            this.dgvman.Rows.Clear();
            m.LoadBuses();
            m.ShowBuses();
        }
Exemple #3
0
        private static MethodsAggregator CreateLibrary()
        {
            var methodManager     = new MethodsManager();
            var propertiesManager = new PropertiesManager();

            var lib = new TestLibrary();

            propertiesManager.RegisterProperties(lib);
            methodManager.RegisterLibraries(lib);

            return(new MethodsAggregator(methodManager, propertiesManager));
        }
Exemple #4
0
        private void btnaddbus_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            if ((tbbusnomber.Text != "") && (tbmodel.Text != "") && (tbsites.Text != "") && (tbaveragespeed.Text != ""))
            {
                m.AddBus();
            }
            else
            {
                MessageBox.Show("Введите данные ");
            }
            this.dgvman.Rows.Clear();
            this.dgvman.Rows.Clear();
            m.LoadBuses();
            m.ShowBuses();
        }
Exemple #5
0
        private void MainManeger_Load(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            m.LoadDriverforCB();
            m.LoadDateCB();
            m.LoadDate();
            m.ShowDate();
            m.LoadBt();
            m.LoadSales();
            m.CBTowns();
            m.PricesK();
            m.FreeBuses();
            rbyes.Checked   = true;
            dgvmnew.Visible = true;
            rball.Checked   = true;
            rball.Enabled   = false;
            rbparts.Enabled = false;
            cbtables.Text   = "Маршруты";
            dgvmnew.Font    = new Font("Microsoft Sans Serif", 8);
        }
Exemple #6
0
        private void dgvman_MouseDown(object sender, MouseEventArgs e)
        {
            MethodsManager m = new MethodsManager(this);
            int            r = Convert.ToInt32(dgvman[0, dgvman.CurrentRow.Index].Value);

            try {
                if (e.Button == MouseButtons.Right)
                {
                    if (dgvman.Rows.Count > 2)
                    {
                        m.Check(r - 1, r - 1);
                    }
                    else
                    {
                        m.Check(r - 1, 0);
                    }
                }
            } catch (Exception ex)
            {
                MessageBox.Show("Проверьте соединение с базой данных");
            }
        }
Exemple #7
0
 private void tbsearch_TextChanged(object sender, EventArgs e)
 {
     if (tbsearch.Text == "")
     {
         dgvman.Rows.Clear();
         MethodsManager m = new MethodsManager(this);
         if (cbtables.Text == "Маршруты")
         {
             m.ShowDate();
         }
         else if (cbtables.Text == "Продажи")
         {
             m.ShowSales();
         }
         else if (cbtables.Text == "Водители")
         {
             m.ShowDrivers();
         }
         else if (cbtables.Text == "Автобусы")
         {
             m.ShowBuses();
         }
     }
 }
Exemple #8
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            m.DeleteDriver();
        }
Exemple #9
0
        private void button4_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            m.ChangeCondition(condition);
        }
Exemple #10
0
        private void btnchoise_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            m.LoadSales(0);
        }
Exemple #11
0
        private void btnsalessearch_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            m.SearchSales(idsales);
        }
Exemple #12
0
        private void button3_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            m.Report();
        }
Exemple #13
0
        private void button2_Click(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            if ((cbto.Text != "") && (cbfrm.Text != "") && (cbfreebuses.Text != "") && (tbnrdays.Text != "") && (datearrive.Text != "") && (dateleave.Text != "") && (cbpk.Text != "") && (tbdistance.Text != "") && (cbnrDriver.Text != ""))
            {
                double   r;
                DateTime rt;
                try
                {
                    string [] valdays = { "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс" };

                    r = Convert.ToDouble(cbpk.Text);
                    r = Convert.ToDouble(tbdistance.Text);

                    rt = DateTime.Parse(datearrive.Text);
                    rt = DateTime.Parse(dateleave.Text);
                    if (r < 10)
                    {
                        throw new System.Exception();
                    }
                    string[] val    = tbnrdays.Text.Split(',');
                    bool     triger = false;

                    for (int j = 0; j < val.Length; j++)
                    {
                        for (int i = 0; i < valdays.Length; i++)
                        {
                            if (val[j] == valdays[i])
                            {
                                triger = true;
                            }
                        }
                        if (triger != true)
                        {
                            throw new System.Exception();
                        }
                        else
                        {
                            triger = false;
                        }
                    }
                    if (rbyes.Checked == true)
                    {
                        if (dgvmnew.Rows.Count == 1)
                        {
                            if ((dgvmnew[0, 1].Value == null) && (dgvmnew[0, 2].Value == null))
                            {
                                throw new System.Exception();
                            }
                        }
                        double tr = 0;
                        for (int i = 0; i < dgvmnew.Rows.Count - 1; i++)
                        {
                            if (dgvmnew[0, i].Value == null)
                            {
                                throw new System.Exception();
                            }
                            else
                            {
                                tr += Convert.ToDouble(dgvmnew[0, i].Value);
                            }
                        }
                        if (tr > Convert.ToDouble(tbdistance.Text))
                        {
                            throw new System.Exception();
                        }
                    }

                    m.AddRout();
                    this.dgvman.Rows.Clear();
                    this.dgvman.Rows.Clear();
                    m.LoadDate();
                    m.ShowDate();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Произошла ошибка при проверке данных, проверьте правильность вводы");
                }
            }
            else
            {
                MessageBox.Show("Все данные должны быть введены");
            }
        }
Exemple #14
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                if (dattes == true)
                {
                    if ((tbchangedistance.Text != "") && (tbchangetimeto.Text != "") && (cbchangeprice.Text != "") && (tbdays.Text != ""))
                    {
                        double   d  = Convert.ToDouble(cbchangeprice.Text);
                        DateTime rd = DateTime.Parse(tbchangetimeto.Text);
                        d = Convert.ToDouble(tbchangedistance.Text);

                        if (rbonedriver.Checked == true)
                        {
                            if (cbDrivers.Text == "")
                            {
                                throw new System.Exception();
                            }
                        }
                        else
                        {
                            if (cbDrivers.Text == "" || cbdrivers1.Text == "")
                            {
                                throw new System.Exception();
                            }
                        }
                        string[] valdays = { "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс" };
                        string[] val     = tbdays.Text.Split(',');
                        bool     triger  = false;

                        for (int j = 0; j < val.Length; j++)
                        {
                            for (int i = 0; i < valdays.Length; i++)
                            {
                                if (val[j] == valdays[i])
                                {
                                    triger = true;
                                }
                            }
                            if (triger != true)
                            {
                                throw new System.Exception();
                            }
                            else
                            {
                                triger = false;
                            }
                        }
                        if (d < 10)
                        {
                            throw new System.Exception();
                        }
                        double g = 0;
                        if (dgvBT.Rows.Count - 1 >= 1)
                        {
                            for (int i = 0; i < dgvBT.Rows.Count - 1; i++)
                            {
                                for (int j = 0; j < dgvBT.ColumnCount; j++)
                                {
                                    if (dgvBT[j, i].Value == null || dgvBT[j, i].Value.ToString() == tbchangefrom.Text || dgvBT[j, i].Value.ToString() == tbchangeto.Text)
                                    {
                                        throw new System.Exception();
                                    }
                                }
                                g = Convert.ToDouble(dgvBT[1, i].Value);
                                if (g > d)
                                {
                                    throw new System.Exception();
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (rbonedriver.Checked == true)
                    {
                        if (cbDrivers.Text == "")
                        {
                            throw new System.Exception();
                        }
                    }
                    else
                    {
                        if (cbDrivers.Text == "" || cbdrivers1.Text == "")
                        {
                            throw new System.Exception();
                        }
                    }
                }
                MethodsManager m = new MethodsManager(this);
                m.ChandeRout(idrrr);
            }

            catch (Exception ex)
            {
                MessageBox.Show("Проверьте правильность введенных данных");
            }
        }
Exemple #15
0
        private void cbtables_TextChanged(object sender, EventArgs e)
        {
            MethodsManager m = new MethodsManager(this);

            switch (cbtables.Text)
            {
            case "Маршруты":

                this.dgvman.Rows.Clear();
                this.dgvman.Columns.Clear();
                m.ShowDate();
                tbnew.Parent       = tbchange;
                tchrout.Parent     = null;
                tprepair.Parent    = null;
                tpinfdriver.Parent = null;
                tpinfosales.Parent = null;
                tabPage2.Parent    = null;
                addDriver.Parent   = null;
                tbAddbuses.Parent  = null;
                button1.Text       = "Распечатать Маршруты";
                break;

            case "Продажи":
                this.dgvman.Rows.Clear();
                this.dgvman.Columns.Clear();
                m.ShowSales();
                tbnew.Parent       = null;
                tpinfdriver.Parent = null;
                tprepair.Parent    = null;
                tchrout.Parent     = null;
                addDriver.Parent   = null;
                tbAddbuses.Parent  = null;
                tpinfosales.Parent = tbchange;
                tabPage2.Parent    = tbchange;

                button1.Text = "Распечатать Продажи";
                break;

            case "Водители":
                this.dgvman.Rows.Clear();
                this.dgvman.Rows.Clear();
                m.LoadDrivers();
                m.ShowDrivers();
                tpinfosales.Parent = null;
                tprepair.Parent    = null;
                tpinfdriver.Parent = tbchange;
                tabPage2.Parent    = null;
                tbnew.Parent       = null;
                tchrout.Parent     = null;
                tbAddbuses.Parent  = null;
                addDriver.Parent   = tbchange;
                button1.Text       = "Распечатать инф. о все Водителях";
                break;

            case "Автобусы":
                this.dgvman.Rows.Clear();
                this.dgvman.Rows.Clear();
                tpinfosales.Parent = null;
                tpinfdriver.Parent = null;
                tabPage2.Parent    = null;
                tbnew.Parent       = null;
                tchrout.Parent     = null;
                addDriver.Parent   = null;
                m.LoadBuses();
                m.ShowBuses();
                tprepair.Parent   = tbchange;
                tbAddbuses.Parent = tbchange;
                break;
            }
        }