Exemple #1
0
 /// <summary>
 /// Creates a new connection record
 /// </summary>
 /// <param name="Connection"></param>
 /// <returns></returns>
 public static Connection CreateConnection(Connection Connection)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Connections.Add(Connection);
         db.Entry(Connection).State = System.Data.Entity.EntityState.Added;
         db.SaveChanges();
         return Connection;
     }
 }
Exemple #2
0
 /// <summary>
 /// Updates a connection record
 /// </summary>
 /// <param name="Connection"></param>
 public static void UpdateConnection(Connection Connection)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Connections.Add(Connection);
         db.Entry(Connection).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
 public ConnectionInfo(int ConnectionId)
     : this()
 {
     _connection = ClientData.GetConnection(ConnectionId);
     Delete.Enabled = true;
 }
Exemple #4
0
 /// <summary>
 /// Deletes a connection
 /// </summary>
 /// <param name="Connection"></param>
 public static void DeleteConnection(Connection Connection)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Entry(Connection).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }
        /// <summary>
        /// Creates a new connection record
        /// </summary>
        void CreateConnection()
        {
            // creates a new connection record
            _connection = new Connection();
            SetParams();
            _connection = ClientData.CreateConnection(_connection);

            // alert that the connection was created
            OnConnectionCreated(new LookupItemEventArgs(_connection.Id, _connection.ConnectionName));

            // close the window
            this.Close();
        }