Пример #1
0
        /// <summary>
        ///   The overloaded Load method that will return a <see cref="CellCollection"/>.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aCellCollection">A <see cref="CellCollection"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aCellCollection</c> argument is <c>null</c>.</exception>
        public static void Load(FanKey aFanKey, CellCollection aCellCollection)
        {
            if (aCellCollection == null)
            {
                throw new ArgumentNullException("Load Cell Business");
            }

            //if (!FanFunctionAccessData.HasModeAccess(aFanKey, "Cell", AccessMode.List))
            //{
            //    throw new ZpAccessException("Access Denied", String.Format("{0}", aFanKey.CellnKey), AccessMode.List, "Cell");
            //}

            CellData.Load(aCellCollection);
        }
Пример #2
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>CellList</c> property a <see cref="CellCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="Cell"/>, filtered by the filter properties of the passed <see cref="CellCollection"/>.
 /// </summary>
 /// <param name="aCellCollection">The <see cref="CellCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="CellCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aCellCollection</c> argument is <c>null</c>.</exception>
 public static void Load(CellCollection aCellCollection)
 {
     if (aCellCollection == null)
     {
         throw new ArgumentNullException("aCellCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL(false);
         if (aCellCollection.IsFiltered)
         {
             vStringBuilder.AppendFormat("where t1.CEL_Name is like '%{0}%", aCellCollection.CellFilter.CellNameFilter);
         }
         vStringBuilder.AppendLine("order by t1.CEL_Name");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vCell = new Cell();
                 DataToObject(vCell, vSqlDataReader, false);
                 aCellCollection.CellList.Add(vCell);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
Пример #3
0
 /// <summary>
 /// Gets a FanCollection
 /// </summary>
 /// <param name="aFanToken">A fantoken.</param>
 /// <param name="aCellCollection">A user collection.</param>
 public static void GetCellCollection(FanToken aFanToken, CellCollection aCellCollection)
 {
     FanCallHandler.ServiceCall <CellCollection>(aFanToken, "GetCellCollection", aCellCollection);
 }
Пример #4
0
 /// <summary>
 ///   The <c>GetCellCollection</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="CellCollection"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="CellBusiness"/> with the newly deserialized <see cref="CellCollection"/> 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="CellCollection"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string GetCellCollection(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of GetCellCollection");
     }
     CellCollection vCellCollection = new CellCollection();
     vCellCollection = XmlUtils.Deserialize<CellCollection>(aXmlArgument);
     CellBusiness.Load(aFanKey, vCellCollection);
     return XmlUtils.Serialize<CellCollection>(vCellCollection, true);
 }
Пример #5
0
 /// <summary>
 /// Gets a FanCollection
 /// </summary>
 /// <param name="aFanToken">A fantoken.</param>
 /// <param name="aCellCollection">A user collection.</param>
 public static void GetCellCollection(FanToken aFanToken, CellCollection aCellCollection)
 {
     FanCallHandler.ServiceCall<CellCollection>(aFanToken, "GetCellCollection", aCellCollection);
 }