private void btn_Delete_Click(object sender, RoutedEventArgs e) { Messagebox msg = new Messagebox(); string a = " Delete from Driver where D_ID = '" + cbox_did.Text + "'"; int line = obj.save_update_delete(a); if (line == 1) { msg.informationMsg("Data deleted successfully"); msg.Show(); } else { msg.errorMsg("Sorry, couldn't delete your data.Please try again"); msg.Show(); } cbox_did.Items.Clear(); txt_Lnum.Clear(); txt_Name.Clear(); txt_Tp.Clear(); txt_Address.Clear(); img.Source = null; }
private void btn_mic_on_Click(object sender, RoutedEventArgs e) { Messagebox msg = new Messagebox(); btn_mic_on.Visibility = Visibility.Hidden; btn_mic_off.Visibility = Visibility.Visible; vc.stopVoice(); msg.informationMsg("Voice Command Disabled"); msg.Show(); }
private void btn_submit_Click(object sender, RoutedEventArgs e) { Messagebox msg = new Messagebox(); int i = db.save_update_delete("insert into User_Login (Uname,Upass,Fname,Lname) values ('" + txt_uname.Text + "','" + hc.PassHash(pbox_pass.Password) + "','" + txt_fname.Text + "','" + txt_lname.Text + "')"); if (i == 1) { msg.informationMsg("Account Successfully Registered!"); msg.Show(); } else { msg.errorMsg("Sorry, couldn't save your data.Please try again"); msg.Show(); } }
private void btn_mic_off_Click(object sender, RoutedEventArgs e) { Messagebox msg = new Messagebox(); try { btn_mic_on.Visibility = Visibility.Visible; btn_mic_off.Visibility = Visibility.Hidden; msg.informationMsg("Voice Command Activated"); vc.startVoice(); msg.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_save_Click(object sender, RoutedEventArgs e) { try { Messagebox msg = new Messagebox(); string name = System.IO.Path.GetFileName(path); string destinationPath = GetDestinationPath(name); File.Copy(path, destinationPath, true); string q = "update Vehicle set L_Plate='" + cbox_lplate.Text + "',Year='" + cbox_year.Text + "',Make='" + cbox_make.Text + "',Model='" + txt_model.Text + "',Category='" + cbox_category.Text + "'" + ",Cost_Per_Month='" + txt_cpmonth.Text + "',Cost_Per_Week='" + txt_cpweek.Text + "',Extra_Cost='" + txt_extra.Text + "',O_ID='" + cbox_oid.Text + "',Lend_Date='" + txt_lndate.Text + "'," + "S_date='" + txt_sdate.Text + "',E_date='" + txt_exdate.Text + "', V_Path = '" + destinationPath + "' where L_Plate = '" + old_id + "'"; int i = db.save_update_delete(q); if (i == 1) { msg.informationMsg("Data Updated Successfully!"); msg.Show(); } else { msg.errorMsg("Unable to Update Data.Please check again"); msg.Show(); } } catch (ArgumentNullException) { Messagebox msg = new Messagebox(); msg.errorMsg("Please upload a photo"); msg.Show(); } catch (System.Data.SqlClient.SqlException) { Messagebox msg = new Messagebox(); msg.errorMsg("Please fill the form correctly. Database Error"); msg.Show(); } catch (Exception ex) { Messagebox msg = new Messagebox(); msg.errorMsg("Oops something went worng. " + ex.Message); msg.Show(); } }
private void btn_save_Click(object sender, RoutedEventArgs e) { try { Messagebox msg = new Messagebox(); string a = "update Owner set O_ID='" + cmb_oid.Text + "' , O_NIC = '" + txt_nic.Text + "' , O_path = '" + path + "' , O_Tel = " + txt_contact.Text + " ,O_Name = '" + txt_name.Text + "', O_Address = '" + txt_address.Text + "' where O_ID = '" + cmb_oid.Text + "' "; string name = System.IO.Path.GetFileName(path); string destinationPath = GetDestinationPath(name); File.Copy(path, destinationPath, true); // txt_did.Text = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); int line = db.save_update_delete(a); if (line == 1) { msg.informationMsg("Data Updated Successfully!"); msg.Show(); } else { msg.errorMsg("Unable to Update Data.Please check again"); msg.Show(); } } catch (ArgumentNullException) { Messagebox msg = new Messagebox(); msg.errorMsg("Please upload a photo"); msg.Show(); } catch (System.Data.SqlClient.SqlException) { Messagebox msg = new Messagebox(); msg.errorMsg("Please fill the form correctly. Database Error"); msg.Show(); } catch (Exception ex) { Messagebox msg = new Messagebox(); msg.errorMsg("Oops something went worng. " + ex.Message); msg.Show(); } }
private void btn_update_Click(object sender, RoutedEventArgs e) { try { string a = " update Booking set BK_date = '" + date_book.Text + "', S_date='" + date_pick.Text + "', L_date='" + date_lend.Text + "' where BK_No = '" + cmb_bid.Text + "'"; string b = " update Car_Booking set VNO='" + cmb_vid.Text + "' , DNO = '" + cmb_did.Text + "' , BNO = '" + cmb_bid.Text + "' where CNO = '" + cmb_cid.Text + "'"; int x = db.save_update_delete(a); int y = db.save_update_delete(b); if (x == 1 && y == 1) { Messagebox msg = new Messagebox(); msg.informationMsg("Data Updated Successfully!"); msg.Show(); btn_bill.Visibility = Visibility.Visible; } else { Messagebox msg = new Messagebox(); msg.errorMsg("Unable to Update Data.Please check again"); msg.Show(); } } catch (System.Data.SqlClient.SqlException) { Messagebox msg = new Messagebox(); msg.errorMsg("Please fill the form correctly. Database Error"); msg.Show(); } catch (Exception ex) { Messagebox msg = new Messagebox(); msg.errorMsg("Oops something went worng. " + ex.Message); msg.Show(); } }