Beispiel #1
0
        public void UpdateAllStuData()
        {

            Posts p = hc.GetAllStu();
            DsPostVerid dpv = hc.GetSerStuVer();
            List<DSstu> dslist = DataSwitch.JsonToList<DSstu>(p.Jsons);
            dop.InsandDelStuData(dslist);
            dop.UpdataVer(dpv,0);
        }
Beispiel #2
0
 public void UpdataDiffStuData()
 {
     DsPostVerid ldpv = dop.GetLocalDPV("0");
     DsPostVerid sdpv = hc.GetSerStuVer();
     List<Posts> plist = hc.StuDiff(sdpv, ldpv);
     List<DSstu> dslist = new List<DSstu>();
     foreach (var p in plist)
     {
         List<DSstu> dl = DataSwitch.JsonToList<DSstu>(p.Jsons);
         dslist.AddRange(dl);
     }
     dop.InsandDelStuData(dslist);
     dop.UpdataVer(sdpv,0);
 }
Beispiel #3
0
 public void UpdataHisData()
 {
     DsPostVerid ldpv = dop.GetLocalDPV("1");
     DsPostVerid sdpv = hc.GetSerHisVer();
     List<Posts> plist = hc.HisData(sdpv, ldpv);
     List<DsHistory> dshlist = new List<DsHistory>();
     foreach (var p in plist)
     {
         List<DsHistory> dl = DataSwitch.JsonToList<DsHistory>(p.Jsons);
         if (dl == null) continue;
         dshlist.AddRange(dl);
     }
     dop.InsertHisData(dshlist);
     dop.UpdataVer(sdpv, 1);
 }
Beispiel #4
0
        public string DeleteAuth(string userauthjson, string userid)
        {
            List <UserAuth> authlist = DataSwitch.JsonToList <UserAuth>(userauthjson);
            var             user     = dbSet.GetList(u => u.UserID == userid.ToInt());

            foreach (var dbauth in user)
            {
                foreach (var auth in authlist)
                {
                    if (auth.AuthID == dbauth.AuthID)
                    {
                        dbSet.Delete(dbauth);
                    }
                }
            }
            return(DataSwitch.HttpPostMsg(General.strSucess));
        }
Beispiel #5
0
        public string InsertTable(string authlistjson, string userid)
        {
            List <UserAuth>  auths     = dbSet.GetList(u => u.UserID == userid.ToInt());
            List <Authority> authlist  = DataSwitch.JsonToList <Authority>(authlistjson);
            List <UserAuth>  userAuths = new List <UserAuth>();
            List <Authority> addauth   = new List <Authority>();

            foreach (var auth in authlist)
            {
                bool check = true;
                foreach (var au in auths)
                {
                    if (auth.id == au.AuthID)
                    {
                        check = false;
                    }
                }
                if (check)
                {
                    UserAuth userAuth = new UserAuth {
                        AuthID = auth.id, UserID = userid.ToInt()
                    };
                    userAuths.Add(userAuth);
                    addauth.Add(auth);
                }
            }
            if (userAuths.Count == 0)
            {
                return(DataSwitch.HttpPostList(addauth));
            }
            bool insert = dbSet.InsertRange(userAuths.ToArray());

            if (insert)
            {
                return(DataSwitch.HttpPostList(addauth));
            }
            return(DataSwitch.HttpPostMsg(General.strFail));
        }
Beispiel #6
0
        public List <T> GetEntities <T>(string json)
        {
            List <T> list = DataSwitch.JsonToList <T>(json);

            return(list);
        }