示例#1
0
        private void BtnCustomers_Click(object sender, EventArgs e)
        {
            if (!AdminAdministrator.Instance.PnlContainer.Controls.ContainsKey("AdminCustomer"))
            {
                AdminCustomer cust = new AdminCustomer();
                cust.Dock = DockStyle.Fill;
                AdminAdministrator.Instance.PnlContainer.Controls.Add(cust);

                cust.ShowCustomersInformation();
            }
            AdminAdministrator.Instance.PnlContainer.Controls["AdminCustomer"].BringToFront();
            AdminAdministrator.Instance.BackButton.Visible = true;
        }
示例#2
0
        private void BtnCustomers_Click(object sender, EventArgs e)
        {
            if (!AdminAdministrator.Instance.PnlContainer.Controls.ContainsKey("AdminCustomer"))
            {
                AdminCustomer custom = new AdminCustomer();
                custom.Dock = DockStyle.Fill;
                AdminAdministrator.Instance.PnlContainer.Controls.Add(custom);

                // Store the value of username text into PassCanName variable so it can pass to Cancel Invoice
                PassCanName = lblUsername.Text;
                custom.ShowCustomersInformation();
            }
            AdminAdministrator.Instance.PnlContainer.Controls["AdminCustomer"].BringToFront();
            AdminAdministrator.Instance.BackButton.Visible          = true;
            AdminAdministrator.Instance.BackToInvoiceButton.Visible = false;
            AdminAdministrator.Instance.BackToReportsButton.Visible = false;
        }
        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;
                }
            }
        }