コード例 #1
0
 /// <summary>
 ///   The overloaded Load method that will return a specific <see cref="RoleFunction"/>, with keys in the <c>aRoleFunction</c> argument.
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
 /// <exception cref="Exception">If no record is found.</exception>
 public static void Load(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         vStringBuilder.AppendLine("and    t1.ROL_Key = @ROLKey");
         vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunction.RolKey);
         vStringBuilder.AppendLine("and    t2.FNC_Key = @FNCKey");
         vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunction.FncKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             if (!vSqlDataReader.HasRows)
             {
                 throw new Exception(String.Format("Expected RoleFunction not found: ROL_Key = {0}, FNC_Key = {1}", aRoleFunction.RolKey, aRoleFunction.FncKey));
             }
             vSqlDataReader.Read();
             DataToObject(aRoleFunction, vSqlDataReader);
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
コード例 #2
0
 /// <summary>
 ///   Load a <see cref="SqlDataReader"/> into a <see cref="RoleFunction"/> object.
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/> argument.</param>
 /// <param name="aSqlDataReader">A <see cref="SqlDataReader"/> argument.</param>
 public static void DataToObject(RoleFunction aRoleFunction, SqlDataReader aSqlDataReader)
 {
     aRoleFunction.RolKey       = Convert.ToInt32(aSqlDataReader["ROL_Key"]);
     aRoleFunction.RolName      = Convert.ToString(aSqlDataReader["ROL_Name"]);
     aRoleFunction.FncKey       = Convert.ToInt32(aSqlDataReader["FNC_Key"]);
     aRoleFunction.FncName      = Convert.ToString(aSqlDataReader["FNC_Name"]);
     aRoleFunction.RfcAccessMap = Convert.ToInt32(aSqlDataReader["RFC_AccessMap"]);
 }
コード例 #3
0
ファイル: RoleFunctionData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   Load a <see cref="SqlDataReader"/> into a <see cref="RoleFunction"/> object.
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/> argument.</param>
 /// <param name="aSqlDataReader">A <see cref="SqlDataReader"/> argument.</param>
 public static void DataToObject(RoleFunction aRoleFunction, SqlDataReader aSqlDataReader)
 {
     aRoleFunction.RolKey = Convert.ToInt32(aSqlDataReader["ROL_Key"]);
     aRoleFunction.RolName = Convert.ToString(aSqlDataReader["ROL_Name"]);
     aRoleFunction.FncKey = Convert.ToInt32(aSqlDataReader["FNC_Key"]);
     aRoleFunction.FncName = Convert.ToString(aSqlDataReader["FNC_Name"]);
     aRoleFunction.RfcAccessMap = Convert.ToInt32(aSqlDataReader["RFC_AccessMap"]);
 }
コード例 #4
0
 /// <summary>
 ///   The <c>AddRoleFunction</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleFunction"/> object.
 ///   It invokes the <c>Insert</c> method of <see cref="RoleFunctionBusiness"/> with the newly deserialized <see cref="RoleFunction"/> object.
 ///   Finally, it returns the inserted object (now with an assigned RoleFunction Key) as a serialized <see cref="string"/> of XML.
 /// </summary>
 /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
 /// <returns><see cref="RoleFunction"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string AddRoleFunction(UserKey aUserKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of AddRoleFunction");
     }
     RoleFunction vRoleFunction = new RoleFunction();
     vRoleFunction = XmlUtils.Deserialize<RoleFunction>(aXmlArgument);
     RoleFunctionBusiness.Insert(aUserKey, vRoleFunction);
     return XmlUtils.Serialize<RoleFunction>(vRoleFunction, true);
 }
