private void btnEdito_Click(object sender, EventArgs e) { try { if (bartificial_PO.IsChecked == true) { fusha.BariArtificial = true; } else if (bartificial_JO.IsChecked == true) { fusha.BariArtificial = false; } if (fmbuluar_PO.IsChecked == true) { fusha.FushaEMbuluar = true; } else if (fmbuluar_JO.IsChecked == true) { fusha.FushaEMbuluar = false; } fusha.Gjatesia = txtGjatesia.Text; fusha.Gjeresia = txtGjeresia.Text; fusha.CmimiFushes = double.Parse(txtcmimiifushes.Text); BussinessFusha.EditFusha(fusha.FushaID, fusha); MessageBox.Show("Fusha u editua me sukses"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void Show() { try { fusha = BussinessFusha.GetFushaById(fushaid); if (fusha.FushaEMbuluar == true) { fmbuluar_PO.IsChecked = true; } if (fusha.FushaEMbuluar == false) { fmbuluar_JO.IsChecked = true; } if (fusha.BariArtificial == true) { bartificial_PO.IsChecked = true; } if (fusha.BariArtificial == false) { bartificial_JO.IsChecked = true; } txtGjatesia.Text = fusha.Gjatesia; txtGjeresia.Text = fusha.Gjeresia; txtcmimiifushes.Text = fusha.CmimiFushes.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnShto_Click(object sender, EventArgs e) { try { string gjatesia = txtGjatesia.Text; string gjeresia = txtGjeresia.Text; double cmimi = double.Parse(txtcmimiifushes.Text); bool fushaEmbuluar = false; if (fmbuluar_PO.IsChecked) { fushaEmbuluar = true; } if (fmbuluar_JO.IsChecked) { fushaEmbuluar = false; } bool bariartificial = false; if (bartificial_PO.IsChecked) { bariartificial = true; } if (bartificial_JO.IsChecked) { bariartificial = false; } if (String.IsNullOrEmpty(gjatesia) || String.IsNullOrEmpty(gjeresia) || String.IsNullOrEmpty(txtcmimiifushes.Text)) { MessageBox.Show("Mbushini te gjitha hapsirat e kerkuara"); } else { Fusha newFusha = new Fusha() { BariArtificial = bariartificial, FushaEMbuluar = fushaEmbuluar, Gjatesia = gjatesia, Gjeresia = gjeresia, CmimiFushes = cmimi }; BussinessFusha.InsertFusha(newFusha); MessageBox.Show("U shtua nje fushe e re"); this.Close(); } } catch (FormatException ex) { MessageBox.Show("Gabim ne tip te te dhenave"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }