Пример #1
0
        public static bool DeleteByUser(string userId, string claimType, string claimValue)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_UserClaims ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("UserId = :UserId ");
            sqlCommand.Append("AND ");
            sqlCommand.Append("ClaimType = :ClaimType ");
            sqlCommand.Append("AND ");
            sqlCommand.Append("ClaimValue = :ClaimValue ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[3];

            arParams[0]           = new SqliteParameter(":UserId", DbType.String, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = userId;

            arParams[1]           = new SqliteParameter(":ClaimType", DbType.Object);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = claimType;

            arParams[2]           = new SqliteParameter(":ClaimValue", DbType.Object);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = claimValue;

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > 0);
        }
Пример #2
0
        public static IDataReader Find(string loginProvider, string providerKey)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	mp_UserLogins ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("LoginProvider = @LoginProvider AND ");
            sqlCommand.Append("ProviderKey = @ProviderKey  ");

            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[2];

            arParams[0]           = new SqlCeParameter("@LoginProvider", SqlDbType.NVarChar, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = loginProvider;

            arParams[1]           = new SqlCeParameter("@ProviderKey", SqlDbType.NVarChar, 128);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = providerKey;

            return(SqlHelper.ExecuteReader(
                       ConnectionString.GetConnectionString(),
                       CommandType.Text,
                       sqlCommand.ToString(),
                       arParams));
        }