コード例 #5
0
        /// <summary>
        ///   The <c>DeleteRoleFunction</c> implementation method deserializes an incoming XML Argument as a new <see cref="RoleFunction"/> object.
        ///   It invokes the <c>Delete</c> method of <see cref="RoleFunctionBusiness"/> with the newly deserialized <see cref="RoleFunction"/> object.
        ///   Finally, it returns the Deleted object unchanged as a serialized <c>string</c> of XML.
        /// </summary>
        /// <param name="aXmlArgument">A XML Argument <see cref="string"/>.</param>
        /// <returns><see cref="RoleFunction"/> as XML <see cref="string"/>.</returns>
        /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
        public static string DeleteRoleFunction(FanKey aFanKey, string aXmlArgument)
        {
            if (aXmlArgument == null)
            {
                throw new ArgumentNullException("aXmlArgument of DeleteRoleFunction");
            }
            RoleFunction vRoleFunction = new RoleFunction();

            vRoleFunction = XmlUtils.Deserialize <RoleFunction>(aXmlArgument);
            RoleFunctionBusiness.Delete(aFanKey, vRoleFunction);
            return(XmlUtils.Serialize <RoleFunction>(vRoleFunction, true));
        }
コード例 #6
0
        /// <summary>
        ///   The <c>AddRoleFunction</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleFunction"/> object.
        ///   It invokes the <c>Insert</c> method of <see cref="RoleFunctionBusiness"/> with the newly deserialized <see cref="RoleFunction"/> object.
        ///   Finally, it returns the inserted object (now with an assigned RoleFunction Key) as a serialized <see cref="string"/> of XML.
        /// </summary>
        /// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
        /// <returns><see cref="RoleFunction"/> as XML <see cref="string"/>.</returns>
        /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
        public static string AddRoleFunction(UserKey aUserKey, string aXmlArgument)
        {
            if (aXmlArgument == null)
            {
                throw new ArgumentNullException("aXmlArgument of AddRoleFunction");
            }
            RoleFunction vRoleFunction = new RoleFunction();

            vRoleFunction = XmlUtils.Deserialize <RoleFunction>(aXmlArgument);
            RoleFunctionBusiness.Insert(aUserKey, vRoleFunction);
            return(XmlUtils.Serialize <RoleFunction>(vRoleFunction, true));
        }
コード例 #7
0
        /// <summary>
        ///   Update a <see cref="RoleFunction"/> object passed as an argument.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aRoleFunction">A <see cref="RoleFunction"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
        public static void Update(FanKey aFanKey, RoleFunction aRoleFunction)
        {
            if (aRoleFunction == null)
            {
                throw new ArgumentNullException("Update RoleFunction Business");
            }

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

            RoleFunctionData.Update(aRoleFunction);
        }
コード例 #8
0
        /// <summary>
        ///   Delete a <see cref="RoleFunction"/> object passed as an argument.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aRoleFunction">A <see cref="RoleFunction"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
        public static void Delete(UserKey aUserKey, RoleFunction aRoleFunction)
        {
            if (aRoleFunction == null)
            {
                throw new ArgumentNullException("Delete RoleFunction Business");
            }

            if (!UserFunctionAccessData.HasModeAccess(aUserKey, "RoleFunction", AccessMode.Delete))
            {
                throw new ZpAccessException("Access Denied", String.Format("{0}", aUserKey.UsrKey), AccessMode.Delete, "RoleFunction");
            }

            RoleFunctionData.Delete(aRoleFunction);
        }
コード例 #9
0
        /// <summary>
        ///   Delete a <see cref="RoleFunction"/> object passed as an argument.
        /// </summary>
        /// <param name="aFanKey">A <see cref="FanKey"/> object.</param>
        /// <param name="aRoleFunction">A <see cref="RoleFunction"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
        public static void Delete(FanKey aFanKey, RoleFunction aRoleFunction)
        {
            if (aRoleFunction == null)
            {
                throw new ArgumentNullException("Delete RoleFunction Business");
            }

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

            RoleFunctionData.Delete(aRoleFunction);
        }
コード例 #10
0
        /// <summary>
        ///   Insert a <see cref="RoleFunction"/> object passed as an argument via Stored Procedure that returns the newly inserted <i>RoleFunction Key</i>.
        /// </summary>
        /// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
        /// <param name="aRoleFunction">A <see cref="RoleFunction"/> object.</param>
        /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
        public static void Insert(UserKey aUserKey, RoleFunction aRoleFunction)
        {
            if (aRoleFunction == null)
            {
                throw new ArgumentNullException("Insert RoleFunction Business");
            }

            if (!UserFunctionAccessData.HasModeAccess(aUserKey, "RoleFunction", AccessMode.Create))
            {
                throw new ZpAccessException("Access Denied", String.Format("{0}", aUserKey.UsrKey), AccessMode.Create, "RoleFunction");
            }

            RoleFunctionData.Insert(aRoleFunction);
        }
