Exemple #1
0
        public static webObject loadCellFanCollection(CellFanCollection aCellFanCollection)
        {
            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.GetCellFanCollection(vFanToken, aCellFanCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "CellFanCollection Loaded";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aCellFanCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Load of CellFanCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
Exemple #2
0
 /// <summary>
 ///   Insert a <see cref="CellFan"/> passed as an argument via Stored Procedure that returns the newly inserted CellFan Key 
 /// </summary>
 /// <param name="aCellFan">A <see cref="CellFan"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aCellFan</c> argument is <c>null</c>.</exception>
 public static void Insert(CellFanCollection aCellFanCollection)
 {
     if (aCellFanCollection == null)
     {
         throw new ArgumentNullException("aCellFanCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into CAN_CellFan");
         vStringBuilder.AppendLine("       (CEL_Key, FAN_Key,");
         vStringBuilder.AppendLine("        CAN_DateJoined)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@CELKey, @FANKey,");
         vStringBuilder.AppendLine("        @CANDateJoined)");
         vStringBuilder.AppendLine(";");
         vSqlCommand.Parameters.Add("@CELKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@FANKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@CANDateJoined", SqlDbType.DateTime);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aCellFanCollection.CellFanList.ForEach(vCellFan =>
         {
             vSqlCommand.Parameters["@CELKey"].Value = vCellFan.CelKey;
             vSqlCommand.Parameters["@FANKey"].Value = vCellFan.FanKey;
             vSqlCommand.Parameters["@CANDateJoined"].Value = vCellFan.CellFanDateJoined;
             vSqlCommand.ExecuteScalar();
         });
         vSqlCommand.Connection.Close();
     }
 }
Exemple #3
0
 /// <summary>
 ///   Insert a <see cref="CellFan"/> passed as an argument via Stored Procedure that returns the newly inserted CellFan Key
 /// </summary>
 /// <param name="aCellFan">A <see cref="CellFan"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aCellFan</c> argument is <c>null</c>.</exception>
 public static void Insert(CellFanCollection aCellFanCollection)
 {
     if (aCellFanCollection == null)
     {
         throw new ArgumentNullException("aCellFanCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into CAN_CellFan");
         vStringBuilder.AppendLine("       (CEL_Key, FAN_Key,");
         vStringBuilder.AppendLine("        CAN_DateJoined)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@CELKey, @FANKey,");
         vStringBuilder.AppendLine("        @CANDateJoined)");
         vStringBuilder.AppendLine(";");
         vSqlCommand.Parameters.Add("@CELKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@FANKey", SqlDbType.Int);
         vSqlCommand.Parameters.Add("@CANDateJoined", SqlDbType.DateTime);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aCellFanCollection.CellFanList.ForEach(vCellFan =>
         {
             vSqlCommand.Parameters["@CELKey"].Value        = vCellFan.CelKey;
             vSqlCommand.Parameters["@FANKey"].Value        = vCellFan.FanKey;
             vSqlCommand.Parameters["@CANDateJoined"].Value = vCellFan.CellFanDateJoined;
             vSqlCommand.ExecuteScalar();
         });
         vSqlCommand.Connection.Close();
     }
 }
Exemple #4
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>CellFanList</c> property a <see cref="CellFanCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="CellFan"/>, filtered by the filter properties of the passed <see cref="CellFanCollection"/>.
 /// </summary>
 /// <param name="aCellFanCollection">The <see cref="CellFanCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="CellFanCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aCellFanCollection</c> argument is <c>null</c>.</exception>
 public static void Load(CellFanCollection aCellFanCollection)
 {
     if (aCellFanCollection == null)
     {
         throw new ArgumentNullException("aCellFanCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aCellFanCollection.IsFiltered)
         {
             if (aCellFanCollection.CellFanFilter.CellfanFilter.CelKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.CEL_Key = @CELKey");
                 vSqlCommand.Parameters.AddWithValue("@CELKey", aCellFanCollection.CellFanFilter.CellfanFilter.CelKey);
             }
             if (aCellFanCollection.CellFanFilter.CellfanFilter.FanKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aCellFanCollection.CellFanFilter.CellfanFilter.FanKey);
             }
             if (aCellFanCollection.CellFanFilter.CellfanFilter.CellName != null)
             {
                 vStringBuilder.AppendFormat("and t1.CEL_Name like '%{0}%'", aCellFanCollection.CellFanFilter.CellfanFilter.CellName);
             }
             if (aCellFanCollection.CellFanFilter.CellfanFilter.FanName != null)
             {
                 vStringBuilder.AppendFormat("and t2.FAN_Name like '%{0}%'", aCellFanCollection.CellFanFilter.CellfanFilter.FanName);
             }
         }
         vStringBuilder.AppendLine("order by t1.CEL_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vCellFan = new CellFan();
                 DataToObject(vCellFan, vSqlDataReader, false);
                 aCellFanCollection.CellFanList.Add(vCellFan);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Exemple #5
0
        /// <summary>
        /// Save a <see cref="CellFan" /> list passed as an argument.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey" /> object.</param>
        /// <param name="aCellFanCollection">A cell fan collection.</param>
        /// <exception cref="Zephry.ZpAccessException">Access Denied; CellFan</exception>
        /// <exception cref="ArgumentNullException">If <c>aCellFan</c> argument is <c>null</c>.</exception>
        public static void Save(FanKey aFanKey, CellFanCollection aCellFanCollection)
        {
            if (aCellFanCollection == null)
            {
                throw new ArgumentNullException("Update CellFanCollection Business");
            }

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

            CellFanData.Save(aCellFanCollection);
        }
Exemple #6
0
        /// <summary>
        /// Save a <see cref="CellFan" /> list passed as an argument.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey" /> object.</param>
        /// <param name="aCellFanCollection">A cell fan collection.</param>
        /// <exception cref="Zephry.ZpAccessException">Access Denied; CellFan</exception>
        /// <exception cref="ArgumentNullException">If <c>aCellFan</c> argument is <c>null</c>.</exception>
        public static void Save(FanKey aFanKey, CellFanCollection aCellFanCollection)
        {
            if (aCellFanCollection == null)
            {
                throw new ArgumentNullException("Update CellFanCollection Business");
            }

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

            CellFanData.Save(aCellFanCollection);
        }
Exemple #7
0
        public static webObject editCellFanCollection(CellFanCollection aCellFanCollection)
        {
            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 (CellFan vCF in aCellFanCollection.CellFanList)
            {
                vCF.CellFanDateJoined = DateTime.Now;
            }

            try
            {
                FanServiceConsumer.SaveCellFan(vFanToken, aCellFanCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message           = "CellFanCollection Edited";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aCellFanCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return(vWebObject);
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message           = "Edit of CellFanCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage      = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return(vWebObject);
            }
            return(vWebObject);
        }
 /// <summary>
 ///   The <c>GetCellFanCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="CellFanCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="CellFanBusiness"/> with the newly deserialized <see cref="CellFanCollection"/> 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="CellFanCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetCellFanCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetCellFanCollection");
     }
     CellFanCollection vCellFanCollection = new CellFanCollection();
     vCellFanCollection = XmlUtils.Deserialize<CellFanCollection>(aXmlArgument);
     CellFanBusiness.Load(aFanKey, vCellFanCollection);
     return XmlUtils.Serialize<CellFanCollection>(vCellFanCollection, true);
 }
Exemple #9
0
 public static void Save(CellFanCollection aCellFanCollection)
 {
     Delete(aCellFanCollection.CellFanFilter.CellfanFilter);
     Insert(aCellFanCollection);
 }
Exemple #10
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>CellFanList</c> property a <see cref="CellFanCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="CellFan"/>, filtered by the filter properties of the passed <see cref="CellFanCollection"/>.
 /// </summary>
 /// <param name="aCellFanCollection">The <see cref="CellFanCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="CellFanCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aCellFanCollection</c> argument is <c>null</c>.</exception>
 public static void Load(CellFanCollection aCellFanCollection)
 {
     if (aCellFanCollection == null)
     {
         throw new ArgumentNullException("aCellFanCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aCellFanCollection.IsFiltered)
         {
             if (aCellFanCollection.CellFanFilter.CellfanFilter.CelKey > 0)
             {
                 vStringBuilder.AppendLine("and t1.CEL_Key = @CELKey");
                 vSqlCommand.Parameters.AddWithValue("@CELKey", aCellFanCollection.CellFanFilter.CellfanFilter.CelKey);
             }
             if (aCellFanCollection.CellFanFilter.CellfanFilter.FanKey > 0)
             {
                 vStringBuilder.AppendLine("and t2.FAN_Key = @FANKey");
                 vSqlCommand.Parameters.AddWithValue("@FANKey", aCellFanCollection.CellFanFilter.CellfanFilter.FanKey);
             }
             if (aCellFanCollection.CellFanFilter.CellfanFilter.CellName != null)
             {
                 vStringBuilder.AppendFormat("and t1.CEL_Name like '%{0}%'", aCellFanCollection.CellFanFilter.CellfanFilter.CellName);
             }
             if (aCellFanCollection.CellFanFilter.CellfanFilter.FanName != null)
             {
                 vStringBuilder.AppendFormat("and t2.FAN_Name like '%{0}%'", aCellFanCollection.CellFanFilter.CellfanFilter.FanName);
             }
         }
         vStringBuilder.AppendLine("order by t1.CEL_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vCellFan = new CellFan();
                 DataToObject(vCellFan, vSqlDataReader, false);
                 aCellFanCollection.CellFanList.Add(vCellFan);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
 /// <summary>
 /// Add a <see cref="CellFan" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aCellFanCollection">A provider suburb collection.</param>
 public static void SaveCellFan(FanToken aFanToken, CellFanCollection aCellFanCollection)
 {
     FanCallHandler.ServiceCall <CellFanCollection>(aFanToken, "SaveCellFan", aCellFanCollection);
 }
Exemple #12
0
 public static void Save(CellFanCollection aCellFanCollection)
 {
     Delete(aCellFanCollection.CellFanFilter.CellfanFilter);
     Insert(aCellFanCollection);
 }
Exemple #13
0
        public static webObject loadCellFanCollection(CellFanCollection aCellFanCollection)
        {
            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.GetCellFanCollection(vFanToken, aCellFanCollection);
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.OK;
                vWebObject.aTransactionStatus.Message = "CellFanCollection Loaded";
                ServerSession.SetTransactionStatus(HttpContext.Current.Session, vWebObject.aTransactionStatus);
                vWebObject.AnObject = aCellFanCollection;
            }
            catch (TransactionStatusException tx)
            {
                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return vWebObject;
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message = "Load of CellFanCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return vWebObject;
            }
            return vWebObject;
        }
Exemple #14
0
        public static webObject editCellFanCollection(CellFanCollection aCellFanCollection)
        {
            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 (CellFan vCF in aCellFanCollection.CellFanList)
            {
                vCF.CellFanDateJoined = DateTime.Now;
            }

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

                vWebObject.aTransactionStatus.AssignFromSource(tx.TransactionStatus);
                return vWebObject;
            }
            catch (Exception ex)
            {
                vWebObject.aTransactionStatus.TransactionResult = TransactionResult.GeneralException;
                vWebObject.aTransactionStatus.Message = "Edit of CellFanCollection unsuccesful" + ex.Message;
                vWebObject.aTransactionStatus.InnerMessage = ex.InnerException == null ? String.Empty : ex.InnerException.Message;
                return vWebObject;
            }
            return vWebObject;
        }
 /// <summary>
 /// Add a <see cref="CellFan" />.
 /// </summary>
 /// <param name="aFanToken">A <see cref="FanToken" /> object used for Access Control.</param>
 /// <param name="aCellFanCollection">A provider suburb collection.</param>
 public static void SaveCellFan(FanToken aFanToken, CellFanCollection aCellFanCollection)
 {
     FanCallHandler.ServiceCall<CellFanCollection>(aFanToken, "SaveCellFan", aCellFanCollection);
 }