Esempio n. 1
0
    IEnumerable <RightMenuModel> getRmms(List <int> tmpRmids)
    {
        //var local_db = new DbRepository<RightMenuModel>();
        //local_db.DataService("vesali.db");
        List <RightMenuModel> result = new List <RightMenuModel>();

        foreach (int tmpId in tmpRmids)
        {
            RightMenuModel rmm = local_db.SelectOne <RightMenuModel>((tempt) =>
            {
                if (tempt.rm_id == tmpId)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            });
            if (rmm != null)
            {
                result.Add(rmm);
            }
        }

        return(result);
    }
Esempio n. 2
0
    public static void update_RightMenuModel_db(string dbfile)
    {
        DbRepository <RightMenuModel> temp_db;

        temp_db = new DbRepository <RightMenuModel>();
        temp_db.DataService(dbfile);
        temp_db.CreateTable();
        IEnumerable <RightMenuModel> res = temp_db.Select <RightMenuModel>((temp_fbx) =>
        {
            if (temp_fbx.rm_id >= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });


        if (res.GetEnumerator().MoveNext())
        {
            DbRepository <RightMenuModel> anim_db;
            anim_db = new DbRepository <RightMenuModel>();
            anim_db.DataService("vesali.db");
            foreach (RightMenuModel item in res)
            {
                RightMenuModel fbx_info = anim_db.SelectOne <RightMenuModel>((temp_fbx_anim) =>
                {
                    if (temp_fbx_anim.rm_id == item.rm_id)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                });


                if (fbx_info != null)
                {
                    anim_db.Update(item);
                }
                else
                {
                    anim_db.Insert(item);
                }
            }
            anim_db.Close();
        }
        temp_db.Close();
    }