Exemplo n.º 1
0
        public static void TotalRemiseContenuDoc(Contenu c, CategorieClient ca)
        {
            if ((ca != null) ? c != null : false)
            {
                ArticleCom a = c.Article;
                if (a != null)
                {
                    //Gestion Remise Sur l'article par le plan tarifaire
                    Article a_ = a.Article;
                    if ((a_ != null) ? ((a_.Plans != null) ? a_.Plans.Count > 0 : false) : false)
                    {
                        PlanTarifaire p = a_.Plans[0];
                        c.Prix      = p.Puv;
                        c.RemiseArt = MontantRemise(p.Remise_, c.Quantite, c.PrixTotal);
                    }

                    //Gestion Remise Sur l'article par le plan de remise
                    foreach (PlanRemise p in ca.Remises)
                    {
                        if (p.Article.Equals(a))
                        {
                            c.RemiseCat = MontantRemise(p.Remise, c.Quantite, c.PrixTotal);
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static ArticleCom getOneArticleCom(ArticleDepot article)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_com_article where article = " + article.Article.Id + " limit 1";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                ArticleCom       a      = new ArticleCom();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id      = Convert.ToInt64(lect["id"].ToString());
                        a.Article = (lect["article"] != null
                            ? (!lect["article"].ToString().Trim().Equals("")
                            ? BLL.ArticleBll.One(Convert.ToInt64(lect["article"].ToString()))
                            : new Article())
                            : new Article());
                        a.Designation = a.Article.Designation;
                        a.RefArt      = a.Article.RefArt;
                        a.CodeBarre   = a.Article.CodeBarre;
                        a.Image       = a.Article.Image;
                    }
                    a.Stock  = article.Stock;
                    a.Update = true;
                    lect.Close();
                }
                return(a);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Exemplo n.º 3
0
        public static List <ArticleCom> getListArticleCom(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <ArticleCom> l    = new List <ArticleCom>();
                NpgsqlCommand     Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader  lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        ArticleCom a = new ArticleCom();
                        a.Id      = Convert.ToInt64(lect["id"].ToString());
                        a.Article = (lect["article"] != null
                            ? (!lect["article"].ToString().Trim().Equals("")
                            ? BLL.ArticleBll.One(Convert.ToInt64(lect["article"].ToString()))
                            : new Article())
                            : new Article());
                        a.Designation = a.Article.Designation;
                        a.RefArt      = a.Article.RefArt;
                        a.CodeBarre   = a.Article.CodeBarre;
                        a.Image       = a.Article.Image;
                        a.Update      = true;
                        l.Add(a);
                    }
                    lect.Close();
                }
                return(l);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Exemplo n.º 4
0
        public static bool getUpdateArticleCom(ArticleCom 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);
            }
        }
Exemplo n.º 5
0
        public static ArticleCom getAjoutArticleCom(ArticleCom 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);
            }
        }
Exemplo n.º 6
0
        public ActionResult ArticleComs(ArticleCom ArticleCom)
        {
            int    aid      = Convert.ToInt32(Session["aid"]);
            int    userid   = Convert.ToInt32(Session["UserID"]);
            string textarea = Request["pingluntextarea"];

            if (ModelState.IsValid)
            {
                if (textarea != "")
                {
                    ArticleCom.UserID     = userid;
                    ArticleCom.ArticleID  = aid;
                    ArticleCom.ComTime    = System.DateTime.Now;
                    ArticleCom.ComContent = textarea;
                    articlecommanager.AddArticleCom(ArticleCom);
                }
                else
                {
                    return(Content("<script>alert('评论不能为空!');history.go(-1)</script>"));
                }
            }
            return(RedirectToAction("ArticleDetails", "ArticleShow", new { id = aid }));
        }
Exemplo n.º 7
0
        public ArticleCom GetArticleComById(int?id)
        {
            ArticleCom articleCom = db.ArticleCom.Find(id);

            return(articleCom);
        }
Exemplo n.º 8
0
 public void AddArticleCom(ArticleCom articleCom)
 {
     db.ArticleCom.Add(articleCom);
     db.SaveChanges();
 }
Exemplo n.º 9
0
 public void AddArticleCom(ArticleCom articleCom)
 {
     iarticleCom.AddArticleCom(articleCom);
 }
Exemplo n.º 10
0
        public ArticleCom GetArticleComById(int?id)
        {
            ArticleCom articleCom = iarticleCom.GetArticleComById(id);

            return(articleCom);
        }
Exemplo n.º 11
0
 public ArticleComBll(ArticleCom unArticleCom)
 {
     article = unArticleCom;
 }