Ejemplo n.º 1
0
        /// <summary>
        /// Archive le vétérinaire passé en param
        /// </summary>
        /// <param name="veto"></param>
        /// <returns></returns>
        public static bool Delete(BO.Veterinaires veto)
        {
            if (veto.CodeVeto == null)
            {
                throw new Exception(Lang.VETERINAIRES_CANT_DELETE_WITHOUT_GUID);
            }

            return(DAL.Veterinaires.Archive(veto, true));
        }
Ejemplo n.º 2
0
        private void buttonReset_Click(object sender, EventArgs e)
        {
            if (this.dataGridViewVeterinary.CurrentRow == null)
            {
                return;
            }

            BO.Veterinaires veto   = (BO.Veterinaires) this.dataGridViewVeterinary.CurrentRow.DataBoundItem;
            DialogVetoReset dialog = new DialogVetoReset(veto.Account);

            dialog.FormClosed += OnDialogClose;
            dialog.ShowDialog();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Déactive un vétérinaire
 /// </summary>
 /// <param name="veto"></param>
 /// <returns></returns>
 public static bool Archive(BO.Veterinaires vetoParams, bool archived)
 {
     try
     {
         SqlConnection cnx   = DAL.SqlConnexion.OpenConnexion();
         var           query = @"UPDATE Veterinaires SET Archive=@archive WHERE CodeVeto = @codeVeto";
         int           rowNb = cnx.Execute(query, new { codeVeto = vetoParams.CodeVeto, archive = (archived) ? 1 : 0 });
         SqlConnexion.CloseConnexion(cnx);
         return(rowNb > 0);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creer un nouveau vétérinaire et le retourne avec son identifiant
        /// </summary>
        /// <param name="veterinaires"></param>
        /// <returns></returns>
        public static BO.Veterinaires Create(BO.Veterinaires vetoParams)
        {
            try
            {
                SqlConnection cnx  = DAL.SqlConnexion.OpenConnexion();
                Guid          temp = cnx.ExecuteScalar <Guid>("EXEC ajout_veterinaire @nomveto, @archive, @account",
                                                              new {
                    nomveto = vetoParams.NomVeto,
                    archive = (vetoParams.Archive) ? 1 : 0,
                    account = vetoParams.AccountId
                });
                vetoParams.CodeVeto = temp;
                SqlConnexion.CloseConnexion(cnx);

                return(vetoParams);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 5
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (this.dataGridViewVeterinary.CurrentRow == null)
            {
                return;
            }

            BO.Veterinaires veto = (BO.Veterinaires) this.dataGridViewVeterinary.CurrentRow.DataBoundItem;
            if (veto != null)
            {
                if (BLL.VeterinairesMgr.Delete(veto))
                {
                    MessageBox.Show(
                        String.Format(GUI.Lang.SUBFORM_VETERINARY_SUCCEFULL_ARCHIVE, veto.NomVeto),
                        GUI.Lang.SUBFORM_VETERINARY_TITLE_SUCCEFULL_ARCHIVE,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information
                        );
                }
            }

            this.dataGridViewVeterinary.DataSource = null;
            this.dataGridViewVeterinary.DataSource = BLL.VeterinairesMgr.GetAll(false);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creer le vétérinaire
 /// et le retourne avec son id
 /// </summary>
 /// <param name="veterinaires"></param>
 public static BO.Veterinaires Create(BO.Veterinaires veterinaires)
 {
     return(DAL.Veterinaires.Create(veterinaires));
 }