コード例 #11
0
        /// <summary>
        ///    Assigns all <c>aSource</c> object's values to this instance of <see cref="RoleFunctionCollection"/>.
        /// </summary>
        /// <param name="aSource">A source object.</param>
        public override void AssignFromSource(object aSource)
        {
            if (!(aSource is RoleFunctionCollection))
            {
                throw new ArgumentException("Invalid assignment source", "RoleFunctionCollection");
            }

            _isFiltered        = (aSource as RoleFunctionCollection)._isFiltered;
            _roleKeyFilter     = (aSource as RoleFunctionCollection)._roleKeyFilter;
            _functionKeyFilter = (aSource as RoleFunctionCollection)._functionKeyFilter;
            _roleFunctionList.Clear();
            foreach (RoleFunction vRoleFunctionSource in (aSource as RoleFunctionCollection)._roleFunctionList)
            {
                RoleFunction vRoleFunctionTarget = new RoleFunction();
                vRoleFunctionTarget.AssignFromSource(vRoleFunctionSource);
                _roleFunctionList.Add(vRoleFunctionTarget);
            }
        }
コード例 #12
0
 /// <summary>
 ///   The overloaded Load method that will fill the <c>RoleFunctionList</c> property a <see cref="RoleFunctionCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="RoleFunction"/>, filtered by the filter properties of the passed <see cref="RoleFunctionCollection"/>.
 /// </summary>
 /// <param name="aRoleFunctionCollection">The <see cref="RoleFunctionCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="RoleFunctionCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunctionCollection</c> argument is <c>null</c>.</exception>
 public static void Load(RoleFunctionCollection aRoleFunctionCollection)
 {
     if (aRoleFunctionCollection == null)
     {
         throw new ArgumentNullException("aRoleFunctionCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aRoleFunctionCollection.IsFiltered)
         {
             if (aRoleFunctionCollection.RoleKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t1.ROL_Key = @ROLKey");
                 vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunctionCollection.RoleKeyFilter);
             }
             if (aRoleFunctionCollection.FunctionKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t2.FNC_Key = @FNCKey");
                 vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunctionCollection.FunctionKeyFilter);
             }
         }
         vStringBuilder.AppendLine("order by t3.RFC_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vRoleFunction = new RoleFunction();
                 DataToObject(vRoleFunction, vSqlDataReader);
                 aRoleFunctionCollection.RoleFunctionList.Add(vRoleFunction);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
コード例 #13
0
 /// <summary>
 ///   Delete a <see cref="RoleFunction"/> object passed as an argument.
 /// </summary>
 /// <param name="aRoleFunction">The <see cref="RoleFunction"/> object to be deleted.</param>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
 public static void Delete(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("delete RFC_RoleFunction");
         vStringBuilder.AppendLine("where  ROL_Key = @ROLKey");
         vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunction.RolKey);
         vStringBuilder.AppendLine("and    FNC_Key = @FNCKey");
         vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunction.FncKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
コード例 #14
0
 /// <summary>
 ///   Update a <see cref="RoleFunction"/> passed as an argument .
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/>.</param>
 public static void Update(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("update RFC_RoleFunction");
         vStringBuilder.AppendLine("set    RFC_AccessMap = @RFCAccessMap");
         vStringBuilder.AppendLine("where  ROL_Key = @ROLKey");
         vStringBuilder.AppendLine("and    FNC_Key = @FNCKey");
         ObjectToData(vSqlCommand, aRoleFunction);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
コード例 #15
0
 /// <summary>
 ///   Insert a <see cref="RoleFunction"/> passed as an argument via Stored Procedure that returns the newly inserted RoleFunction Key
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
 public static void Insert(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into RFC_RoleFunction");
         vStringBuilder.AppendLine("       (ROL_Key, FNC_Key, RFC_AccessMap)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@ROLKey, @FNCKey, @RFCAccessMap)");
         ObjectToData(vSqlCommand, aRoleFunction);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
コード例 #16
0
ファイル: RoleFunctionData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   Insert a <see cref="RoleFunction"/> passed as an argument via Stored Procedure that returns the newly inserted RoleFunction Key 
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
 public static void Insert(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into RFC_RoleFunction");
         vStringBuilder.AppendLine("       (ROL_Key, FNC_Key, RFC_AccessMap)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@ROLKey, @FNCKey, @RFCAccessMap)");
         ObjectToData(vSqlCommand, aRoleFunction);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
コード例 #17
0
ファイル: RoleFunctionData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   Delete a <see cref="RoleFunction"/> object passed as an argument.
 /// </summary>
 /// <param name="aRoleFunction">The <see cref="RoleFunction"/> object to be deleted.</param>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
 public static void Delete(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("delete RFC_RoleFunction");
         vStringBuilder.AppendLine("where  ROL_Key = @ROLKey");
         vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunction.RolKey);
         vStringBuilder.AppendLine("and    FNC_Key = @FNCKey");
         vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunction.FncKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
コード例 #18
0
 /// <summary>
 ///   Loads the <see cref="SqlCommand"/> parameters with values from an <see cref="RoleFunction"/>.
 /// </summary>
 /// <param name="aSqlCommand">A <see cref="SqlDataReader"/> argument.</param>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/> argument.</param>
 public static void ObjectToData(SqlCommand aSqlCommand, RoleFunction aRoleFunction)
 {
     aSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunction.RolKey);
     aSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunction.FncKey);
     aSqlCommand.Parameters.AddWithValue("@RFCAccessMap", aRoleFunction.RfcAccessMap);
 }
コード例 #19
0
ファイル: RoleFunctionData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   The overloaded Load method that will fill the <c>RoleFunctionList</c> property a <see cref="RoleFunctionCollection"/> object as an
 ///   ordered <c>List</c> of <see cref="RoleFunction"/>, filtered by the filter properties of the passed <see cref="RoleFunctionCollection"/>.
 /// </summary>
 /// <param name="aRoleFunctionCollection">The <see cref="RoleFunctionCollection"/> object that must be filled.</param>
 /// <remarks>
 ///   The filter properties of the <see cref="RoleFunctionCollection"/> must be correctly completed by the calling application.
 /// </remarks>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunctionCollection</c> argument is <c>null</c>.</exception>
 public static void Load(RoleFunctionCollection aRoleFunctionCollection)
 {
     if (aRoleFunctionCollection == null)
     {
         throw new ArgumentNullException("aRoleFunctionCollection");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         if (aRoleFunctionCollection.IsFiltered)
         {
             if (aRoleFunctionCollection.RoleKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t1.ROL_Key = @ROLKey");
                 vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunctionCollection.RoleKeyFilter);
             }
             if (aRoleFunctionCollection.FunctionKeyFilter > 0)
             {
                 vStringBuilder.AppendLine("and    t2.FNC_Key = @FNCKey");
                 vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunctionCollection.FunctionKeyFilter);
             }
         }
         vStringBuilder.AppendLine("order by t3.RFC_Key");
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             while (vSqlDataReader.Read())
             {
                 var vRoleFunction = new RoleFunction();
                 DataToObject(vRoleFunction, vSqlDataReader);
                 aRoleFunctionCollection.RoleFunctionList.Add(vRoleFunction);
             }
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }
コード例 #20
0
ファイル: FanImplementation.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   The <c>EditRoleFunction</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleFunction"/> object.
 ///   It invokes the <c>Update</c> method of <see cref="RoleFunctionBusiness"/> with the newly deserialized <see cref="RoleFunction"/> 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="RoleFunction"/> as XML <see cref="string"/>.</returns>
 /// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
 public static string EditRoleFunction(FanKey aFanKey, string aXmlArgument)
 {
     if (aXmlArgument == null)
     {
         throw new ArgumentNullException("aXmlArgument of EditRoleFunction");
     }
     RoleFunction vRoleFunction = new RoleFunction();
     vRoleFunction = XmlUtils.Deserialize<RoleFunction>(aXmlArgument);
     RoleFunctionBusiness.Update(aFanKey, vRoleFunction);
     return XmlUtils.Serialize<RoleFunction>(vRoleFunction, true);
 }
コード例 #21
0
        /// <summary>
        ///    Assigns all <c>aSource</c> object's values to this instance of <see cref="RoleFunctionCollection"/>.
        /// </summary>
        /// <param name="aSource">A source object.</param>
        public override void AssignFromSource(object aSource)
        {
            if (!(aSource is RoleFunctionCollection))
            {
                throw new ArgumentException("Invalid assignment source", "RoleFunctionCollection");
            }

            _isFiltered = (aSource as RoleFunctionCollection)._isFiltered;
            _roleKeyFilter = (aSource as RoleFunctionCollection)._roleKeyFilter;
            _functionKeyFilter = (aSource as RoleFunctionCollection)._functionKeyFilter;
            _roleFunctionList.Clear();
            foreach (RoleFunction vRoleFunctionSource in (aSource as RoleFunctionCollection)._roleFunctionList)
            {
                RoleFunction vRoleFunctionTarget = new RoleFunction();
                vRoleFunctionTarget.AssignFromSource(vRoleFunctionSource);
                _roleFunctionList.Add(vRoleFunctionTarget);
            }
        }
コード例 #22
0
ファイル: RoleFunctionData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   Update a <see cref="RoleFunction"/> passed as an argument .
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/>.</param>
 public static void Update(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("update RFC_RoleFunction");
         vStringBuilder.AppendLine("set    RFC_AccessMap = @RFCAccessMap");
         vStringBuilder.AppendLine("where  ROL_Key = @ROLKey");
         vStringBuilder.AppendLine("and    FNC_Key = @FNCKey");
         ObjectToData(vSqlCommand, aRoleFunction);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         vSqlCommand.ExecuteNonQuery();
         vSqlCommand.Connection.Close();
     }
 }
コード例 #23
0
ファイル: RoleFunctionData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   Loads the <see cref="SqlCommand"/> parameters with values from an <see cref="RoleFunction"/>.
 /// </summary>
 /// <param name="aSqlCommand">A <see cref="SqlDataReader"/> argument.</param>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/> argument.</param>
 public static void ObjectToData(SqlCommand aSqlCommand, RoleFunction aRoleFunction)
 {
     aSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunction.RolKey);
     aSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunction.FncKey);
     aSqlCommand.Parameters.AddWithValue("@RFCAccessMap", aRoleFunction.RfcAccessMap);
 }
コード例 #24
0
ファイル: RoleFunctionData.cs プロジェクト: heinschulie/zfit
 /// <summary>
 ///   The overloaded Load method that will return a specific <see cref="RoleFunction"/>, with keys in the <c>aRoleFunction</c> argument.
 /// </summary>
 /// <param name="aRoleFunction">A <see cref="RoleFunction"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aRoleFunction</c> argument is <c>null</c>.</exception>
 /// <exception cref="Exception">If no record is found.</exception>
 public static void Load(RoleFunction aRoleFunction)
 {
     if (aRoleFunction == null)
     {
         throw new ArgumentNullException("aRoleFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = BuildSQL();
         vStringBuilder.AppendLine("and    t1.ROL_Key = @ROLKey");
         vSqlCommand.Parameters.AddWithValue("@ROLKey", aRoleFunction.RolKey);
         vStringBuilder.AppendLine("and    t2.FNC_Key = @FNCKey");
         vSqlCommand.Parameters.AddWithValue("@FNCKey", aRoleFunction.FncKey);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         using (SqlDataReader vSqlDataReader = vSqlCommand.ExecuteReader())
         {
             if (!vSqlDataReader.HasRows)
             {
                 throw new Exception(String.Format("Expected RoleFunction not found: ROL_Key = {0}, FNC_Key = {1}", aRoleFunction.RolKey, aRoleFunction.FncKey));
             }
             vSqlDataReader.Read();
             DataToObject(aRoleFunction, vSqlDataReader);
             vSqlDataReader.Close();
         }
         vSqlCommand.Connection.Close();
     }
 }