Exemplo n.º 1
0
        void ICedts_AdminRepository.EditUser(CEDTS_User user)
        {
            var name = (from m in db.CEDTS_User where m.UserID == user.UserID select m).First();

            if (user.UserPassword == null || user.UserPassword == "")
            {
                user.UserPassword = name.UserPassword;
            }
            user.Role = name.Role;
            db.ApplyCurrentValues(name.EntityKey.EntitySetName, user);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        void ICedts_PartnerRepository.SavePartner(CEDTS_Partner Partner)
        {
            Partner.PartnerID  = Guid.NewGuid();
            Partner.CreateTime = DateTime.Now;

            var        account = Partner.AdminAccount;
            CEDTS_User user    = db.CEDTS_User.Where(p => p.UserAccount == account).FirstOrDefault();
            var        user2   = user;

            user2.PartnerID = Partner.PartnerID;
            db.ApplyCurrentValues(user.EntityKey.EntitySetName, user2);

            db.AddToCEDTS_Partner(Partner);
            db.SaveChanges();
        }
Exemplo n.º 3
0
        void ICedts_PartnerRepository.ChangeTeacher(CEDTS_User Teacher)
        {
            var id = Teacher.UserID;
            var t  = db.CEDTS_User.Where(p => p.UserID == id).FirstOrDefault();

            if (Teacher.UserPassword == null)
            {
                Teacher.UserPassword = t.UserPassword;
            }
            Teacher.Role          = t.Role;
            Teacher.State         = t.State;
            Teacher.RegisterTime  = t.RegisterTime;
            Teacher.PartnerID     = t.PartnerID;
            Teacher.StudentNumber = t.StudentNumber;
            db.ApplyCurrentValues(t.EntityKey.EntitySetName, Teacher);
            db.SaveChanges();
        }
Exemplo n.º 4
0
        void ICedts_PartnerRepository.ChangePartner(CEDTS_Partner Partner)
        {
            var        id       = Partner.PartnerID;
            var        account  = Partner.AdminAccount;
            CEDTS_User user     = db.CEDTS_User.Where(p => p.UserAccount == account).FirstOrDefault();
            var        tempuser = user;

            tempuser.PartnerID = Partner.PartnerID;
            db.ApplyCurrentValues(user.EntityKey.EntitySetName, tempuser);
            var partner2 = db.CEDTS_Partner.Where(p => p.PartnerID == id).FirstOrDefault();

            if (Partner.AdminAccount != partner2.AdminAccount && partner2.AdminAccount != "")
            {
                var        account2  = partner2.AdminAccount;
                CEDTS_User user2     = db.CEDTS_User.Where(p => p.UserAccount == account2).FirstOrDefault();
                var        tempuser2 = user2;
                tempuser2.PartnerID = null;
                db.ApplyCurrentValues(user2.EntityKey.EntitySetName, tempuser2);
            }
            Partner.CreateTime = partner2.CreateTime;
            db.ApplyCurrentValues(partner2.EntityKey.EntitySetName, Partner);
            db.SaveChanges();
        }
Exemplo n.º 5
0
 void ICedts_PartnerRepository.SaveTeacher(CEDTS_User Teacher)
 {
     db.AddToCEDTS_User(Teacher);
     db.SaveChanges();
 }
Exemplo n.º 6
0
 void ICedts_AdminRepository.CreateUser(CEDTS_User user)
 {
     user.RegisterTime = DateTime.Now;
     db.AddToCEDTS_User(user);
     db.SaveChanges();
 }
Exemplo n.º 7
0
 void ICedts_UserRepository.SaveUser(CEDTS_User User)
 {
     db.AddToCEDTS_User(User);
     db.SaveChanges();
 }