コード例 #1
0
ファイル: DAOTaxe.cs プロジェクト: mhassana/icones
        public Taxe rechercher(string code)
        {
            Taxe u = new Taxe();

            try
            {
                u = db.Taxes.First(x => x.codeTAXE == code);

                //verification de l'existence de l'objet dans la bd
                if (u != null)
                {
                    return(u);
                }

                else
                {
                    u.libelle = "Aucun enregistrement trouve.";
                    return(null);
                }
            }
            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }

            return(u);
        }
コード例 #2
0
ファイル: DAOTaxe.cs プロジェクト: mhassana/icones
        public Taxe supprimer(Taxe u)
        {
            if (u == null)
            {
                u = new Taxe();
            }
            try
            {
                if (db.Taxes.First(x => x.codeTAXE == u.codeTAXE) != null)
                {
                    //sauvegarde des nouvelles informations

                    db.supprimerTaxe(u.codeTAXE, u.codeU);
                }

                else
                {
                    u.libelle = "Cet enregistrement n'existe pas dans la base de donnees.";
                }
            }
            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }
            return(u);
        }
コード例 #3
0
ファイル: TaxeDao.cs プロジェクト: dowesw/GESTION_CAISSE
        public static Taxe getOneTaxe(long id)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_base_taxes where id = " + id + "";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                Taxe             a      = new Taxe();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id          = Convert.ToInt64(lect["id"].ToString());
                        a.CodeAppel   = lect["code_appel"].ToString();
                        a.CodeTaxe    = lect["code_taxe"].ToString();
                        a.Designation = lect["designation"].ToString();
                        a.Taux        = (Double)((lect["taux"] != null) ? (!lect["taux"].ToString().Trim().Equals("") ? lect["taux"] : 0) : 0);
                        a.Update      = true;
                    }
                    lect.Close();
                }
                return(a);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
