Esempio n. 1
0
 public static void AddAccount(MobileAccount m)
 {
     try
     {
         using (var dbconn = new WebSystemData())
         {
             dbconn.MobileAccounts.Add(m);
             dbconn.SaveChanges();
         }
         StatusMessage = string.Format("Success! Added new Mobile Account for User '{0}'.", m.MobileId);
     }
     catch (Exception ex)
     {
         StatusMessage = string.Format("Failure. Could not add Mobile Account for User '{0}'. Error: {1}", m.MobileId, ex.Message);
         StatusMessage = ex.Message;
     }
 }
 public static void AddAccount(WebAccount w)
 {
     try
     {
         using (var dbconn = new WebSystemData())
         {
             dbconn.WebAccounts.Add(w);
             dbconn.SaveChanges();
         }
         StatusMessage = string.Format("Success! Added new Web Account for User {0}.", w.WebId);
         System.Diagnostics.Debug.WriteLine(StatusMessage);
     }
     catch (Exception ex)
     {
         StatusMessage = string.Format("Failure. Could not add Web Account for User {0}. Error: {1}", w.WebId, ex.Message);
         System.Diagnostics.Debug.WriteLine(StatusMessage);
     }
 }
Esempio n. 3
0
        public static MobileAccount FindAccountById(string id)
        {
            MobileAccount m = new MobileAccount();

            try
            {
                using (var dbconn = new WebSystemData())
                {
                    m = dbconn.MobileAccounts.Find(id);
                }
                StatusMessage = string.Format("Success! Found Mobild Account belonging to User {0}.", m.MobileId);
                System.Diagnostics.Debug.WriteLine(StatusMessage);
                return(m);
            }
            catch (Exception ex)
            {
                StatusMessage = string.Format("Failure. Could not find Mobile Account for User {0}. Error: {1}", m.MobileId, ex.Message);
                return(null);
            }
        }