public AdminGroupByRoute(AdminRoutes rou)
        {
            InitializeComponent();
            cn = new SqlConnection(dbcon.MyConnection());

            route = rou;
        }
        public AdminAddRoutes(AdminRoutes rr)
        {
            InitializeComponent();
            cn    = new SqlConnection(dbcon.MyConnection());
            rlist = rr;

            this.KeyPreview = true;
        }
示例#3
0
        private void BtnRoutes_Click(object sender, EventArgs e)
        {
            if (!AdminAdministrator.Instance.PnlContainer.Controls.ContainsKey("AdminRoutes"))
            {
                AdminRoutes route = new AdminRoutes();
                route.Dock = DockStyle.Fill;
                AdminAdministrator.Instance.PnlContainer.Controls.Add(route);

                route.ShowRoutes();
            }
            AdminAdministrator.Instance.PnlContainer.Controls["AdminRoutes"].BringToFront();
            AdminAdministrator.Instance.BackButton.Visible = true;
        }
        private void BtnSave_Click_1(object sender, EventArgs e)
        {
            if (txtCustomerName.Text == String.Empty)
            {
                WarningIndicator.Visible  = true;
                WarningIndicator.Location = new System.Drawing.Point(486, 104);
                txtCustomerName.Focus();
                return;
            }
            if (txtOwnerName.Text == String.Empty)
            {
                WarningIndicator.Visible  = true;
                WarningIndicator.Location = new System.Drawing.Point(486, 175);
                txtOwnerName.Focus();
                return;
            }
            if (txtAddress.Text == String.Empty)
            {
                WarningIndicator.Visible  = true;
                WarningIndicator.Location = new System.Drawing.Point(485, 246);
                txtAddress.Focus();
                return;
            }
            if (txtRoute.Text == String.Empty)
            {
                WarningIndicator.Visible  = true;
                WarningIndicator.Location = new System.Drawing.Point(276, 311);
                txtRoute.Focus();
                return;
            }
            else
            {
                cn.Open();
                cm = new SqlCommand("SELECT route FROM tblRoutes WHERE route = @route", cn);
                cm.Parameters.AddWithValue("@route", txtRoute.Text);
                da = new SqlDataAdapter(cm);
                dt = new DataTable();
                da.Fill(dt);
                cn.Close();

                if (dt.Rows.Count >= 1)
                {
                    InsertCustomerInformation();
                    MessageBox.Show("Customer Information Successfully Saved.", "Saving New Customer Informtaion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cn.Close();

                    ClearCustomer();
                    CSlist.ShowCustomersInformation();
                    this.Hide();
                }
                else if (dt.Rows.Count <= 0)
                {
                    InsertRoute();
                    AdminRoutes rout = new AdminRoutes();
                    rout.ShowRoutes();
                    InsertCustomerInformation();

                    MessageBox.Show("Customer Information Successfully Saved Into Database.", "Customer Information Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cn.Close();

                    ClearCustomer();
                    CSlist.ShowCustomersInformation();
                    this.Dispose();
                }
                else
                {
                    return;
                }
            }
        }