Пример #3
0
        public static int GetCountByModule(Guid moduleGuid, int moderationStatus)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  Count(*) ");
            sqlCommand.Append("FROM	mp_Comments ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ModuleGuid = :ModuleGuid ");
            sqlCommand.Append("AND ");
            sqlCommand.Append("ModerationStatus = :ModerationStatus ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[2];

            arParams[0]           = new SqliteParameter(":ModuleGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleGuid.ToString();

            arParams[1]           = new SqliteParameter(":ModerationStatus", DbType.UInt16);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = moderationStatus;

            return(Convert.ToInt32(SqliteHelper.ExecuteScalar(
                                       ConnectionString.GetConnectionString(),
                                       sqlCommand.ToString(),
                                       arParams)));
        }
Пример #4
0
        /// <summary>
        /// Gets an IDataReader with rows from the mp_Comments table.
        /// </summary>
        /// <param name="guid"> guid </param>
        public static IDataReader GetByParentDesc(Guid parentGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  c.*, ");

            //sqlCommand.Append("SELECT ");
            //sqlCommand.Append("c.Guid AS Guid, ");
            //sqlCommand.Append("c.ParentGuid AS ParentGuid, ");
            //sqlCommand.Append("c.SiteGuid AS SiteGuid, ");
            //sqlCommand.Append("c.FeatureGuid AS FeatureGuid, ");
            //sqlCommand.Append("c.ModuleGuid AS ModuleGuid, ");
            //sqlCommand.Append("c.ContentGuid AS ContentGuid, ");
            //sqlCommand.Append("c.UserGuid AS UserGuid, ");
            //sqlCommand.Append("c.Title AS Title, ");
            //sqlCommand.Append("c.UserComment AS UserComment, ");
            //sqlCommand.Append("c.UserName AS UserName ");
            //sqlCommand.Append("c.UserEmail AS UserEmail, ");
            //sqlCommand.Append("c.UserUrl AS UserUrl, ");
            //sqlCommand.Append("c.UserIp AS UserIp, ");
            //sqlCommand.Append("c.CreatedUtc AS CreatedUtc, ");
            //sqlCommand.Append("c.LastModUtc AS LastModUtc, ");
            //sqlCommand.Append("c.ModerationStatus AS ModerationStatus, ");
            //sqlCommand.Append("c.ModeratedBy AS ModeratedBy, ");
            //sqlCommand.Append("c.ModerationReason AS ModerationReason, ");


            sqlCommand.Append("COALESCE(u.Name, c.UserName) AS PostAuthor, ");
            sqlCommand.Append("COALESCE(u.UserID, -1) AS UserID, ");
            sqlCommand.Append("COALESCE(u.Email, c.UserEmail) AS AuthorEmail, ");
            sqlCommand.Append("COALESCE(u.TotalRevenue, 0) AS UserRevenue, ");
            sqlCommand.Append("COALESCE(u.Trusted, 0) AS Trusted, ");
            sqlCommand.Append("u.AvatarUrl AS PostAuthorAvatar, ");
            sqlCommand.Append("COALESCE(c.UserUrl, u.WebSiteURL) AS PostAuthorWebSiteUrl ");

            sqlCommand.Append("FROM	mp_Comments c ");

            sqlCommand.Append("LEFT OUTER JOIN mp_Users u ");
            sqlCommand.Append("ON c.UserGuid = u.UserGuid ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("c.ParentGuid = :ParentGuid ");
            sqlCommand.Append("ORDER BY c.CreatedUtc DESC ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":ParentGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = parentGuid.ToString();

            return(SqliteHelper.ExecuteReader(
                       ConnectionString.GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Пример #5
0
        public static int Create(
            string userId,
            string claimType,
            string claimValue)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_UserClaims ");
            sqlCommand.Append("(");
            sqlCommand.Append("UserId, ");
            sqlCommand.Append("ClaimType, ");
            sqlCommand.Append("ClaimValue ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@UserId, ");
            sqlCommand.Append("@ClaimType, ");
            sqlCommand.Append("@ClaimValue ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[3];

            arParams[0]           = new SqlCeParameter("@UserId", SqlDbType.NVarChar, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = userId;

            arParams[1]           = new SqlCeParameter("@ClaimType", SqlDbType.NText);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = claimType;

            arParams[2]           = new SqlCeParameter("@ClaimValue", SqlDbType.NText);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = claimValue;


            int newId = Convert.ToInt32(SqlHelper.DoInsertGetIdentitiy(
                                            ConnectionString.GetConnectionString(),
                                            CommandType.Text,
                                            sqlCommand.ToString(),
                                            arParams));

            return(newId);
        }
Пример #6
0
        public static bool Update(
            int id,
            string userId,
            string claimType,
            string claimValue)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_UserClaims ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("UserId = @UserId, ");
            sqlCommand.Append("ClaimType = @ClaimType, ");
            sqlCommand.Append("ClaimValue = @ClaimValue ");

            sqlCommand.Append("WHERE  ");
            sqlCommand.Append("Id = @Id ");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[4];

            arParams[0]           = new SqlCeParameter("@Id", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = id;

            arParams[1]           = new SqlCeParameter("@UserId", SqlDbType.NVarChar, 128);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = userId;

            arParams[2]           = new SqlCeParameter("@ClaimType", SqlDbType.NVarChar);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = claimType;

            arParams[3]           = new SqlCeParameter("@ClaimValue", SqlDbType.NVarChar);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = claimValue;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Пример #7
0
        public static int Create(
            string userId,
            string claimType,
            string claimValue)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_UserClaims (");
            sqlCommand.Append("UserId, ");
            sqlCommand.Append("ClaimType, ");
            sqlCommand.Append("ClaimValue )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":UserId, ");
            sqlCommand.Append(":ClaimType, ");
            sqlCommand.Append(":ClaimValue )");
            sqlCommand.Append(";");

            sqlCommand.Append("SELECT LAST_INSERT_ROWID();");

            SqliteParameter[] arParams = new SqliteParameter[3];

            arParams[0]           = new SqliteParameter(":UserId", DbType.String, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = userId;

            arParams[1]           = new SqliteParameter(":ClaimType", DbType.Object);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = claimType;

            arParams[2]           = new SqliteParameter(":ClaimValue", DbType.Object);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = claimValue;


            int newID = Convert.ToInt32(SqliteHelper.ExecuteScalar(
                                            ConnectionString.GetConnectionString(),
                                            sqlCommand.ToString(),
                                            arParams).ToString());

            return(newID);
        }
Пример #8
0
		public static bool DeleteByExtraGuid(Guid extraGuid)
		{
			const string sqlCommand = @"DELETE FROM mp_TagItem WHERE ExtraGuid = :ExtraGuid;";

			var arParams = new List<SqliteParameter>
			{
				new SqliteParameter(":ExtraGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = extraGuid.ToString()
				}
			}.ToArray();

			int rowsAffected = SqliteHelper.ExecuteNonQuery(
				ConnectionString.GetConnectionString(),
				sqlCommand.ToString(),
				arParams
			);

			return rowsAffected > 0;
		}
Пример #9
0
        public static IDataReader GetByUser(string userId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	mp_UserClaims ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("UserId = :UserId ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":UserId", DbType.String, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = userId;

            return(SqliteHelper.ExecuteReader(
                       ConnectionString.GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Пример #10
0
        public static bool Create(string loginProvider, string providerKey, string userId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_UserLogins (");
            sqlCommand.Append("LoginProvider ,");
            sqlCommand.Append("ProviderKey, ");
            sqlCommand.Append("UserId ");
            sqlCommand.Append(") ");

            sqlCommand.Append("VALUES (");
            sqlCommand.Append(":LoginProvider, ");
            sqlCommand.Append(":ProviderKey, ");
            sqlCommand.Append(":UserId ");
            sqlCommand.Append(")");

            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[3];

            arParams[0]           = new SqliteParameter(":LoginProvider", DbType.String, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = loginProvider;

            arParams[1]           = new SqliteParameter(":ProviderKey", DbType.String, 128);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = providerKey;

            arParams[2]           = new SqliteParameter(":UserId", DbType.String, 128);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = userId;


            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Пример #11
0
        public static bool DeleteBySite(Guid siteGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_UserClaims ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("UserId IN (SELECT UserGuid FROM mp_Users WHERE SiteGuid = :SiteGuid) ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":SiteGuid", DbType.String, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteGuid.ToString();

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > 0);
        }
Пример #12
0
        /// <summary>
        /// Deletes rows from the mp_Comments table. Returns true if row deleted.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <returns>bool</returns>
        public static bool DeleteByParent(Guid parentGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_Comments ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ParentGuid = :ParentGuid ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":ParentGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = parentGuid.ToString();

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > 0);
        }
Пример #13
0
        public static bool Delete(int id)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_UserClaims ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("Id = :Id ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":Id", DbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = id;

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > 0);
        }
Пример #14
0
        public static IDataReader GetByUser(string userId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	mp_UserLogins ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("UserId = @UserId  ");

            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[1];

            arParams[0]           = new SqlCeParameter("@UserId", SqlDbType.NVarChar, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = userId;

            return(SqlHelper.ExecuteReader(
                       ConnectionString.GetConnectionString(),
                       CommandType.Text,
                       sqlCommand.ToString(),
                       arParams));
        }
Пример #15
0
        public static bool DeleteByUser(string userId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_UserClaims ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("UserId = @UserId ");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[1];

            arParams[0]           = new SqlCeParameter("@UserId", SqlDbType.NVarChar, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = userId;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Пример #16
0
        /// <summary>
        /// Deletes rows from the mp_Comments table. Returns true if row deleted.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <returns>bool</returns>
        public static bool DeleteByParent(Guid parentGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_Comments ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ParentGuid = @ParentGuid ");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[1];

            arParams[0]           = new SqlCeParameter("@ParentGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = parentGuid;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Пример #17
0
        public static int GetCountBySite(Guid siteGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  Count(*) ");
            sqlCommand.Append("FROM	mp_Comments ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append(":SiteGuid = '00000000-0000-0000-0000-000000000000' ");
            sqlCommand.Append("OR ");
            sqlCommand.Append("SiteGuid = :SiteGuid ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteGuid.ToString();

            return(Convert.ToInt32(SqliteHelper.ExecuteScalar(
                                       ConnectionString.GetConnectionString(),
                                       sqlCommand.ToString(),
                                       arParams)));
        }
Пример #18
0
        public static bool DeleteBySite(Guid siteGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_UserLogins ");
            sqlCommand.Append("WHERE ");

            sqlCommand.Append("UserId IN (SELECT UserGuid FROM mp_Users WHERE SiteGuid = @SiteGuid) ");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[1];

            arParams[0]           = new SqlCeParameter("@SiteGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteGuid;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Пример #19
0
        public static bool Delete(
            string loginProvider,
            string providerKey,
            string userId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("DELETE FROM mp_UserLogins ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("LoginProvider = :LoginProvider AND ");
            sqlCommand.Append("ProviderKey = :ProviderKey AND ");
            sqlCommand.Append("UserId = :UserId ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[3];

            arParams[0]           = new SqliteParameter(":LoginProvider", DbType.String, 128);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = loginProvider;

            arParams[1]           = new SqliteParameter(":ProviderKey", DbType.String, 128);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = providerKey;

            arParams[2]           = new SqliteParameter(":UserId", DbType.String, 128);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = userId;


            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > 0);
        }
Пример #20
0
        /// <summary>
        /// Updates a row in the mp_Comments table. Returns true if row updated.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="title"> title </param>
        /// <param name="userComment"> userComment </param>
        /// <param name="userName"> userName </param>
        /// <param name="userEmail"> userEmail </param>
        /// <param name="userUrl"> userUrl </param>
        /// <param name="userIp"> userIp </param>
        /// <param name="lastModUtc"> lastModUtc </param>
        /// <param name="moderationStatus"> moderationStatus </param>
        /// <param name="moderatedBy"> moderatedBy </param>
        /// <param name="moderationReason"> moderationReason </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            Guid userGuid,
            string title,
            string userComment,
            string userName,
            string userEmail,
            string userUrl,
            string userIp,
            DateTime lastModUtc,
            byte moderationStatus,
            Guid moderatedBy,
            string moderationReason)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_Comments ");
            sqlCommand.Append("SET  ");

            sqlCommand.Append("UserGuid = @UserGuid, ");
            sqlCommand.Append("Title = @Title, ");
            sqlCommand.Append("UserComment = @UserComment, ");
            sqlCommand.Append("UserName = @UserName, ");
            sqlCommand.Append("UserEmail = @UserEmail, ");
            sqlCommand.Append("UserUrl = @UserUrl, ");
            sqlCommand.Append("UserIp = @UserIp, ");

            sqlCommand.Append("LastModUtc = @LastModUtc, ");
            sqlCommand.Append("ModerationStatus = @ModerationStatus, ");
            sqlCommand.Append("ModeratedBy = @ModeratedBy, ");
            sqlCommand.Append("ModerationReason = @ModerationReason ");

            sqlCommand.Append("WHERE  ");
            sqlCommand.Append("Guid = @Guid ");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[12];

            arParams[0]           = new SqlCeParameter("@Guid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid;

            arParams[1]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = userGuid;

            arParams[2]           = new SqlCeParameter("@Title", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = title;

            arParams[3]           = new SqlCeParameter("@UserComment", SqlDbType.NVarChar);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = userComment;

            arParams[4]           = new SqlCeParameter("@UserName", SqlDbType.NVarChar, 50);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = userName;

            arParams[5]           = new SqlCeParameter("@UserEmail", SqlDbType.NVarChar, 100);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = userEmail;

            arParams[6]           = new SqlCeParameter("@UserUrl", SqlDbType.NVarChar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = userUrl;

            arParams[7]           = new SqlCeParameter("@UserIp", SqlDbType.NVarChar, 50);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = userIp;

            arParams[8]           = new SqlCeParameter("@LastModUtc", SqlDbType.DateTime);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModUtc;

            arParams[9]           = new SqlCeParameter("@ModerationStatus", SqlDbType.TinyInt);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = moderationStatus;

            arParams[10]           = new SqlCeParameter("@ModeratedBy", SqlDbType.UniqueIdentifier);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = moderatedBy;

            arParams[11]           = new SqlCeParameter("@ModerationReason", SqlDbType.NVarChar, 255);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = moderationReason;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Пример #21
0
		public static bool Create(
			Guid tagItemGuid,
			Guid siteGuid,
			Guid featureGuid,
			Guid moduleGuid,
			Guid relatedItemGuid,
			Guid tagGuid,
			Guid extraGuid,
			Guid taggedBy
		)
		{
			const string sqlCommand =
				@"INSERT INTO mp_TagItem (
					TagItemGuid,
					SiteGuid,
					FeatureGuid,
					ModuleGuid,
					RelatedItemGuid,
					TagGuid,
					ExtraGuid,
					TaggedBy
				)

				VALUES (
					:TagItemGuid,
					:SiteGuid,
					:FeatureGuid,
					:ModuleGuid,
					:RelatedItemGuid,
					:TagGuid,
					:ExtraGuid,
					:TaggedBy
				);";

			var arParams = new List<SqliteParameter>
			{
				new SqliteParameter(":TagItemGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = tagItemGuid.ToString()
				},
				new SqliteParameter(":SiteGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = siteGuid.ToString()
				},
				new SqliteParameter(":FeatureGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = featureGuid.ToString()
				},
				new SqliteParameter(":ModuleGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = moduleGuid.ToString()
				},
				new SqliteParameter(":RelatedItemGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = relatedItemGuid.ToString()
				},
				new SqliteParameter(":TagGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = tagGuid.ToString()
				},
				new SqliteParameter(":ExtraGuid", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = extraGuid.ToString()
				},
				new SqliteParameter(":TaggedBy", DbType.String, 36)
				{
					Direction = ParameterDirection.Input,
					Value = taggedBy.ToString()
				}
			}.ToArray();


			int rowsAffected = SqliteHelper.ExecuteNonQuery(
				ConnectionString.GetConnectionString(),
				sqlCommand.ToString(),
				arParams
			);

			return rowsAffected > -1;
		}
Пример #22
0
        /// <summary>
        /// Inserts a row in the mp_Comments table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="parentGuid"> parentGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="featureGuid"> featureGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="contentGuid"> contentGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="title"> title </param>
        /// <param name="userComment"> userComment </param>
        /// <param name="userName"> userName </param>
        /// <param name="userEmail"> userEmail </param>
        /// <param name="userUrl"> userUrl </param>
        /// <param name="userIp"> userIp </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="moderationStatus"> moderationStatus </param>
        /// <param name="moderatedBy"> moderatedBy </param>
        /// <param name="moderationReason"> moderationReason </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid parentGuid,
            Guid siteGuid,
            Guid featureGuid,
            Guid moduleGuid,
            Guid contentGuid,
            Guid userGuid,
            string title,
            string userComment,
            string userName,
            string userEmail,
            string userUrl,
            string userIp,
            DateTime createdUtc,
            byte moderationStatus,
            Guid moderatedBy,
            string moderationReason)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_Comments (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("ParentGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("FeatureGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("ContentGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("UserComment, ");
            sqlCommand.Append("UserName, ");
            sqlCommand.Append("UserEmail, ");
            sqlCommand.Append("UserUrl, ");
            sqlCommand.Append("UserIp, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("ModerationStatus, ");
            sqlCommand.Append("ModeratedBy, ");
            sqlCommand.Append("ModerationReason )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":ParentGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":FeatureGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":ContentGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":UserComment, ");
            sqlCommand.Append(":UserName, ");
            sqlCommand.Append(":UserEmail, ");
            sqlCommand.Append(":UserUrl, ");
            sqlCommand.Append(":UserIp, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":LastModUtc, ");
            sqlCommand.Append(":ModerationStatus, ");
            sqlCommand.Append(":ModeratedBy, ");
            sqlCommand.Append(":ModerationReason )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[18];

            arParams[0]           = new SqliteParameter(":Guid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new SqliteParameter(":ParentGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = parentGuid.ToString();

            arParams[2]           = new SqliteParameter(":SiteGuid", DbType.String, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = siteGuid.ToString();

            arParams[3]           = new SqliteParameter(":FeatureGuid", DbType.String, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = featureGuid.ToString();

            arParams[4]           = new SqliteParameter(":ModuleGuid", DbType.String, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = moduleGuid.ToString();

            arParams[5]           = new SqliteParameter(":ContentGuid", DbType.String, 36);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = contentGuid.ToString();

            arParams[6]           = new SqliteParameter(":UserGuid", DbType.String, 36);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = userGuid.ToString();

            arParams[7]           = new SqliteParameter(":Title", DbType.String, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = title;

            arParams[8]           = new SqliteParameter(":UserComment", DbType.Object);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = userComment;

            arParams[9]           = new SqliteParameter(":UserName", DbType.String, 50);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = userName;

            arParams[10]           = new SqliteParameter(":UserEmail", DbType.String, 100);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = userEmail;

            arParams[11]           = new SqliteParameter(":UserUrl", DbType.String, 255);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = userUrl;

            arParams[12]           = new SqliteParameter(":UserIp", DbType.String, 50);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = userIp;

            arParams[13]           = new SqliteParameter(":CreatedUtc", DbType.DateTime);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = createdUtc;

            arParams[14]           = new SqliteParameter(":LastModUtc", DbType.DateTime);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = createdUtc;

            arParams[15]           = new SqliteParameter(":ModerationStatus", DbType.UInt16);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = moderationStatus;

            arParams[16]           = new SqliteParameter(":ModeratedBy", DbType.String, 36);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = moderatedBy.ToString();

            arParams[17]           = new SqliteParameter(":ModerationReason", DbType.String, 255);
            arParams[17].Direction = ParameterDirection.Input;
            arParams[17].Value     = moderationReason;

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Пример #23
0
        /// <summary>
        /// Updates a row in the mp_Comments table. Returns true if row updated.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="title"> title </param>
        /// <param name="userComment"> userComment </param>
        /// <param name="userName"> userName </param>
        /// <param name="userEmail"> userEmail </param>
        /// <param name="userUrl"> userUrl </param>
        /// <param name="userIp"> userIp </param>
        /// <param name="lastModUtc"> lastModUtc </param>
        /// <param name="moderationStatus"> moderationStatus </param>
        /// <param name="moderatedBy"> moderatedBy </param>
        /// <param name="moderationReason"> moderationReason </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            Guid userGuid,
            string title,
            string userComment,
            string userName,
            string userEmail,
            string userUrl,
            string userIp,
            DateTime lastModUtc,
            byte moderationStatus,
            Guid moderatedBy,
            string moderationReason)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_Comments ");
            sqlCommand.Append("SET  ");

            sqlCommand.Append("UserGuid = :UserGuid, ");
            sqlCommand.Append("Title = :Title, ");
            sqlCommand.Append("UserComment = :UserComment, ");
            sqlCommand.Append("UserName = :UserName, ");
            sqlCommand.Append("UserEmail = :UserEmail, ");
            sqlCommand.Append("UserUrl = :UserUrl, ");
            sqlCommand.Append("UserIp = :UserIp, ");
            sqlCommand.Append("LastModUtc = :LastModUtc, ");
            sqlCommand.Append("ModerationStatus = :ModerationStatus, ");
            sqlCommand.Append("ModeratedBy = :ModeratedBy, ");
            sqlCommand.Append("ModerationReason = :ModerationReason ");

            sqlCommand.Append("WHERE  ");
            sqlCommand.Append("Guid = :Guid ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[12];

            arParams[0]           = new SqliteParameter(":Guid", DbType.String, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new SqliteParameter(":UserGuid", DbType.String, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = userGuid.ToString();

            arParams[2]           = new SqliteParameter(":Title", DbType.String, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = title;

            arParams[3]           = new SqliteParameter(":UserComment", DbType.Object);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = userComment;

            arParams[4]           = new SqliteParameter(":UserName", DbType.String, 50);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = userName;

            arParams[5]           = new SqliteParameter(":UserEmail", DbType.String, 100);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = userEmail;

            arParams[6]           = new SqliteParameter(":UserUrl", DbType.String, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = userUrl;

            arParams[7]           = new SqliteParameter(":UserIp", DbType.String, 50);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = userIp;

            arParams[8]           = new SqliteParameter(":LastModUtc", DbType.DateTime);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModUtc;

            arParams[9]           = new SqliteParameter(":ModerationStatus", DbType.UInt16);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = moderationStatus;

            arParams[10]           = new SqliteParameter(":ModeratedBy", DbType.String, 36);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = moderatedBy.ToString();

            arParams[11]           = new SqliteParameter(":ModerationReason", DbType.String, 255);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = moderationReason;

            int rowsAffected = SqliteHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Пример #24
0
        /// <summary>
        /// Inserts a row in the mp_Comments table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="parentGuid"> parentGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="featureGuid"> featureGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="contentGuid"> contentGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="title"> title </param>
        /// <param name="userComment"> userComment </param>
        /// <param name="userName"> userName </param>
        /// <param name="userEmail"> userEmail </param>
        /// <param name="userUrl"> userUrl </param>
        /// <param name="userIp"> userIp </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="moderationStatus"> moderationStatus </param>
        /// <param name="moderatedBy"> moderatedBy </param>
        /// <param name="moderationReason"> moderationReason </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid parentGuid,
            Guid siteGuid,
            Guid featureGuid,
            Guid moduleGuid,
            Guid contentGuid,
            Guid userGuid,
            string title,
            string userComment,
            string userName,
            string userEmail,
            string userUrl,
            string userIp,
            DateTime createdUtc,
            byte moderationStatus,
            Guid moderatedBy,
            string moderationReason)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_Comments ");
            sqlCommand.Append("(");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("ParentGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("FeatureGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("ContentGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("UserComment, ");
            sqlCommand.Append("UserName, ");
            sqlCommand.Append("UserEmail, ");
            sqlCommand.Append("UserUrl, ");
            sqlCommand.Append("UserIp, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("ModerationStatus, ");
            sqlCommand.Append("ModeratedBy, ");
            sqlCommand.Append("ModerationReason ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@Guid, ");
            sqlCommand.Append("@ParentGuid, ");
            sqlCommand.Append("@SiteGuid, ");
            sqlCommand.Append("@FeatureGuid, ");
            sqlCommand.Append("@ModuleGuid, ");
            sqlCommand.Append("@ContentGuid, ");
            sqlCommand.Append("@UserGuid, ");
            sqlCommand.Append("@Title, ");
            sqlCommand.Append("@UserComment, ");
            sqlCommand.Append("@UserName, ");
            sqlCommand.Append("@UserEmail, ");
            sqlCommand.Append("@UserUrl, ");
            sqlCommand.Append("@UserIp, ");
            sqlCommand.Append("@CreatedUtc, ");
            sqlCommand.Append("@LastModUtc, ");
            sqlCommand.Append("@ModerationStatus, ");
            sqlCommand.Append("@ModeratedBy, ");
            sqlCommand.Append("@ModerationReason ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[18];

            arParams[0]           = new SqlCeParameter("@Guid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid;

            arParams[1]           = new SqlCeParameter("@ParentGuid", SqlDbType.UniqueIdentifier);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = parentGuid;

            arParams[2]           = new SqlCeParameter("@SiteGuid", SqlDbType.UniqueIdentifier);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = siteGuid;

            arParams[3]           = new SqlCeParameter("@FeatureGuid", SqlDbType.UniqueIdentifier);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = featureGuid;

            arParams[4]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = moduleGuid;

            arParams[5]           = new SqlCeParameter("@ContentGuid", SqlDbType.UniqueIdentifier);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = contentGuid;

            arParams[6]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = userGuid;

            arParams[7]           = new SqlCeParameter("@Title", SqlDbType.NVarChar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = title;

            arParams[8]           = new SqlCeParameter("@UserComment", SqlDbType.NText);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = userComment;

            arParams[9]           = new SqlCeParameter("@UserName", SqlDbType.NVarChar, 50);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = userName;

            arParams[10]           = new SqlCeParameter("@UserEmail", SqlDbType.NVarChar, 100);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = userEmail;

            arParams[11]           = new SqlCeParameter("@UserUrl", SqlDbType.NVarChar, 255);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = userUrl;

            arParams[12]           = new SqlCeParameter("@UserIp", SqlDbType.NVarChar, 50);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = userIp;

            arParams[13]           = new SqlCeParameter("@CreatedUtc", SqlDbType.DateTime);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = createdUtc;

            arParams[14]           = new SqlCeParameter("@LastModUtc", SqlDbType.DateTime);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = createdUtc;

            arParams[15]           = new SqlCeParameter("@ModerationStatus", SqlDbType.TinyInt);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = moderationStatus;

            arParams[16]           = new SqlCeParameter("@ModeratedBy", SqlDbType.UniqueIdentifier);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = moderatedBy;

            arParams[17]           = new SqlCeParameter("@ModerationReason", SqlDbType.NVarChar, 255);
            arParams[17].Direction = ParameterDirection.Input;
            arParams[17].Value     = moderationReason;

            int rowsAffected = SqlHelper.ExecuteNonQuery(
                ConnectionString.GetConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }