private void button5_Click(object sender, EventArgs e) { fillwithalljobs(); CID2text.Clear(); OPsearchbutt.Enabled = true; AllJobButt.Enabled = false; }
private void OPsearchbutt_Click(object sender, EventArgs e) { ConnectionManagerOffsite newconn = new ConnectionManagerOffsite(); newconn.OpenCon(); SqlDataAdapter sda1 = new SqlDataAdapter("select o.JobID, o.JobType, o.JobStatus, o.StartDate, o.CustomerNIC from OffSiteJob o where o.JobStatus = 'ON' ", ConnectionManagerOffsite.conn); DataTable dt = new DataTable(); sda1.Fill(dt); OffsitejobsdataGridView.DataSource = dt; CID2text.Clear(); OPsearchbutt.Enabled = false; AllJobButt.Enabled = true; }
private void Jobsearchbutt_Click(object sender, EventArgs e) { if (CID2text.TextLength != 10) { MessageBox.Show("Customer NIC should be 10 characters long"); } else if (!CID2text.ToString().EndsWith("v") || CIDtext.ToString().EndsWith("V")) { MessageBox.Show("Customer NIC should end in either 'v' or 'V'"); } else { OffsiteObject off = new OffsiteObject(); off.CID = CID2text.Text; ConnectionManagerOffsite newconn = new ConnectionManagerOffsite(); newconn.OpenCon(); SqlCommand checkCID = new SqlCommand("SELECT * FROM OffSiteJob WHERE ([CustomerNIC] = @CID)", ConnectionManagerOffsite.conn); checkCID.Parameters.AddWithValue("@CID", off.CID); SqlDataReader reader3 = checkCID.ExecuteReader(); if (reader3.HasRows) { reader3.Close(); off.CID = CID2text.Text; Console.WriteLine(off.CID); SqlDataAdapter sda1 = new SqlDataAdapter("select o.JobID, o.JobType, o.JobStatus, o.StartDate, o.CustomerNIC from OffSiteJob o where o.CustomerNIC = '" + off.CID + "' ", ConnectionManagerOffsite.conn); DataTable dt = new DataTable(); sda1.Fill(dt); OffsitejobsdataGridView.DataSource = dt; OPsearchbutt.Enabled = true; AllJobButt.Enabled = true; } else { MessageBox.Show("Invalid Customer NIC"); } } }