private void button3_Click(object sender, EventArgs e) { this.Hide(); Screen3 s3 = new Screen3(u_id); s3.Show(); }
private void button1_Click(object sender, EventArgs e) { string no = v_no.Text; string name = v_name.Text; //string user_id = u_id; string model = v_model.Text; string type = v_type.selectedValue; // combobox string colour = u_colour.Text; string LicenseIssuDate = v_LIssuDate.Value.ToString("yyyy-MM-dd"); string LicenseNo = vL_no.Text; string LicenseExpiryDate = L_expiryDate.Value.ToString("yyyy-MM-dd"); SqlConnection con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["WheelsOnCharge"].ConnectionString; con.Open(); SqlDataAdapter adapter = new SqlDataAdapter("select CNIC from tbl_user where Email ='" + u_id + "'", con); DataTable dt = new DataTable(); adapter.Fill(dt); string user_id = dt.Rows[0][0].ToString(); if (no != null && name != null && user_id != null && model != null && type != null && colour != null && LicenseNo != null && LicenseIssuDate != null && LicenseExpiryDate != null) { try { SqlCommand cmd = new SqlCommand("sp_VehicleDails", con); cmd.CommandType = CommandType.StoredProcedure; //calling stored Procedures cmd.Parameters.Add("@u_id", SqlDbType.NVarChar).Value = user_id; cmd.Parameters.Add("@v_no", SqlDbType.NVarChar).Value = no; cmd.Parameters.Add("@v_name", SqlDbType.NVarChar).Value = name; cmd.Parameters.Add("@v_model", SqlDbType.NVarChar).Value = model; cmd.Parameters.Add("@v_colour", SqlDbType.NVarChar).Value = colour; cmd.Parameters.Add("@v_type", SqlDbType.NVarChar).Value = type; cmd.Parameters.Add("@License_no", SqlDbType.NVarChar).Value = LicenseNo; cmd.Parameters.Add("@License_DOI", SqlDbType.NVarChar).Value = LicenseIssuDate; cmd.Parameters.Add("@License_DOE", SqlDbType.NVarChar).Value = LicenseExpiryDate; cmd.ExecuteNonQuery(); con.Close(); con.Dispose(); MessageBox.Show("Vehicle added Sccessfully!!!", "Logs", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); Screen3 s3 = new Screen3(u_id); s3.Show(); } catch { MessageBox.Show("Error was encountered while adding vehicle! contact Database Admin!", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } } else { MessageBox.Show("Some Fields are empty", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { string Date = dateTimePicker1.Value.ToString("yyyy-MM-dd"); string serviced_part = comboBox1.selectedValue; SqlConnection con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["WheelsOnCharge"].ConnectionString; con.Open(); SqlDataAdapter adapter = new SqlDataAdapter("select CNIC from tbl_user where Email ='" + u_id + "'", con); DataTable dt = new DataTable(); adapter.Fill(dt); string user_id = dt.Rows[0][0].ToString(); try { SqlCommand cmd = new SqlCommand("sp_maintenance", con); cmd.CommandType = CommandType.StoredProcedure; //calling stored Procedures cmd.Parameters.Add("@userid", SqlDbType.NVarChar).Value = user_id; cmd.Parameters.Add("@vehicleno", SqlDbType.NVarChar).Value = v_id; cmd.Parameters.Add("@date", SqlDbType.NVarChar).Value = Date; cmd.Parameters.Add("@hmmmm", SqlDbType.NVarChar).Value = "[" + serviced_part + "]"; cmd.ExecuteNonQuery(); con.Close(); con.Dispose(); MessageBox.Show("Log Entered Sccessfully!!!", "Logs", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); Screen3 s3 = new Screen3(u_id); s3.Show(); } catch { MessageBox.Show("Error in entering logs", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { user_email = login_email.Text; string pass = login_password.Text; SqlConnection con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["WheelsOnCharge"].ConnectionString; SqlDataAdapter adapter = new SqlDataAdapter("select count(*) from tbl_user where email ='" + user_email + "' and password ='******'", con); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { MessageBox.Show("Welcome!!!", "login Sucessful", MessageBoxButtons.OK, MessageBoxIcon.Information); Screen3 f3 = new Screen3(user_email); this.Hide(); f3.Show(); } else { MessageBox.Show("Username or Password is Incorrect!!!", "Login Failed", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } con.Close(); }
private void Show_Click(object sender, RoutedEventArgs e) { Screen3.Show(); }