Esempio n. 1
0
 /// <summary>
 ///   Insert a <see cref="FanFed"/> passed as an argument via Stored Procedure that returns the newly inserted FanFed Key
 /// </summary>
 /// <param name="aFanFed">A <see cref="FanFed"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFanFed</c> argument is <c>null</c>.</exception>
 public static void Insert(FanFedCollection aFanFedCollection)
 {
     if (aFanFedCollection == null)
     {
         throw new ArgumentNullException("aFanFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into FEN_FanFederation");
         vStringBuilder.AppendLine("       (FED_Key, FAN_Key,");
         vStringBuilder.AppendLine("        FEN_DateJoined)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@FEDKey, @FANKey,");
         vStringBuilder.AppendLine("        @FENDateJoined)");
         vStringBuilder.AppendLine(";");
         vSqlCommand.Parameters.Add("@FEDKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@FANKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@FENDateJoined", SqlDbType.DateTime);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aFanFedCollection.FanFedList.ForEach(vFanFed =>
         {
             vSqlCommand.Parameters["@FEDKey"].Value        = vFanFed.FedKey;
             vSqlCommand.Parameters["@FANKey"].Value        = vFanFed.FanKey;
             vSqlCommand.Parameters["@FENDateJoined"].Value = vFanFed.FanFedDateJoined;
             vSqlCommand.ExecuteScalar();
         });
         vSqlCommand.Connection.Close();
     }
 }
