void Save(bool btn) { try { Rembou = new Rembourssement_emp(); if (codeRembu == 0) { MessageBox.Show("Clik at first the new Button !!!", "Message...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (codeEmpr == 0 || string.IsNullOrEmpty(lab_dete.Text) || string.IsNullOrEmpty(text_mount.Text) || string.IsNullOrEmpty(lab_reste.Text)) { MessageBox.Show("Complete the mount case or select supplier please", "Messasge...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Rembou.Id = Convert.ToInt32(codeRembu); Rembou.Montant = float.Parse(text_mount.Text.Trim()); Rembou.Reste = float.Parse(lab_reste.Text.Trim()); Rembou.RefEmp = Convert.ToInt32(codeEmpr); if (btn) { Rembou.Save(Rembou); } else { MessageBox.Show("Function delete not found please create this function"); } } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, "Message...", MessageBoxButtons.OK, MessageBoxIcon.Error); } Get_Emprunt(); }
void Save(bool btn) { try { Rembou = new Rembourssement_emp(); if (Id == 0) { MessageBox.Show("Loan not exist !!!", "Message...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (codeEmpr == 0 || string.IsNullOrEmpty(lab_dete.Text) || string.IsNullOrEmpty(text_mount.Text) || string.IsNullOrEmpty(lab_reste.Text)) { MessageBox.Show("Faild to update loan...", "Messasge...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Rembou.Id = Convert.ToInt32(Id); Rembou.Montant = float.Parse(text_mount.Text.Trim()); Rembou.Reste = float.Parse(lab_reste.Text.Trim()); Rembou.RefEmp = Convert.ToInt32(codeEmpr); if (btn) { Rembou.Save(Rembou); } else { MessageBox.Show("Function delete not found please create this function"); } } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, "Message...", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void Nouveau() { Rembou = new Rembourssement_emp(); codeRembu = Rembou.Nouveau(); }