Beispiel #1
0
        public List <ViTri> search(CoSo coso, Dayy day, Tang tang)
        {
            //initDb();
            List <ViTri> tmp = new List <ViTri>();;

            if (coso == null && day == null && tang == null)
            {
                tmp = db.VITRIS.Where(c => c.coso == null && c.day == null && c.tang == null).ToList();
            }
            else if (coso != null && day == null && tang == null)
            {
                tmp = db.VITRIS.Where(c => c.coso.id == coso.id && c.day == null && c.tang == null).ToList();
            }
            else if (coso != null && day != null && tang == null)
            {
                tmp = db.VITRIS.Where(c => c.coso.id == coso.id && c.day.id == day.id && c.tang == null).ToList();
            }
            else if (coso != null && day != null && tang != null)
            {
                tmp = db.VITRIS.Where(c => c.coso.id == coso.id && c.day.id == day.id && c.tang.id == tang.id).ToList();
            }
            //if (tmp != null)
            //{
            //    foreach (ViTri item in tmp)
            //    {
            //        item.DB = db;
            //    }
            //}
            return(tmp);
        }
Beispiel #2
0
        /// <summary>
        /// Trả về
        /// </summary>
        /// <param name="coso"></param>
        /// <param name="day"></param>
        /// <param name="tang"></param>
        /// <returns></returns>
        public static ViTri request(CoSo coso, Dayy day, Tang tang)
        {
            if (coso == null && day == null && tang == null)
            {
                return(null);
            }
            ViTri final = new ViTri();

            if (tang != null)
            {
                ViTri tmp = db.VITRIS.Where(c => c.tang.id == tang.id).FirstOrDefault();
                if (tmp == null)
                {
                    final.tang = tang;
                    final.day  = tang.day;
                    final.coso = tang.day.coso;
                    return(final);
                }
                else
                {
                    return(tmp);
                }
            }
            else if (day != null)
            {
                ViTri tmp = db.VITRIS.Where(c => c.day.id == day.id && c.tang.id == null).FirstOrDefault();
                if (tmp == null)
                {
                    final.tang = null;
                    final.day  = day;
                    final.coso = day.coso;
                    return(final);
                }
                else
                {
                    return(tmp);
                }
            }
            else if (coso != null)
            {
                ViTri tmp = db.VITRIS.Where(c => c.coso.id == coso.id && c.day.id == null && c.tang.id == null).FirstOrDefault();
                if (tmp == null)
                {
                    final.tang = null;
                    final.day  = null;
                    final.coso = coso;
                    return(final);
                }
                else
                {
                    return(tmp);
                }
            }
            return(null);
        }
Beispiel #3
0
        public List <ViTri> search(Guid coso_id, Guid day_id, Guid tang_id)
        {
            //initDb();
            List <ViTri> tmp = new List <ViTri>();;

            //CoSo coso = new CoSo();
            coso = CoSo.getById(coso_id);
            //Dayy day = new Dayy();
            day = Dayy.getById(day_id);
            //Tang tang = new Tang();
            tang = Tang.getById(tang_id);
            return(search(coso, day, tang));
        }