コード例 #4
0
 public Taxe Add(Taxe Taxe)
 {
     try
     {
         _TaxeRepository.Add(Taxe);
         return(Taxe);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
 public Taxe Update(Taxe Taxe)
 {
     try
     {
         _context.Update(Taxe);
         _context.SaveChanges();
         return(Taxe);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #6
0
 public Taxe Add(Taxe Taxe)
 {
     try
     {
         _context.Taxes.Add(Taxe);
         _context.SaveChanges();
         return(Taxe);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #7
0
        public ActionResult <Taxe> Put([FromBody] Taxe Taxe)
        {
            var res = _TaxeService.Update(Taxe);

            if (res is null)
            {
                return(BadRequest());
            }
            else
            {
                return(Taxe);
            }
        }
コード例 #8
0
ファイル: TaxeCore.cs プロジェクト: BignonAG/DatabaseCodif
        public async Task <Taxe> Get(long Id)
        {
            Taxe result = null;

            try
            {
                result = await _context.Taxes.FindAsync(Convert.ToInt64(Id));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(result);
        }
コード例 #9
0
ファイル: TaxeController.cs プロジェクト: mhassana/icones
        public ActionResult Edit(Taxe x)
        {
            try
            {
                dao.modifier(x);
                // TODO: Add update logic here

                return(RedirectToAction("afficherTous"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #10
0
ファイル: DAOTaxe.cs プロジェクト: mhassana/icones
        public Taxe rechercherUnique(Taxe m)
        {
            Taxe u = new Taxe();

            try
            {
                u = db.Taxes.First(x => x.libelle == m.libelle);
            }

            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }

            return(u);
        }
コード例 #11
0
ファイル: TaxeController.cs プロジェクト: mhassana/icones
        // GET: Taxe/Details/5
        public ActionResult Details(string code)
        {
            Taxe x = dao.rechercher(code);

            TaxeModel pm = new TaxeModel
            {
                codeTAXE = x.codeTAXE,
                libelle  = x.libelle,
                taux     = x.taux
            };

            if (x == null)
            {
                return(HttpNotFound());
            }
            return(View(pm));
        }
コード例 #12
0
ファイル: DAOTaxe.cs プロジェクト: mhassana/icones
        public Taxe ajouter(Taxe u)
        {
            if (u == null)
            {
                u = new Taxe();
            }
            try
            {
                db.creerTaxe(u.libelle, u.taux, u.codeU);
            }
            catch (Exception ex)
            {
                u.libelle = ex.StackTrace;
            }

            return(u);
        }
コード例 #13
0
ファイル: DAOTaxe.cs プロジェクト: mhassana/icones
        public List <Taxe> rechercherParMC(Func <Taxe, bool> predicate)
        {
            List <Taxe> us = new List <Taxe>();

            try
            {
                us = db.Taxes.Where(predicate).ToList();
            }
            catch (Exception ex)
            {
                Taxe p = new Taxe();
                p.libelle = ex.StackTrace;
                us.Add(p);
            }

            return(us);
        }
コード例 #14
0
ファイル: DAOTaxe.cs プロジェクト: mhassana/icones
        public List <Taxe> rechercherTous()
        {
            List <Taxe> us = new List <Taxe>();

            try
            {
                us = db.Taxes.ToList();
            }
            catch (Exception ex)
            {
                Taxe p = new Taxe();
                p.libelle = ex.StackTrace;
                us.Add(p);
            }

            return(us);
        }
コード例 #15
0
ファイル: TaxeController.cs プロジェクト: mhassana/icones
        // GET: Taxe/Edit/5
        public ActionResult Edit(string code)
        {
            Taxe x = dao.rechercher(code);

            TaxeModel pm = new TaxeModel
            {
                libelle = x.libelle,
                taux    = x.taux,


                ///*******
                ///
                codeU    = x.codeU,
                codeTAXE = x.codeTAXE
            };

            return(View(pm));
        }
コード例 #16
0
ファイル: TaxeDao.cs プロジェクト: dowesw/GESTION_CAISSE
        public static Taxe getAjoutTaxe(Taxe a)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string        insert = "";
                NpgsqlCommand cmd    = new NpgsqlCommand(insert, con);
                cmd.ExecuteNonQuery();
                a.Id = getCurrent();
                return(a);
            }
            catch
            {
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
コード例 #17
0
ファイル: TaxeDao.cs プロジェクト: dowesw/GESTION_CAISSE
        public static bool getUpdateTaxe(Taxe a)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string        update = "";
                NpgsqlCommand Ucmd   = new NpgsqlCommand(update, con);
                Ucmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception e)
            {
                Messages.Exception(e);
                return(false);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
コード例 #18
0
ファイル: TaxeDao.cs プロジェクト: dowesw/GESTION_CAISSE
        public static List <Taxe> getListTaxe(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <Taxe>      l    = new List <Taxe>();
                NpgsqlCommand    Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        Taxe a = new Taxe();
                        a.Id          = Convert.ToInt64(lect["id"].ToString());
                        a.CodeAppel   = lect["code_appel"].ToString();
                        a.CodeTaxe    = lect["code_taxe"].ToString();
                        a.Designation = lect["designation"].ToString();
                        a.Taux        = (Double)((lect["taux"] != null) ? (!lect["taux"].ToString().Trim().Equals("") ? lect["taux"] : 0) : 0);
                        a.Update      = true;
                        l.Add(a);
                    }
                    lect.Close();
                }
                return(l);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
コード例 #19
0
ファイル: TaxeController.cs プロジェクト: mhassana/icones
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                string s = "";
                s = collection["taux"];
                char decimalSymbol = ',';
                var  curr          = System.Windows.Forms.Application.CurrentCulture.NumberFormat.NumberDecimalSeparator;

                s = s.Replace(".", curr).Replace(decimalSymbol.ToString(), curr);

                Taxe x = new Taxe
                {
                    libelle = collection["libelle"],
                    taux    = decimal.Parse(s),


                    //*******

                    codeU = collection["codeU"]
                            //date_c = DateTime.Now
                };

                dao.ajouter(x);


                return(RedirectToAction("afficherTous"));
            }
            catch (Exception ex)
            {
                ViewBag.Erreur = ex.Message;
                return(View());
            }
        }
コード例 #20
0
 public HttpResponseMessage Post([FromBody] Taxe row)
 {
     _process.Insert(row, UpdatedId);
     return(Request.CreateResponse(HttpStatusCode.OK));
 }
コード例 #21
0
ファイル: TaxeBll.cs プロジェクト: dowesw/GESTION_CAISSE
 public TaxeBll(Taxe unTaxe)
 {
     taxe = unTaxe;
 }
コード例 #22
0
 // PUT: api/Users/5
 public HttpResponseMessage Put(Guid id, [FromBody] Taxe row)
 {
     _process.Update(id, row, UpdatedId);
     return(Request.CreateResponse(HttpStatusCode.OK));
 }