private void metroButton2_Click(object sender, EventArgs e)
        {
            DBCustomer c = new DBCustomer();

            cusno = c.getCusNo(cmbcusnic.SelectedItem.ToString());
            DBSales s = new DBSales();

            DR = s.getSalesOrder(cusno);
            while (DR.Read())
            {
                cmbsorder.Items.Add(Convert.ToInt32(DR[0]));
            }
        }
Esempio n. 2
0
 private void btnok_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex == 0 || comboBox1.Text.Length != 10)
     {
         MessageBox.Show("Please select a NIC", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DBCustomer cus = new DBCustomer();
         nic = comboBox1.SelectedItem.ToString();
         no  = cus.getCusNo(nic);
         Sales_Orders s = new Sales_Orders();
         s.Show();
         s.setid(u_id, no);
         this.Hide();
     }
 }
Esempio n. 3
0
        private void mtUpdate_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to update?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (dr.ToString() == "Yes")
            {
                if (String.IsNullOrEmpty(txtname.Text) || String.IsNullOrEmpty(txtadd.Text) || String.IsNullOrEmpty(txtnic.Text) || txttele.Text.Length != 10)
                {
                    MessageBox.Show("Check if all the fields are filled", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }


                else
                {
                    try
                    {
                        String     name = txtname.Text;
                        String     add  = txtadd.Text;
                        String     nic  = txtnic.Text;
                        DBCustomer di   = new DBCustomer();
                        int        tele = Convert.ToInt32(txttele.Text);
                        int        no   = di.getCusNo(nic);
                        int        line = di.updateCustomer(name, add, nic, tele, u_id, no);
                        if (line == 1)
                        {
                            MessageBox.Show("Data entered successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Error,please try again", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            UpdateCustomer upd = new UpdateCustomer();

            this.Hide();
            upd.Show();
            upd.setid(u_id);
        }