Esempio n. 2
0
        public static webObject loadFanFedCollection(FanFedCollection aFanFedCollection)
        {
            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.GetFanFedCollection(vFanToken, aFanFedCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "FanFedCollection Loaded";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFanFedCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Load of FanFedCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
Esempio n. 3
0
 /// <summary>
 ///   Insert a <see cref="FanFed"/> passed as an argument via Stored Procedure that returns the newly inserted FanFed Key 
 /// </summary>
 /// <param name="aFanFed">A <see cref="FanFed"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFanFed</c> argument is <c>null</c>.</exception>
 public static void Insert(FanFedCollection aFanFedCollection)
 {
     if (aFanFedCollection == null)
     {
         throw new ArgumentNullException("aFanFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into FEN_FanFederation");
         vStringBuilder.AppendLine("       (FED_Key, FAN_Key,");
         vStringBuilder.AppendLine("        FEN_DateJoined)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@FEDKey, @FANKey,");
         vStringBuilder.AppendLine("        @FENDateJoined)");
         vStringBuilder.AppendLine(";");
         vSqlCommand.Parameters.Add("@FEDKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@FANKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@FENDateJoined", SqlDbType.DateTime);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aFanFedCollection.FanFedList.ForEach(vFanFed =>
         {
             vSqlCommand.Parameters["@FEDKey"].Value = vFanFed.FedKey;
             vSqlCommand.Parameters["@FANKey"].Value = vFanFed.FanKey;
             vSqlCommand.Parameters["@FENDateJoined"].Value = vFanFed.FanFedDateJoined;
             vSqlCommand.ExecuteScalar();
         });
         vSqlCommand.Connection.Close();
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Save a <see cref="FanFed" /> list passed as an argument.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey" /> object.</param>
        /// <param name="aFanFedCollection">A fan fed collection.</param>
        /// <exception cref="Zephry.ZpAccessException">Access Denied; FanFed</exception>
        /// <exception cref="ArgumentNullException">If <c>aFanFed</c> argument is <c>null</c>.</exception>
        public static void Save(FanKey aFanKey, FanFedCollection aFanFedCollection)
        {
            if (aFanFedCollection == null)
            {
                throw new ArgumentNullException("Update FanFedCollection Business");
            }

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

            FanFedData.Save(aFanFedCollection);
        }
Esempio n. 5
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FanFedList</c> property a <see cref="FanFedCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="FanFed"/>, filtered by the filter properties of the passed <see cref="FanFedCollection"/>.
 /// </summary>
 /// <param name="aFanFedCollection">The <see cref="FanFedCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FanFedCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFanFedCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FanFedCollection aFanFedCollection)
 {
     if (aFanFedCollection == null)
     {
         throw new ArgumentNullException("aFanFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aFanFedCollection.IsFiltered)
         {
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FedKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.FED_Key = @FEDKey");
                 vSqlCommand.Parameters.AddWithValue("@FEDKey", aFanFedCollection.FanFedFilter.FanfedFilter.FedKey);
             }
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FanKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aFanFedCollection.FanFedFilter.FanfedFilter.FanKey);
             }
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FedName != null)
             {
                 vStringBuilder.AppendFormat("and t1.FED_Name like '%{0}%'", aFanFedCollection.FanFedFilter.FanfedFilter.FedName);
             }
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FanName != null)
             {
                 vStringBuilder.AppendFormat("and t2.FAN_Name like '%{0}%'", aFanFedCollection.FanFedFilter.FanfedFilter.FanName);
             }
         }
         vStringBuilder.AppendLine("order by t1.FED_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFanFed = new FanFed();
                 DataToObject(vFanFed, vSqlDataReader, false);
                 aFanFedCollection.FanFedList.Add(vFanFed);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Save a <see cref="FanFed" /> list passed as an argument.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey" /> object.</param>
        /// <param name="aFanFedCollection">A fan fed collection.</param>
        /// <exception cref="Zephry.ZpAccessException">Access Denied; FanFed</exception>
        /// <exception cref="ArgumentNullException">If <c>aFanFed</c> argument is <c>null</c>.</exception>
        public static void Save(FanKey aFanKey, FanFedCollection aFanFedCollection)
        {
            if (aFanFedCollection == null)
            {
                throw new ArgumentNullException("Update FanFedCollection Business");
            }

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

            FanFedData.Save(aFanFedCollection);
        }
Esempio n. 7
0
        public static webObject editFanFedCollection(FanFedCollection aFanFedCollection)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);

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

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

            // ********** TEMPORARY REMEDY UNTIL I SORT OUT DATETIME ISSUE
            foreach (FanFed vCF in aFanFedCollection.FanFedList)
            {
                vCF.FanFedDateJoined = DateTime.Now;
            }

            try
            {
                FanServiceConsumer.SaveFanFed(vFanToken, aFanFedCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "FanFedCollection Edited";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFanFedCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Edit of FanFedCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
Esempio n. 8
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>FanFedList</c> property a <see cref="FanFedCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="FanFed"/>, filtered by the filter properties of the passed <see cref="FanFedCollection"/>.
 /// </summary>
 /// <param name="aFanFedCollection">The <see cref="FanFedCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="FanFedCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aFanFedCollection</c> argument is <c>null</c>.</exception>
 public static void Load(FanFedCollection aFanFedCollection)
 {
     if (aFanFedCollection == null)
     {
         throw new ArgumentNullException("aFanFedCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aFanFedCollection.IsFiltered)
         {
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FedKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.FED_Key = @FEDKey");
                 vSqlCommand.Parameters.AddWithValue("@FEDKey", aFanFedCollection.FanFedFilter.FanfedFilter.FedKey);
             }
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FanKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aFanFedCollection.FanFedFilter.FanfedFilter.FanKey);
             }
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FedName != null)
             {
                 vStringBuilder.AppendFormat("and t1.FED_Name like '%{0}%'", aFanFedCollection.FanFedFilter.FanfedFilter.FedName);
             }
             if (aFanFedCollection.FanFedFilter.FanfedFilter.FanName != null)
             {
                 vStringBuilder.AppendFormat("and t2.FAN_Name like '%{0}%'", aFanFedCollection.FanFedFilter.FanfedFilter.FanName);
             }
         }
         vStringBuilder.AppendLine("order by t1.FED_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vFanFed = new FanFed();
                 DataToObject(vFanFed, vSqlDataReader, false);
                 aFanFedCollection.FanFedList.Add(vFanFed);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Add a <see cref="FanFed" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aFanFedCollection">A provider suburb collection.</param>
 public static void SaveFanFed(FanToken aFanToken, FanFedCollection aFanFedCollection)
 {
     FanCallHandler.ServiceCall<FanFedCollection>(aFanToken, "SaveFanFed", aFanFedCollection);
 }
Esempio n. 10
0
 /// <summary>
 ///   The <c>GetFanFedCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="FanFedCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="FanFedBusiness"/> with the newly deserialized <see cref="FanFedCollection"/> object.
 ///   Finally, it returns the collection object as a serialized <see cref="string"/> of XML.
 /// </summary>
 /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
 /// <returns><see cref="FanFedCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetFanFedCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetFanFedCollection");
     }
     FanFedCollection vFanFedCollection = new FanFedCollection();
     vFanFedCollection = XmlUtils.Deserialize<FanFedCollection>(aXmlArgument);
     FanFedBusiness.Load(aFanKey, vFanFedCollection);
     return XmlUtils.Serialize<FanFedCollection>(vFanFedCollection, true);
 }
Esempio n. 11
0
 /// <summary>
 /// Add a <see cref="FanFed" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aFanFedCollection">A provider suburb collection.</param>
 public static void SaveFanFed(FanToken aFanToken, FanFedCollection aFanFedCollection)
 {
     FanCallHandler.ServiceCall <FanFedCollection>(aFanToken, "SaveFanFed", aFanFedCollection);
 }
Esempio n. 12
0
 /// <summary>
 ///   Gets a specified <see cref="FanFedCollection"/>.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFanFedCollection"><see cref="FanFed"/>Collection object.</param>
 public static void GetFanFedCollection(FanToken aFanToken, FanFedCollection aFanFedCollection)
 {
     FanCallHandler.ServiceCall <FanFedCollection>(aFanToken, "GetFanFedCollection", aFanFedCollection);
 }
Esempio n. 13
0
        public static webObject loadFanFedCollection(FanFedCollection aFanFedCollection)
        {
            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.GetFanFedCollection(vFanToken, aFanFedCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message = "FanFedCollection Loaded";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFanFedCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return vWebObject;
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message = "Load of FanFedCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return vWebObject;
            }
            return vWebObject;
        }
Esempio n. 14
0
        public static webObject editFanFedCollection(FanFedCollection aFanFedCollection)
        {
            FanToken vFanToken = ServerSession.GetFanToken(HttpContext.Current.Session);
            ServerSession.ClearSessionBusiness(HttpContext.Current.Session);
            webObject vWebObject = new webObject();
            vWebObject.aTransactionStatus = ServerSession.GetTransactionStatus(HttpContext.Current.Session);

            // ********** TEMPORARY REMEDY UNTIL I SORT OUT DATETIME ISSUE
            foreach (FanFed vCF in aFanFedCollection.FanFedList)
            {
                vCF.FanFedDateJoined = DateTime.Now;
            }

            try
            {
                FanServiceConsumer.SaveFanFed(vFanToken, aFanFedCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message = "FanFedCollection Edited";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aFanFedCollection;
            }
            catch (TransactionStatusException tx)
            {

                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return vWebObject;
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message = "Edit of FanFedCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return vWebObject;
            }
            return vWebObject;
        }
Esempio n. 15
0
 public static void Save(FanFedCollection aFanFedCollection)
 {
     Delete(aFanFedCollection.FanFedFilter.FanfedFilter);
     Insert(aFanFedCollection);
 }
Esempio n. 16
0
 public static void Save(FanFedCollection aFanFedCollection)
 {
     Delete(aFanFedCollection.FanFedFilter.FanfedFilter);
     Insert(aFanFedCollection);
 }
Esempio n. 17
0
 /// <summary>
 ///   Gets a specified <see cref="FanFedCollection"/>.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken"/> object used for Access Control.</param>
 /// <param name="aFanFedCollection"><see cref="FanFed"/>Collection object.</param>
 public static void GetFanFedCollection(FanToken aFanToken, FanFedCollection aFanFedCollection)
 {
     FanCallHandler.ServiceCall<FanFedCollection>(aFanToken, "GetFanFedCollection", aFanFedCollection);
 }