public static Modem GetModemByGateway(string gateway)
 {
     Modem res = new Modem();
     using (var holder = SqlConnectionHelper.GetConnection())
     {
         using (var cmd = holder.Connection.CreateSPCommand("modems_get"))
         {
             cmd.Parameters.AddWithValue("@gateway", gateway.ToDbValue());
             try
             {
                 using (var reader = cmd.ExecuteReader())
                 {
                     while (reader.Read())
                         res=new Modem(reader);
                 }
             }
             catch (SqlException e)
             {
                 cmd.AddDetailsToException(e);
                 throw;
             }
         }
     }
     return res;
 }
 private static Modem GetTestModem(string gateway)
 {
     var res = new Modem();
     res.Id = 1;
     return res;
 }
Example #3
0
 /// <summary>
 /// Appends Account-specific parameters to the specificied SqlCommand. 
 /// </summary>
 /// <param name="command">SqlCommand to be executed.</param>
 /// <param name="alert">Instance of Modem class</param>
 /// <param name="action">Database action type (select, insert, update, delete).</param>
 public static void AddEntityParameters(this SqlCommand command, Modem account, DbActionType action)
 {
     command.AddCommonParameters(account.Id, action);
     command.Parameters.Add("@description", SqlDbType.NVarChar).Value = account.Description.ToDbValue();
     command.Parameters.Add("@gateway", SqlDbType.NVarChar).Value = account.Description.ToDbValue();
 }