Ejemplo n.º 1
0
        public static webObject addFed(Fed aFed)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);
            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            webObject vWebObject = new webObject();
            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.AddFed(vFanToken, aFed);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message = "Fed Added";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFed;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return vWebObject;
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message = "Addition of Fed unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return vWebObject;
            }
            return vWebObject;
        }
Ejemplo n.º 2
0
 /// <summary>
 ///   Update a <see cref="Fed"/> passed as an argument .
 /// </summary>
 /// <param name="aFed">A <see cref="Fed"/>.</param>
 public static void Update(Fed aFed)
 {
     if (aFed == null)
     {
         throw new ArgumentNullException("aFed");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("update FED_Federation");
         vStringBuilder.AppendLine("set    FED_Name = @FEDName,");
         vStringBuilder.AppendLine("       FAN_Key = @FANKey,");
         vStringBuilder.AppendLine("       FED_Avatar = @FEDAvatar");
         vStringBuilder.AppendLine("where  FED_Key = @FEDKey");
         ObjectToData(vSqlCommand, aFed);
         vSqlCommand.Parameters.AddWithValue("@FEDKey", aFed.FeddKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 ///   The overloaded Load method that will return a specific <see cref="Fed"/>, with keys in the <c>aFed</c> argument.
 /// </summary>
 /// <param name="aFed">A <see cref="Fed"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception>
 /// <exception cref="Exception">If no record is found.</exception>
 public static void Load(Fed aFed)
 {
     if (aFed == null)
     {
         throw new ArgumentNullException("aFed");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(true);
         vStringBuilder.AppendLine("where t1.FED_Key = @FEDKey");
         vSqlCommand.Parameters.AddWithValue("@FEDKey", aFed.FeddKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             if (!vSqlDataReader.HasRows)
             {
                 throw new Exception(String.Format("Expected Fed not found: FED_Key = {0}", aFed.FeddKey));
             }
             vSqlDataReader.Read();
             DataToObject(aFed, vSqlDataReader, true);
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 ///   Insert a <see cref="Fed"/> passed as an argument via Stored Procedure that returns the newly inserted Fed Key 
 /// </summary>
 /// <param name="aFed">A <see cref="Fed"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception>
 public static void Insert(Fed aFed)
 {
     if (aFed == null)
     {
         throw new ArgumentNullException("aFed");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into FED_Federation");
         vStringBuilder.AppendLine("       (FED_Name, FAN_Key,");
         vStringBuilder.AppendLine("        FED_Avatar)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@FEDName, @FANKey,");
         vStringBuilder.AppendLine("        @FEDAvatar)");
         vStringBuilder.AppendLine(";");
         vStringBuilder.AppendLine("select SCOPE_IDENTITY()");
         ObjectToData(vSqlCommand, aFed);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aFed.FeddKey = Convert.ToInt32(vSqlCommand.ExecuteScalar());
         vSqlCommand.Connection.Close();
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FedList</c> property a <see cref="FedCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Fed"/>, filtered by the filter properties of the passed <see cref="FedCollection"/>.
 /// </summary>
 /// <param name="aFedCollection">The <see cref="FedCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FedCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFedCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FedCollection aFedCollection)
 {
     if (aFedCollection == null)
     {
         throw new ArgumentNullException("aFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         if (aFedCollection.IsFiltered)
         {
             vStringBuilder.AppendFormat("where t1.FED_Name is like '%{0}%", aFedCollection.FedFilter.FedNameFilter);
         }
         vStringBuilder.AppendLine("order by t1.FED_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFed = new Fed();
                 DataToObject(vFed, vSqlDataReader, false);
                 aFedCollection.FedList.Add(vFed);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Ejemplo n.º 6
0
        public static webObject deleteFed(Fed aFed)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);

            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            webObject vWebObject = new webObject();

            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            try
            {
                FanServiceConsumer.DeleteFed(vFanToken, aFed);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "Fed Deleted";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFed;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Deletion of Fed unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
Ejemplo n.º 7
0
 /// <summary>
 ///   Insert a <see cref="Fed"/> passed as an argument via Stored Procedure that returns the newly inserted Fed Key
 /// </summary>
 /// <param name="aFed">A <see cref="Fed"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception>
 public static void Insert(Fed aFed)
 {
     if (aFed == null)
     {
         throw new ArgumentNullException("aFed");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into FED_Federation");
         vStringBuilder.AppendLine("       (FED_Name, FAN_Key,");
         vStringBuilder.AppendLine("        FED_Avatar)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@FEDName, @FANKey,");
         vStringBuilder.AppendLine("        @FEDAvatar)");
         vStringBuilder.AppendLine(";");
         vStringBuilder.AppendLine("select SCOPE_IDENTITY()");
         ObjectToData(vSqlCommand, aFed);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aFed.FeddKey = Convert.ToInt32(vSqlCommand.ExecuteScalar());
         vSqlCommand.Connection.Close();
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        ///   Load a <see cref="SqlDataReader"/> into a <see cref="Fed"/> object.
        /// </summary>
        /// <param name="aFed">A <see cref="Fed"/> argument.</param>
        /// <param name="aSqlDataReader">A <see cref="SqlDataReader"/> argument.</param>
        public static void DataToObject(Fed aFed, SqlDataReader aSqlDataReader, bool aIncludeAvatar)
        {
            aFed.FeddKey = Convert.ToInt32(aSqlDataReader["FED_Key"]);
            aFed.FedName = Convert.ToString(aSqlDataReader["FED_Name"]);
            aFed.FanKey = Convert.ToInt32(aSqlDataReader["FAN_Key"]);
            aFed.FanName = Convert.ToString(aSqlDataReader["FedOwner"]);

            if (aIncludeAvatar)
            {
                aFed.FedAvatar = CommonUtils.DbValueTo<byte[]>(aSqlDataReader["FED_Avatar"], null);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///   Load a <see cref="SqlDataReader"/> into a <see cref="Fed"/> object.
        /// </summary>
        /// <param name="aFed">A <see cref="Fed"/> argument.</param>
        /// <param name="aSqlDataReader">A <see cref="SqlDataReader"/> argument.</param>
        public static void DataToObject(Fed aFed, SqlDataReader aSqlDataReader, bool aIncludeAvatar)
        {
            aFed.FeddKey = Convert.ToInt32(aSqlDataReader["FED_Key"]);
            aFed.FedName = Convert.ToString(aSqlDataReader["FED_Name"]);
            aFed.FanKey  = Convert.ToInt32(aSqlDataReader["FAN_Key"]);
            aFed.FanName = Convert.ToString(aSqlDataReader["FedOwner"]);

            if (aIncludeAvatar)
            {
                aFed.FedAvatar = CommonUtils.DbValueTo <byte[]>(aSqlDataReader["FED_Avatar"], null);
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 ///   Loads the <see cref="SqlCommand"/> parameters with values from an <see cref="Fed"/>.
 /// </summary>
 /// <param name="aSqlCommand">A <see cref="SqlDataReader"/> argument.</param>
 /// <param name="aFed">A <see cref="Fed"/> argument.</param>
 public static void ObjectToData(SqlCommand aSqlCommand, Fed aFed)
 {
     aSqlCommand.Parameters.AddWithValue("@FEDName", aFed.FedName);
     aSqlCommand.Parameters.AddWithValue("@FANKey", aFed.FanKey);
     if (aFed.FedAvatar == null)
     {
         aSqlCommand.Parameters.Add("@FEDAvatar", SqlDbType.Image).Value = DBNull.Value;
     }
     else
     {
         aSqlCommand.Parameters.AddWithValue("@FEDAvatar", aFed.FedAvatar);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        ///   The overloaded Load method that will return a specific <see cref="Fed"/> object, with keys in <c>aFed</c>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFed">A <see cref="Fed"/>.</param>
        /// <exception cref="ArgumentNullException">If <c>aFed</c> is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, Fed aFed)
        {
            if (aFed == null)
            {
                throw new ArgumentNullException("Load Fed Business");
            }

            //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Fed", AccessMode.Read))
            //{
            //    throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FednKey), AccessMode.Read, "Fed");
            //}

            FedData.Load(aFed);
        }
Ejemplo n.º 12
0
        /// <summary>
        ///   Insert a <see cref="Fed"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>Fed Key</i>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFed">A <see cref="Fed"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception>
        public static void Insert(FanKey aFanKey, Fed aFed)
        {
            if (aFed == null)
            {
                throw new ArgumentNullException("Insert Fed Business");
            }

            //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Fed", AccessMode.Create))
            //{
            //    throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FannKey), AccessMode.Create, "Fed");
            //}

            FedData.Insert(aFed);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///   Update a <see cref="Fed"/> object passed as an argument.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aFed">A <see cref="Fed"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception>
        public static void Update(FanKey aFanKey, Fed aFed)
        {
            if (aFed == null)
            {
                throw new ArgumentNullException("Update Fed Business");
            }

            //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Fed", AccessMode.Update))
            //{
            //    throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.FednKey), AccessMode.Update, "Fed");
            //}

            FedData.Update(aFed);
        }
Ejemplo n.º 14
0
        /// <summary>
        ///    Assigns all <c>aSource</c> object's values to this instance of <see cref="FedCollection"/>.
        /// </summary>
        /// <param name="aSource">A source object.</param>
        public override void AssignFromSource(object aSource)
        {
            if (!(aSource is FedCollection))
            {
                throw new ArgumentException("Invalid assignment source", "FedCollection");
            }

            _isFiltered = (aSource as FedCollection)._isFiltered;
            _fedFilter  = (aSource as FedCollection)._fedFilter;
            _fedList.Clear();
            foreach (Fed vFedSource in (aSource as FedCollection)._fedList)
            {
                Fed vFedTarget = new Fed();
                vFedTarget.AssignFromSource(vFedSource);
                _fedList.Add(vFedTarget);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        ///    Assigns all <c>aSource</c> object's values to this instance of <see cref="FedCollection"/>.
        /// </summary>
        /// <param name="aSource">A source object.</param>
        public override void AssignFromSource(object aSource)
        {
            if (!(aSource is FedCollection))
            {
                throw new ArgumentException("Invalid assignment source", "FedCollection");
            }

            _isFiltered = (aSource as FedCollection)._isFiltered;
            _fedFilter = (aSource as FedCollection)._fedFilter;
            _fedList.Clear();
            foreach (Fed vFedSource in (aSource as FedCollection)._fedList)
            {
                Fed vFedTarget = new Fed();
                vFedTarget.AssignFromSource(vFedSource);
                _fedList.Add(vFedTarget);
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 ///   Delete a <see cref="Fed"/> object passed as an argument.
 /// </summary>
 /// <param name="aFed">The <see cref="Fed"/> object to be deleted.</param>
 /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception>
 public static void Delete(Fed aFed)
 {
     if (aFed == null)
     {
         throw new ArgumentNullException("aFed");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("delete FED_Federation");
         vStringBuilder.AppendLine("where  FED_Key = @FEDKey");
         vSqlCommand.Parameters.AddWithValue("@FEDKey", aFed.FeddKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
Ejemplo n.º 17
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FedList</c> property a <see cref="FedCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Fed"/>, filtered by the filter properties of the passed <see cref="FedCollection"/>.
 /// </summary>
 /// <param name="aFedCollection">The <see cref="FedCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FedCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFedCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FedCollection aFedCollection)
 {
     if (aFedCollection == null)
     {
         throw new ArgumentNullException("aFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         if (aFedCollection.IsFiltered)
         {
             vStringBuilder.AppendFormat("where t1.FED_Name is like '%{0}%", aFedCollection.FedFilter.FedNameFilter);
         }
         vStringBuilder.AppendLine("order by t1.FED_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFed = new Fed();
                 DataToObject(vFed, vSqlDataReader, false);
                 aFedCollection.FedList.Add(vFed);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 ///   Loads the <see cref="SqlCommand"/> parameters with values from an <see cref="Fed"/>.
 /// </summary>
 /// <param name="aSqlCommand">A <see cref="SqlDataReader"/> argument.</param>
 /// <param name="aFed">A <see cref="Fed"/> argument.</param>
 public static void ObjectToData(SqlCommand aSqlCommand, Fed aFed)
 {
     aSqlCommand.Parameters.AddWithValue("@FEDName", aFed.FedName);
     aSqlCommand.Parameters.AddWithValue("@FANKey", aFed.FanKey);
     if (aFed.FedAvatar == null)
     {
         aSqlCommand.Parameters.Add("@FEDAvatar", SqlDbType.Image).Value = DBNull.Value;
     }
     else
     {
         aSqlCommand.Parameters.AddWithValue("@FEDAvatar", aFed.FedAvatar);
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 ///   The <c>EditFed</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Fed"/> object.
 ///   It invokes the <c>Update</c> method of <see cref="FedBusiness"/> with the newly deserialized <see cref="Fed"/> object.
 ///   Finally, it returns the updated object unchanged as a serialized <see cref="string"/> of XML.
 /// </summary>
 /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
 /// <returns><see cref="Fed"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string EditFed(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of EditFed");
     }
     Fed vFed = new Fed();
     vFed = XmlUtils.Deserialize<Fed>(aXmlArgument);
     FedBusiness.Update(aFanKey, vFed);
     return XmlUtils.Serialize<Fed>(vFed, true);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Call the WebService with a request to Delete a Fed
 /// </summary>
 /// <param name="aFed">The Fed object to Delete</param>
 /// <param name="aFantoken">A fantoken.</param>
 public static void DeleteFed(FanToken aFantoken, Fed aFed)
 {
     FanCallHandler.ServiceCall <Fed>(aFantoken, "DeleteFed", aFed);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Call the WebService with a request to Add a Fed
 /// </summary>
 /// <param name="aFed">The Fed object to Add</param>
 /// <param name="aFantoken">A fantoken.</param>
 public static void AddFed(FanToken aFantoken, Fed aFed)
 {
     FanCallHandler.ServiceCall<Fed>(aFantoken, "AddFed", aFed);
 }
Ejemplo n.º 22
0
 /// <summary>
 ///   The overloaded Load method that will return a specific <see cref="Fed"/>, with keys in the <c>aFed</c> argument.
 /// </summary>
 /// <param name="aFed">A <see cref="Fed"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFed</c> argument is <c>null</c>.</exception>
 /// <exception cref="Exception">If no record is found.</exception>
 public static void Load(Fed aFed)
 {
     if (aFed == null)
     {
         throw new ArgumentNullException("aFed");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(true);
         vStringBuilder.AppendLine("where t1.FED_Key = @FEDKey");
         vSqlCommand.Parameters.AddWithValue("@FEDKey", aFed.FeddKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             if (!vSqlDataReader.HasRows)
             {
                 throw new Exception(String.Format("Expected Fed not found: FED_Key = {0}", aFed.FeddKey));
             }
             vSqlDataReader.Read();
             DataToObject(aFed, vSqlDataReader, true);
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }