コード例 #1
0
 public static Cumul Instance()
 {
     if (instance == null)
     {
         instance = new Cumul();
     }
     return(instance);
 }
コード例 #2
0
ファイル: ArtService.cs プロジェクト: Abbassimohamed/campus
        public List <Cumul> getallcumulbyarticlebeforedate(string codeart, DateTime date1)
        {
            List <Piece_cumulent>    entrees = db.Piece_cumulent.Where(aa => aa.Codearticle == codeart).ToList();
            List <Piece_cumulsortie> sorties = db.Piece_cumulsortie.Where(aa => aa.Codearticle == codeart).ToList();
            List <Piece_bonret>      retours = db.Piece_bonret.Where(bb => bb.Codearticle == codeart).ToList();
            List <Cumul>             cums    = new List <Cumul>();

            foreach (Piece_cumulent pcent in entrees)
            {
                Cumul cm = new Cumul();
                cm.date   = (DateTime)pcent.date;
                cm.entree = pcent.quantite.ToString();
                cm.nbe    = pcent.Codecumul.ToString();
                cm.nbs    = "";
                cm.nbl    = "";
                cm.nbr    = "";

                cm.nfact  = "";
                cm.sortie = "";
                cm.retour = "";
                CumulEnt cment = new CumulEnt();
                cment      = cmentser.getcumulbycode((Int32)pcent.Codecumul);
                cm.nomtier = cment.nomfr;
                cums.Add(cm);
            }
            foreach (Piece_cumulsortie pcent in sorties)
            {
                Cumul cm = new Cumul();

                cm.date   = (DateTime)pcent.date;
                cm.sortie = pcent.quantite.ToString();
                cm.nbs    = pcent.Codecumul.ToString();
                cm.nbe    = "";
                cm.nbl    = "";
                cm.nbr    = "";
                cm.nfact  = "";
                cm.entree = "";
                cm.retour = "";
                Cumulsortie cmsort = new Cumulsortie();
                cmsort = cmsortser.getcumulsortiebycode((Int32)pcent.Codecumul);

                cm.nomtier = cmsort.nomfr;
                cums.Add(cm);
            }
            foreach (Piece_bonret pcent in retours)
            {
                Cumul cm = new Cumul();

                cm.date   = (DateTime)pcent.date;
                cm.retour = pcent.quantite.ToString();
                cm.nbr    = pcent.Codecumul.ToString();
                cm.nbe    = "";
                cm.nbl    = "";
                cm.nbs    = "";
                cm.nfact  = "";
                cm.entree = "";
                cm.sortie = "";
                BonRetour br = new BonRetour();
                br         = brser.getretourbycode((Int32)pcent.Codecumul);
                cm.nomtier = br.nomfr;
                cums.Add(cm);
            }
            return(cums.Where(aa => aa.date <= date1).OrderBy(aa => aa.date).ToList());
        }