Esempio n. 1
0
 public void SetInitialSyncAsNotRequired(String instance, String user)
 {
     using (var db = new MobeelizerInternalDatabaseContext())
     {
         try
         {
             var query = from r in db.Roles where r.Instance == instance && r.User == user select r;
             MobeelizerRoleEntity roleEntity = query.Single();
             roleEntity.InitialSyncRequired = false;
             db.SubmitChanges();
         }
         catch (InvalidOperationException)
         {
         }
     }
 }
Esempio n. 2
0
 public void ClearRoleAndInstanceGuid(String instance, String user)
 {
     using (var db = new MobeelizerInternalDatabaseContext())
     {
         try
         {
             var query = from r in db.Roles where r.Instance == instance && r.User == user select r;
             MobeelizerRoleEntity roleEntity = query.Single();
             roleEntity.Role         = null;
             roleEntity.InstanceGuid = null;
             db.SubmitChanges();
         }
         catch (InvalidOperationException)
         {
         }
     }
 }
Esempio n. 3
0
        public String[] GetRoleAndInstanceGuid(String instance, String user, String password)
        {
            String role         = null;
            String instanceGuid = null;

            using (var db = new MobeelizerInternalDatabaseContext())
            {
                try
                {
                    var query = from r in db.Roles where r.Instance == instance && r.User == user && r.Password == GetMd5(password) select r;
                    MobeelizerRoleEntity roleEntity = query.Single();
                    role         = roleEntity.Role;
                    instanceGuid = roleEntity.InstanceGuid;
                }
                catch (InvalidOperationException)
                {
                }
            }

            return(new String[] { role, instanceGuid });
        }
Esempio n. 4
0
        public void SetRoleAndInstanceGuid(String instance, String user, String password, String role, String instanceGuid)
        {
            MobeelizerRoleEntity roleEntity = null;

            using (var db = new MobeelizerInternalDatabaseContext())
            {
                try
                {
                    var query = from r in db.Roles where r.Instance == instance && r.User == user select r;
                    roleEntity = query.Single();
                }
                catch (InvalidOperationException)
                {
                }

                if (roleEntity == null)
                {
                    roleEntity = new MobeelizerRoleEntity()
                    {
                        Instance            = instance,
                        User                = user,
                        Password            = this.GetMd5(password),
                        Role                = role,
                        InstanceGuid        = instanceGuid,
                        InitialSyncRequired = true
                    };
                    db.Roles.InsertOnSubmit(roleEntity);
                }
                else
                {
                    roleEntity.Password     = this.GetMd5(password);
                    roleEntity.Role         = role;
                    roleEntity.InstanceGuid = instanceGuid;
                }

                db.SubmitChanges();
            }
        }
        public void SetRoleAndInstanceGuid(String instance, String user, String password, String role, String instanceGuid)
        {
            MobeelizerRoleEntity roleEntity = null;
            using (var db = new MobeelizerInternalDatabaseContext())
            {
                try
                {
                    var query = from r in db.Roles where r.Instance == instance && r.User == user select r;
                    roleEntity = query.Single();
                }
                catch (InvalidOperationException)
                {
                }

                if (roleEntity == null)
                {
                    roleEntity = new MobeelizerRoleEntity()
                    {
                        Instance = instance,
                        User = user,
                        Password = this.GetMd5(password),
                        Role = role,
                        InstanceGuid = instanceGuid,
                        InitialSyncRequired = true
                    };
                    db.Roles.InsertOnSubmit(roleEntity);
                }
                else
                {
                    roleEntity.Password = this.GetMd5(password);
                    roleEntity.Role = role;
                    roleEntity.InstanceGuid = instanceGuid;
                }

                db.SubmitChanges();
            }
        }