private void RibbonButtonAdd_Click(object sender, RoutedEventArgs e) { Add add = new Add(); add.ShowDialog(); }
private void RibbonButtonEdit_Click(object sender, RoutedEventArgs e) { if (MainPageEquipmentDatagrid.SelectedValue != null) { DataRowView drv = (DataRowView)MainPageEquipmentDatagrid.SelectedItem; String res = (drv["Equipment no"]).ToString(); try { // Open the Database Connection _Conn.Open(); // Command String string _Select = @"SELECT * FROM Equipment WHERE `Equipment no`='" + res + "'"; // Initialize the command query and connection MySqlCommand _cmd = new MySqlCommand(_Select, _Conn); MySqlDataReader _reader = _cmd.ExecuteReader(); Add addDup = new Add(); while (_reader.Read()) { addDup.TextBoxEquipmentNo.Text = _reader["Equipment no"].ToString(); addDup.TextBoxDescription.Text = _reader["Description"].ToString(); addDup.TextBoxYear.Text = _reader["Year"].ToString(); addDup.TextBoxMake.Text = _reader["Make"].ToString(); addDup.TextBoxModel.Text = _reader["Model"].ToString(); addDup.TextBoxSerial.Text = _reader["Serial no"].ToString(); addDup.TextBoxType.Text = _reader["Type"].ToString(); addDup.TextBoxColor.Text = _reader["Color"].ToString(); addDup.TextBoxIdentification.Text = _reader["Identification"].ToString(); addDup.TextBoxStatus.Text = _reader["Status"].ToString(); addDup.TextBoxOwnership.Text = _reader["Ownership"].ToString(); addDup.TextBoxCustomer.Text = _reader["Customer"].ToString(); addDup.TextBoxJobSite.Text = _reader["Job site"].ToString(); //addDup.TextBoxE.Text = _reader["Email recipients"`.ToString(); addDup.TextBoxMaintSched.Text = _reader["Maint schedule"].ToString(); addDup.TextBoxNoMeter.Text = _reader["No meter"].ToString(); addDup.TextBoxBaseMeter.Text = _reader["Base meter"].ToString(); addDup.TextBoxBaseDate.Text = _reader["Base date"].ToString(); addDup.TextBoxAssignTo.Text = _reader["Assigned to"].ToString(); addDup.TextBoxCostCenter.Text = _reader["Cost center"].ToString(); addDup.TextBoxParent.Text = _reader["Parent"].ToString(); addDup.TextBoxCategory.Text = _reader["Category"].ToString(); addDup.TextBoxCustom1.Text = _reader["Custom1"].ToString(); addDup.TextBoxCustom2.Text = _reader["Custom2"].ToString(); addDup.TextBoxCustom3.Text = _reader["Custom3"].ToString(); addDup.TextBoxCustom4.Text = _reader["Custom4"].ToString(); addDup.TextBoxCustom5.Text = _reader["Custom5"].ToString(); addDup.TextBoxCustom6.Text = _reader["Custom6"].ToString(); addDup.TextBoxCustom7.Text = _reader["Custom7"].ToString(); } addDup.TextBoxEquipmentNo.IsEnabled = false; addDup.operation = "1"; addDup.ShowDialog(); } catch (Exception) { } } }
private void Addbtn_Click(object sender, RoutedEventArgs e) { Add w = new Add(); w.ShowDialog(); }