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; } } } } }
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); } }
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); } }
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); } }
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); } }
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 })); }
public ArticleCom GetArticleComById(int?id) { ArticleCom articleCom = db.ArticleCom.Find(id); return(articleCom); }
public void AddArticleCom(ArticleCom articleCom) { db.ArticleCom.Add(articleCom); db.SaveChanges(); }
public void AddArticleCom(ArticleCom articleCom) { iarticleCom.AddArticleCom(articleCom); }
public ArticleCom GetArticleComById(int?id) { ArticleCom articleCom = iarticleCom.GetArticleComById(id); return(articleCom); }
public ArticleComBll(ArticleCom unArticleCom) { article = unArticleCom; }