コード例 #1
0
ファイル: community.aspx.cs プロジェクト: heinschulie/zfit
        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);
        }
コード例 #2
0
ファイル: CellFanData.cs プロジェクト: heinschulie/zfit
 /// <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();
     }
 }
コード例 #3
0
ファイル: CellFanData.cs プロジェクト: heinschulie/zfit
 /// <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();
     }
 }
コード例 #4
0
ファイル: CellFanData.cs プロジェクト: heinschulie/zfit
 /// <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();
     }
 }
コード例 #5
0
ファイル: CellFanBusiness.cs プロジェクト: heinschulie/zfit
        /// <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);
        }
コード例 #6
0
ファイル: CellFanBusiness.cs プロジェクト: heinschulie/zfit
        /// <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);
        }
コード例 #7
0
ファイル: community.aspx.cs プロジェクト: heinschulie/zfit
        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);
        }
コード例 #8
0
ファイル: FanImplementation.cs プロジェクト: heinschulie/zfit
 /// <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);
 }
コード例 #9
0
ファイル: CellFanData.cs プロジェクト: heinschulie/zfit
 public static void Save(CellFanCollection aCellFanCollection)
 {
     Delete(aCellFanCollection.CellFanFilter.CellfanFilter);
     Insert(aCellFanCollection);
 }
コード例 #10
0
ファイル: CellFanData.cs プロジェクト: heinschulie/zfit
 /// <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();
     }
 }
コード例 #11
0
 /// <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);
 }
コード例 #12
0
ファイル: CellFanData.cs プロジェクト: heinschulie/zfit
 public static void Save(CellFanCollection aCellFanCollection)
 {
     Delete(aCellFanCollection.CellFanFilter.CellfanFilter);
     Insert(aCellFanCollection);
 }
コード例 #13
0
ファイル: community.aspx.cs プロジェクト: heinschulie/zfit
        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;
        }
コード例 #14
0
ファイル: community.aspx.cs プロジェクト: heinschulie/zfit
        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;
        }
コード例 #15
0
 /// <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);
 }