コード例 #1
0
ファイル: DBRssFeed.cs プロジェクト: zahedbri/mojoportal
        public static bool UpdateRssFeed(
            int itemId,
            int moduleId,
            string author,
            string url,
            string rssUrl,
            Guid lastModUserGuid,
            DateTime lastModUtc,
            string imageUrl,
            string feedType,
            bool publishByDefault,
            int sortRank)
        {
            #region Bit Conversion

            int intPublishByDefault;
            if (publishByDefault)
            {
                intPublishByDefault = 1;
            }
            else
            {
                intPublishByDefault = 0;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_RssFeeds ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("ModuleID = :ModuleID, ");
            sqlCommand.Append("Author = :Author, ");
            sqlCommand.Append("Url = :Url, ");
            sqlCommand.Append("RssUrl = :RssUrl,");
            sqlCommand.Append("LastModUserGuid = :LastModUserGuid, ");
            sqlCommand.Append("LastModUtc = :LastModUtc, ");
            sqlCommand.Append("ImageUrl = :ImageUrl, ");
            sqlCommand.Append("FeedType = :FeedType, ");
            sqlCommand.Append("SortRank = :SortRank, ");
            sqlCommand.Append("PublishByDefault = :PublishByDefault ");

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

            SqliteParameter[] arParams = new SqliteParameter[11];

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

            arParams[1]           = new SqliteParameter(":ModuleID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = moduleId;

            arParams[2]           = new SqliteParameter(":Author", DbType.String, 100);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = author;

            arParams[3]           = new SqliteParameter(":Url", DbType.String, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = url;

            arParams[4]           = new SqliteParameter(":RssUrl", DbType.String, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = rssUrl;

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

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

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

            arParams[8]           = new SqliteParameter(":FeedType", DbType.String, 20);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = feedType;

            arParams[9]           = new SqliteParameter(":PublishByDefault", DbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = intPublishByDefault;

            arParams[10]           = new SqliteParameter(":SortRank", DbType.Int32);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = sortRank;

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

            return(rowsAffected > -1);
        }
コード例 #2
0
        public static int AddModuleDefinition(
            Guid featureGuid,
            int siteId,
            string featureName,
            string controlSrc,
            int sortOrder,
            int defaultCacheTime,
            String icon,
            bool isAdmin,
            string resourceFile,
            bool isCacheable,
            bool isSearchable,
            string searchListName,
            bool supportsPageReuse,
            string deleteProvider,
            string partialView,
            string skinFileName)
        {
            int intIsAdmin = 0;

            if (isAdmin)
            {
                intIsAdmin = 1;
            }

            int intIsCacheable = 0;

            if (isCacheable)
            {
                intIsCacheable = 1;
            }

            int intIsSearchable = 0;

            if (isSearchable)
            {
                intIsSearchable = 1;
            }

            int intSupportsPageReuse = 0;

            if (supportsPageReuse)
            {
                intSupportsPageReuse = 1;
            }


            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_ModuleDefinitions (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("FeatureName, ");
            sqlCommand.Append("ControlSrc, ");
            sqlCommand.Append("SortOrder, ");
            sqlCommand.Append("DefaultCacheTime, ");
            sqlCommand.Append("Icon, ");
            sqlCommand.Append("IsAdmin, ");
            sqlCommand.Append("IsCacheable, ");
            sqlCommand.Append("IsSearchable, ");
            sqlCommand.Append("SearchListName, ");
            sqlCommand.Append("SupportsPageReuse, ");
            sqlCommand.Append("DeleteProvider, ");
            sqlCommand.Append("PartialView, ");
            sqlCommand.Append("ResourceFile, ");
            sqlCommand.Append("SkinFileName ");
            sqlCommand.Append(" )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":FeatureGuid, ");
            sqlCommand.Append(":FeatureName, ");
            sqlCommand.Append(":ControlSrc, ");
            sqlCommand.Append(":SortOrder, ");
            sqlCommand.Append(":DefaultCacheTime, ");
            sqlCommand.Append(":Icon, ");
            sqlCommand.Append(":IsAdmin, ");
            sqlCommand.Append(":IsCacheable, ");
            sqlCommand.Append(":IsSearchable, ");
            sqlCommand.Append(":SearchListName, ");
            sqlCommand.Append(":SupportsPageReuse, ");
            sqlCommand.Append(":DeleteProvider, ");
            sqlCommand.Append(":PartialView, ");
            sqlCommand.Append(":ResourceFile, ");
            sqlCommand.Append(":SkinFileName ");
            sqlCommand.Append(" );");

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

            SqliteParameter[] arParams = new SqliteParameter[16];

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

            arParams[1]           = new SqliteParameter(":FeatureName", DbType.String, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = featureName;

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

            arParams[3]           = new SqliteParameter(":SortOrder", DbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = sortOrder;

            arParams[4]           = new SqliteParameter(":IsAdmin", DbType.Int32);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = intIsAdmin;

            arParams[5]           = new SqliteParameter(":Icon", DbType.String, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = icon;

            arParams[6]           = new SqliteParameter(":DefaultCacheTime", DbType.Int32);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = defaultCacheTime;

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

            arParams[8]           = new SqliteParameter(":ResourceFile", DbType.String, 255);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = resourceFile;

            arParams[9]           = new SqliteParameter(":IsCacheable", DbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = intIsCacheable;

            arParams[10]           = new SqliteParameter(":IsSearchable", DbType.Int32);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = intIsSearchable;

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

            arParams[12]           = new SqliteParameter(":SupportsPageReuse", DbType.Int32);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = intSupportsPageReuse;

            arParams[13]           = new SqliteParameter(":DeleteProvider", DbType.String, 255);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = deleteProvider;

            arParams[14]           = new SqliteParameter(":PartialView", DbType.String, 255);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = partialView;

            arParams[15]           = new SqliteParameter(":SkinFileName", DbType.String, 255);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = skinFileName;

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

            if (siteId > -1)
            {
                // now add to  mp_SiteModuleDefinitions
                sqlCommand = new StringBuilder();
                sqlCommand.Append("INSERT INTO mp_SiteModuleDefinitions (");
                sqlCommand.Append("SiteID, ");
                sqlCommand.Append("SiteGuid, ");
                sqlCommand.Append("FeatureGuid, ");
                sqlCommand.Append("AuthorizedRoles, ");
                sqlCommand.Append("ModuleDefID ) ");

                sqlCommand.Append(" VALUES (");
                sqlCommand.Append(":SiteID, ");
                sqlCommand.Append("(SELECT SiteGuid FROM mp_Sites WHERE SiteID = :SiteID LIMIT 1), ");
                sqlCommand.Append("(SELECT Guid FROM mp_ModuleDefinitions WHERE ModuleDefID = :ModuleDefID LIMIT 1), ");
                sqlCommand.Append("'All Users', ");
                sqlCommand.Append(":ModuleDefID ) ; ");

                arParams = new SqliteParameter[2];

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

                arParams[1]           = new SqliteParameter(":ModuleDefID", DbType.Int32);
                arParams[1].Direction = ParameterDirection.Input;
                arParams[1].Value     = newID;

                SqliteHelper.ExecuteNonQuery(
                    GetConnectionString(),
                    sqlCommand.ToString(),
                    arParams);
            }

            return(newID);
        }
コード例 #3
0
        public static bool UpdateModuleDefinitionSettingById(
            int id,
            int moduleDefId,
            string resourceFile,
            string groupName,
            string settingName,
            string settingValue,
            string controlType,
            string regexValidationExpression,
            string controlSrc,
            string helpKey,
            int sortOrder,
            string attributes,
            string options)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_ModuleDefinitionSettings ");
            sqlCommand.Append("SET SettingName = :SettingName,  ");
            sqlCommand.Append("ResourceFile = :ResourceFile,  ");
            sqlCommand.Append("SettingValue = :SettingValue,  ");
            sqlCommand.Append("ControlType = :ControlType,  ");
            sqlCommand.Append("ControlSrc = :ControlSrc  ,");
            sqlCommand.Append("HelpKey = :HelpKey  ,");
            sqlCommand.Append("SortOrder = :SortOrder  ,");
            sqlCommand.Append("GroupName = :GroupName  ,");
            sqlCommand.Append("RegexValidationExpression = :RegexValidationExpression,  ");
            sqlCommand.Append("Attributes = :Attributes,  ");
            sqlCommand.Append("Options = :Options  ");

            sqlCommand.Append("WHERE ID = :ID  ");
            sqlCommand.Append("AND ModuleDefID = :ModuleDefID  ; ");

            SqliteParameter[] arParams = new SqliteParameter[13];

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

            arParams[1]           = new SqliteParameter(":ModuleDefID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = moduleDefId;

            arParams[2]           = new SqliteParameter(":SettingName", DbType.String, 50);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = settingName;

            arParams[3]           = new SqliteParameter(":SettingValue", DbType.String, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = settingValue;

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

            arParams[5]           = new SqliteParameter(":RegexValidationExpression", DbType.Object);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = regexValidationExpression;

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

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

            arParams[8]           = new SqliteParameter(":HelpKey", DbType.String, 255);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = helpKey;

            arParams[9]           = new SqliteParameter(":SortOrder", DbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = sortOrder;

            arParams[10]           = new SqliteParameter(":GroupName", DbType.String, 255);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = groupName;

            arParams[11]           = new SqliteParameter(":Attributes", DbType.Object);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = attributes;

            arParams[12]           = new SqliteParameter(":Options", DbType.Object);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = options;

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

            return(rowsAffected > 0);
        }
コード例 #4
0
        /// <summary>
        /// Inserts a row in the mp_PaymentLog table. Returns rows affected count.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="storeGuid"> storeGuid </param>
        /// <param name="cartGuid"> cartGuid </param>
        /// <param name="provider"> provider </param>
        /// <param name="rawResponse"> rawResponse </param>
        /// <param name="responseCode"> responseCode </param>
        /// <param name="responseReasonCode"> responseReasonCode </param>
        /// <param name="reason"> reason </param>
        /// <param name="avsCode"> avsCode </param>
        /// <param name="ccvCode"> ccvCode </param>
        /// <param name="cavCode"> cavCode </param>
        /// <param name="transactionId"> transactionId </param>
        /// <param name="transactionType"> transactionType </param>
        /// <param name="method"> method </param>
        /// <param name="authCode"> authCode </param>
        /// <param name="amount"> amount </param>
        /// <param name="tax"> tax </param>
        /// <param name="duty"> duty </param>
        /// <param name="freight"> freight </param>
        /// <returns>int</returns>
        public static int Create(
            Guid rowGuid,
            DateTime createdUtc,
            Guid siteGuid,
            Guid userGuid,
            Guid storeGuid,
            Guid cartGuid,
            string provider,
            string rawResponse,
            string responseCode,
            string responseReasonCode,
            string reason,
            string avsCode,
            string ccvCode,
            string cavCode,
            string transactionId,
            string transactionType,
            string method,
            string authCode,
            decimal amount,
            decimal tax,
            decimal duty,
            decimal freight)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_PaymentLog (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("StoreGuid, ");
            sqlCommand.Append("CartGuid, ");
            sqlCommand.Append("Provider, ");
            sqlCommand.Append("RawResponse, ");
            sqlCommand.Append("ResponseCode, ");
            sqlCommand.Append("ResponseReasonCode, ");
            sqlCommand.Append("Reason, ");
            sqlCommand.Append("AvsCode, ");
            sqlCommand.Append("CcvCode, ");
            sqlCommand.Append("CavCode, ");
            sqlCommand.Append("TransactionId, ");
            sqlCommand.Append("TransactionType, ");
            sqlCommand.Append("Method, ");
            sqlCommand.Append("AuthCode, ");
            sqlCommand.Append("Amount, ");
            sqlCommand.Append("Tax, ");
            sqlCommand.Append("Duty, ");
            sqlCommand.Append("Freight )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":RowGuid, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":StoreGuid, ");
            sqlCommand.Append(":CartGuid, ");
            sqlCommand.Append(":Provider, ");
            sqlCommand.Append(":RawResponse, ");
            sqlCommand.Append(":ResponseCode, ");
            sqlCommand.Append(":ResponseReasonCode, ");
            sqlCommand.Append(":Reason, ");
            sqlCommand.Append(":AvsCode, ");
            sqlCommand.Append(":CcvCode, ");
            sqlCommand.Append(":CavCode, ");
            sqlCommand.Append(":TransactionId, ");
            sqlCommand.Append(":TransactionType, ");
            sqlCommand.Append(":Method, ");
            sqlCommand.Append(":AuthCode, ");
            sqlCommand.Append(":Amount, ");
            sqlCommand.Append(":Tax, ");
            sqlCommand.Append(":Duty, ");
            sqlCommand.Append(":Freight )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[22];

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

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

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

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

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

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

            arParams[6]           = new SqliteParameter(":RawResponse", DbType.Object);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = rawResponse;

            arParams[7]           = new SqliteParameter(":ResponseCode", DbType.String, 1);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = responseCode;

            arParams[8]           = new SqliteParameter(":ResponseReasonCode", DbType.String, 20);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = responseReasonCode;

            arParams[9]           = new SqliteParameter(":Reason", DbType.Object);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = reason;

            arParams[10]           = new SqliteParameter(":AvsCode", DbType.String, 50);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = avsCode;

            arParams[11]           = new SqliteParameter(":CcvCode", DbType.String, 1);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = ccvCode;

            arParams[12]           = new SqliteParameter(":CavCode", DbType.String, 1);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = cavCode;

            arParams[13]           = new SqliteParameter(":TransactionId", DbType.String, 50);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = transactionId;

            arParams[14]           = new SqliteParameter(":TransactionType", DbType.String, 50);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = transactionType;

            arParams[15]           = new SqliteParameter(":Method", DbType.String, 20);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = method;

            arParams[16]           = new SqliteParameter(":AuthCode", DbType.String, 50);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = authCode;

            arParams[17]           = new SqliteParameter(":Amount", DbType.Decimal);
            arParams[17].Direction = ParameterDirection.Input;
            arParams[17].Value     = amount;

            arParams[18]           = new SqliteParameter(":Tax", DbType.Decimal);
            arParams[18].Direction = ParameterDirection.Input;
            arParams[18].Value     = tax;

            arParams[19]           = new SqliteParameter(":Duty", DbType.Decimal);
            arParams[19].Direction = ParameterDirection.Input;
            arParams[19].Value     = duty;

            arParams[20]           = new SqliteParameter(":Freight", DbType.Decimal);
            arParams[20].Direction = ParameterDirection.Input;
            arParams[20].Value     = freight;

            arParams[21]           = new SqliteParameter(":Provider", DbType.String, 100);
            arParams[21].Direction = ParameterDirection.Input;
            arParams[21].Value     = provider;


            int rowsAffected = 0;

            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
コード例 #5
0
        /// <summary>
        /// Inserts a row in the mp_CalendarEvents table. Returns new integer id.
        /// </summary>
        /// <returns>int</returns>
        public static int AddCalendarEvent(
            Guid itemGuid,
            Guid moduleGuid,
            int moduleId,
            string title,
            string description,
            string imageName,
            DateTime eventDate,
            DateTime startTime,
            DateTime endTime,
            int userId,
            Guid userGuid,
            string location,
            bool requiresTicket,
            decimal ticketPrice,
            DateTime createdDate,
            bool showMap)
        {
            #region Bit Conversion

            int intRequiresTicket = requiresTicket ? 1 : 0;
            //if (requiresTicket)
            //{
            //    intRequiresTicket = 1;
            //}
            //else
            //{
            //    intRequiresTicket = 0;
            //}

            int intShowMap = showMap ? 1 : 0;


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_CalendarEvents (");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("ImageName, ");
            sqlCommand.Append("EventDate, ");
            sqlCommand.Append("StartTime, ");
            sqlCommand.Append("EndTime, ");
            sqlCommand.Append("CreatedDate, ");
            sqlCommand.Append("UserID, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("Location, ");
            sqlCommand.Append("LastModUserGuid, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("TicketPrice, ");
            sqlCommand.Append("RequiresTicket,");
            sqlCommand.Append("ShowMap )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":ModuleID, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":ImageName, ");
            sqlCommand.Append(":EventDate, ");
            sqlCommand.Append(":StartTime, ");
            sqlCommand.Append(":EndTime, ");
            sqlCommand.Append(":CreatedDate, ");
            sqlCommand.Append(":UserID, ");
            sqlCommand.Append(":ItemGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":Location, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":CreatedDate, ");
            sqlCommand.Append(":TicketPrice, ");
            sqlCommand.Append(":RequiresTicket,");
            sqlCommand.Append(":ShowMap)");
            sqlCommand.Append(";");

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

            SqliteParameter[] arParams = new SqliteParameter[16];

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

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

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

            arParams[3]           = new SqliteParameter(":ImageName", DbType.String, 100);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = imageName;

            arParams[4]           = new SqliteParameter(":EventDate", DbType.DateTime);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = eventDate;

            arParams[5]           = new SqliteParameter(":StartTime", DbType.DateTime);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = startTime;

            arParams[6]           = new SqliteParameter(":EndTime", DbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = endTime;

            arParams[7]           = new SqliteParameter(":CreatedDate", DbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = createdDate;

            arParams[8]           = new SqliteParameter(":UserID", DbType.Int32);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = userId;

            arParams[9]           = new SqliteParameter(":ItemGuid", DbType.String, 36);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = itemGuid.ToString();

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

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

            arParams[12]           = new SqliteParameter(":Location", DbType.Object);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = location;

            arParams[13]           = new SqliteParameter(":TicketPrice", DbType.Decimal);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = ticketPrice;

            arParams[14]           = new SqliteParameter(":RequiresTicket", DbType.Int32);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = intRequiresTicket;

            arParams[15]           = new SqliteParameter(":ShowMap", DbType.Int32);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = intShowMap;

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

            return(newID);
        }
コード例 #6
0
ファイル: DBSavedQuery.cs プロジェクト: wqshabib/mojoportal
        /// <summary>
        /// Inserts a row in the mp_SavedQuery table. Returns rows affected count.
        /// </summary>
        /// <param name="id"> id </param>
        /// <param name="name"> name </param>
        /// <param name="statement"> statement </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdBy"> createdBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid id,
            string name,
            string statement,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_SavedQuery (");
            sqlCommand.Append("Id, ");
            sqlCommand.Append("Name, ");
            sqlCommand.Append("Statement, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("LastModBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Id, ");
            sqlCommand.Append(":Name, ");
            sqlCommand.Append(":Statement, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":CreatedBy, ");
            sqlCommand.Append(":LastModUtc, ");
            sqlCommand.Append(":LastModBy )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[7];

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

            arParams[1]           = new SqliteParameter(":Name", DbType.String, 50);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = name;

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

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

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

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

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


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

            return(rowsAffected);
        }
コード例 #7
0
ファイル: DBContentMeta.cs プロジェクト: rheldt/mojoportal
        /// <summary>
        /// Inserts a row in the mp_ContentMeta table. Returns rows affected count.
        /// </summary>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid contentGuid,
            string name,
            string nameProperty,
            string scheme,
            string langCode,
            string dir,
            string metaContent,
            string contentProperty,
            int sortRank,
            DateTime createdUtc,
            Guid createdBy
            )
        {
            var sqlCommand = $@"
INSERT INTO mp_ContentMeta (
	Guid,
	SiteGuid,
	ModuleGuid,
	ContentGuid,
	Name,
	NameProperty,
	Scheme,
	LangCode,
	Dir,
	MetaContent,
	ContentProperty,
	SortRank,
	CreatedUtc,
	CreatedBy,
	LastModUtc,
	LastModBy
)
VALUES (
	:Guid,
	:SiteGuid,
	:ModuleGuid,
	:ContentGuid,
	:Name,
	:NameProperty,
	:Scheme,
	:LangCode,
	:Dir,
	:MetaContent,
	:ContentProperty,
	:SortRank,
	:CreatedUtc,
	:CreatedBy,
	:LastModUtc,
	:LastModBy
);";

            var arParams = new SqliteParameter[]
            {
                new SqliteParameter(":Guid", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = guid.ToString()
                },
                new SqliteParameter(":SiteGuid", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = siteGuid.ToString()
                },
                new SqliteParameter(":ModuleGuid", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = moduleGuid.ToString()
                },
                new SqliteParameter(":ContentGuid", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = contentGuid.ToString()
                },
                new SqliteParameter(":Name", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = name
                },
                new SqliteParameter(":Scheme", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = scheme
                },
                new SqliteParameter(":LangCode", DbType.String, 10)
                {
                    Direction = ParameterDirection.Input,
                    Value     = langCode
                },
                new SqliteParameter(":Dir", DbType.String, 3)
                {
                    Direction = ParameterDirection.Input,
                    Value     = dir
                },
                new SqliteParameter(":MetaContent", DbType.Object)
                {
                    Direction = ParameterDirection.Input,
                    Value     = metaContent
                },
                new SqliteParameter(":SortRank", DbType.Int32)
                {
                    Direction = ParameterDirection.Input,
                    Value     = sortRank
                },
                new SqliteParameter(":CreatedUtc", DbType.DateTime)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdUtc
                },
                new SqliteParameter(":CreatedBy", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdBy.ToString()
                },
                new SqliteParameter(":LastModUtc", DbType.DateTime)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdUtc
                },
                new SqliteParameter(":LastModBy", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdBy.ToString()
                },
                new SqliteParameter(":NameProperty", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = nameProperty
                },
                new SqliteParameter(":ContentProperty", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = contentProperty
                }
            };

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

            return(rowsAffected);
        }
コード例 #8
0
        public static int AddWebPart(
            Guid webPartId,
            Guid siteGuid,
            int siteId,
            string title,
            string description,
            string imageUrl,
            string className,
            string assemblyName,
            bool availableForMyPage,
            bool allowMultipleInstancesOnMyPage,
            bool availableForContentSystem)
        {
            #region Bit Conversion

            int intAvailableForMyPage;
            if (availableForMyPage)
            {
                intAvailableForMyPage = 1;
            }
            else
            {
                intAvailableForMyPage = 0;
            }

            int intAllowMultipleInstancesOnMyPage;
            if (allowMultipleInstancesOnMyPage)
            {
                intAllowMultipleInstancesOnMyPage = 1;
            }
            else
            {
                intAllowMultipleInstancesOnMyPage = 0;
            }

            int intAvailableForContentSystem;
            if (availableForContentSystem)
            {
                intAvailableForContentSystem = 1;
            }
            else
            {
                intAvailableForContentSystem = 0;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_WebParts (");
            sqlCommand.Append("WebPartID, ");
            sqlCommand.Append("SiteID, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("ImageUrl, ");
            sqlCommand.Append("ClassName, ");
            sqlCommand.Append("AssemblyName, ");
            sqlCommand.Append("AvailableForMyPage, ");
            sqlCommand.Append("AllowMultipleInstancesOnMyPage, ");
            sqlCommand.Append("AvailableForContentSystem )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":WebPartID, ");
            sqlCommand.Append(":SiteID, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":ImageUrl, ");
            sqlCommand.Append(":ClassName, ");
            sqlCommand.Append(":AssemblyName, ");
            sqlCommand.Append(":AvailableForMyPage, ");
            sqlCommand.Append(":AllowMultipleInstancesOnMyPage, ");
            sqlCommand.Append(":AvailableForContentSystem );");


            SqliteParameter[] arParams = new SqliteParameter[11];

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

            arParams[1]           = new SqliteParameter(":SiteID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteId;

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

            arParams[3]           = new SqliteParameter(":Description", DbType.String, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = description;

            arParams[4]           = new SqliteParameter(":ImageUrl", DbType.String, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = imageUrl;

            arParams[5]           = new SqliteParameter(":ClassName", DbType.String, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = className;

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

            arParams[7]           = new SqliteParameter(":AvailableForMyPage", DbType.Int32);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = intAvailableForMyPage;

            arParams[8]           = new SqliteParameter(":AllowMultipleInstancesOnMyPage", DbType.Int32);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = intAllowMultipleInstancesOnMyPage;

            arParams[9]           = new SqliteParameter(":AvailableForContentSystem", DbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = intAvailableForContentSystem;

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

            int rowsAffected = 0;

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

            return(rowsAffected);
        }
コード例 #9
0
        public static IDataReader GetMostPopular(int siteId, int numberToGet)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT   ");
            sqlCommand.Append("m.ModuleID As ModuleID, ");
            sqlCommand.Append("m.SiteID As SiteID, ");
            sqlCommand.Append("m.ModuleDefID As ModuleDefID, ");
            sqlCommand.Append("m.ModuleTitle As ModuleTitle, ");
            sqlCommand.Append("m.AllowMultipleInstancesOnMyPage As AllowMultipleInstancesOnMyPage, ");
            sqlCommand.Append("m.CountOfUseOnMyPage As CountOfUseOnMyPage , ");
            sqlCommand.Append("m.Icon As ModuleIcon, ");
            sqlCommand.Append("md.Icon As FeatureIcon, ");
            sqlCommand.Append("md.FeatureName As FeatureName, ");
            sqlCommand.Append("md.ResourceFile As ResourceFile, ");
            sqlCommand.Append("0 As IsAssembly, ");
            sqlCommand.Append("'' As WebPartID ");

            sqlCommand.Append("FROM	mp_Modules m ");
            sqlCommand.Append("JOIN	mp_ModuleDefinitions md ");
            sqlCommand.Append("ON m.ModuleDefID = md.ModuleDefID ");

            sqlCommand.Append("WHERE m.SiteID = :SiteID AND m.AvailableForMyPage = 1 ");

            // this union should work but
            // we get an error from the reader if its used
            // since there currently aren't any webpart assembliies
            // available I commented out this part of the union
            // could be a bug in Mono.Data.SqliteClient
            // which is where the error is happening, maybe a newer version would fix it

            //sqlCommand.Append(" UNION ");

            //sqlCommand.Append("SELECT   ");
            //sqlCommand.Append("0 As ModuleID, ");
            //sqlCommand.Append("w.SiteID, ");
            //sqlCommand.Append("0 As MuduleDefID, ");
            //sqlCommand.Append("w.Title As ModuleTitle, ");
            //sqlCommand.Append("w.AllowMultipleInstancesOnMyPage, ");
            //sqlCommand.Append("w.CountOfUseOnMyPage , ");
            //sqlCommand.Append("w.ImageUrl As ModuleIcon, ");
            //sqlCommand.Append("w.ImageUrl As FeatureIcon, ");
            //sqlCommand.Append("w.Description As FeatureName, ");
            //sqlCommand.Append("1 As IsAssembly, ");
            //sqlCommand.Append("w.WebPartID ");

            //sqlCommand.Append("FROM	mp_WebParts w ");

            //sqlCommand.Append("WHERE w.SiteID = :SiteID AND w.AvailableForMyPage = 1 ");

            sqlCommand.Append("ORDER BY ModuleTitle ");
            sqlCommand.Append("LIMIT " + numberToGet.ToString() + " ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

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

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
コード例 #10
0
ファイル: DBRssFeed.cs プロジェクト: zahedbri/mojoportal
        /// <summary>
        /// Updates a row in the mp_RssFeedEntries table. Returns true if row updated.
        /// </summary>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="title"> title </param>
        /// <param name="author"> author </param>
        /// <param name="blogUrl"> blogUrl </param>
        /// <param name="description"> description </param>
        /// <param name="link"> link </param>
        /// <param name="entryHash"> entryHash </param>
        /// <param name="cachedTimeUtc"> cachedTimeUtc </param>
        /// <returns>bool</returns>
        public static bool UpdateEnry(
            Guid moduleGuid,
            string title,
            string author,
            string blogUrl,
            string description,
            string link,
            int entryHash,
            DateTime cachedTimeUtc)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_RssFeedEntries ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("Title = :Title, ");
            sqlCommand.Append("Author = :Author, ");
            sqlCommand.Append("BlogUrl = :BlogUrl, ");
            sqlCommand.Append("Description = :Description, ");
            sqlCommand.Append("Link = :Link, ");
            sqlCommand.Append("CachedTimeUtc = :CachedTimeUtc ");

            sqlCommand.Append("WHERE  ");
            sqlCommand.Append("ModuleGuid = :ModuleGuid ");
            sqlCommand.Append(" AND EntryHash = :EntryHash ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[8];

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

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

            arParams[2]           = new SqliteParameter(":Author", DbType.String, 100);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = author;

            arParams[3]           = new SqliteParameter(":BlogUrl", DbType.String, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = blogUrl;

            arParams[4]           = new SqliteParameter(":Description", DbType.Object);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = description;

            arParams[5]           = new SqliteParameter(":Link", DbType.String, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = link;

            arParams[6]           = new SqliteParameter(":EntryHash", DbType.Int32);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = entryHash;

            arParams[7]           = new SqliteParameter(":CachedTimeUtc", DbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = cachedTimeUtc;

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

            return(rowsAffected > -1);
        }
コード例 #11
0
        public static DataTable SelectPage(
            int siteId,
            int pageNumber,
            int pageSize,
            bool sortByClassName,
            bool sortByAssemblyName)
        {
            int totalRows  = OnlyCount(siteId);
            int totalPages = totalRows / pageSize;

            if (totalRows <= pageSize)
            {
                totalPages = 1;
            }
            else
            {
                int remainder = 0;
                Math.DivRem(totalRows, pageSize, out remainder);
                if (remainder > 0)
                {
                    totalPages += 1;
                }
            }
            int pageLowerBound = (pageSize * pageNumber) - pageSize;

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT w.*,  ");
            sqlCommand.Append(totalPages.ToString(CultureInfo.InvariantCulture) + " As TotalPages  ");
            sqlCommand.Append("FROM	mp_WebParts w  ");

            sqlCommand.Append("WHERE w.SiteID = :SiteID ");

            if (sortByClassName)
            {
                sqlCommand.Append("ORDER BY	w.ClassName, w.Title  ");
            }
            else if (sortByAssemblyName)
            {
                sqlCommand.Append("ORDER BY	w.AssemblyName, w.Title  ");
            }
            else
            {
                sqlCommand.Append("ORDER BY	w.Title, w.ClassName  ");
            }

            sqlCommand.Append("LIMIT " + pageSize.ToString(CultureInfo.InvariantCulture) + " ");
            sqlCommand.Append("OFFSET " + pageLowerBound.ToString(CultureInfo.InvariantCulture) + " ");
            sqlCommand.Append("  ; ");

            SqliteParameter[] arParams = new SqliteParameter[1];

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

            DataTable dt = new DataTable();

            dt.Columns.Add("WebPartID", typeof(String));
            dt.Columns.Add("Title", typeof(String));
            dt.Columns.Add("Description", typeof(String));
            dt.Columns.Add("ImageUrl", typeof(String));
            dt.Columns.Add("ClassName", typeof(String));
            dt.Columns.Add("AssemblyName", typeof(String));
            dt.Columns.Add("AvailableForMyPage", typeof(bool));
            dt.Columns.Add("AllowMultipleInstancesOnMyPage", typeof(bool));
            dt.Columns.Add("AvailableForContentSystem", typeof(bool));
            dt.Columns.Add("TotalPages", typeof(int));


            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                while (reader.Read())
                {
                    DataRow row = dt.NewRow();
                    row["WebPartID"]                      = reader["WebPartID"].ToString();
                    row["Title"]                          = reader["Title"];
                    row["Description"]                    = reader["Description"];
                    row["ImageUrl"]                       = reader["ImageUrl"];
                    row["ClassName"]                      = reader["ClassName"];
                    row["AssemblyName"]                   = reader["AssemblyName"];
                    row["AvailableForMyPage"]             = reader["AvailableForMyPage"];
                    row["AllowMultipleInstancesOnMyPage"] = reader["AllowMultipleInstancesOnMyPage"];
                    row["AvailableForContentSystem"]      = reader["AvailableForContentSystem"];
                    row["TotalPages"]                     = reader["TotalPages"];

                    dt.Rows.Add(row);
                }
            }

            return(dt);
        }
コード例 #12
0
ファイル: DBRssFeed.cs プロジェクト: zahedbri/mojoportal
        /// <summary>
        /// Inserts a row in the mp_RssFeedEntries table. Returns rows affected count.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="feedGuid"> feedGuid </param>
        /// <param name="pubDate"> pubDate </param>
        /// <param name="title"> title </param>
        /// <param name="author"> author </param>
        /// <param name="blogUrl"> blogUrl </param>
        /// <param name="description"> description </param>
        /// <param name="link"> link </param>
        /// <param name="confirmed"> confirmed </param>
        /// <param name="entryHash"> entryHash </param>
        /// <param name="cachedTimeUtc"> cachedTimeUtc </param>
        /// <returns>int</returns>
        public static int CreateEntry(
            Guid rowGuid,
            Guid moduleGuid,
            Guid feedGuid,
            int feedId,
            DateTime pubDate,
            string title,
            string author,
            string blogUrl,
            string description,
            string link,
            bool confirmed,
            int entryHash,
            DateTime cachedTimeUtc)
        {
            #region Bit Conversion

            int intConfirmed;
            if (confirmed)
            {
                intConfirmed = 1;
            }
            else
            {
                intConfirmed = 0;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_RssFeedEntries (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("FeedGuid, ");
            sqlCommand.Append("FeedId, ");
            sqlCommand.Append("PubDate, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Author, ");
            sqlCommand.Append("BlogUrl, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("Link, ");
            sqlCommand.Append("Confirmed, ");
            sqlCommand.Append("EntryHash, ");
            sqlCommand.Append("CachedTimeUtc )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":RowGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":FeedGuid, ");
            sqlCommand.Append(":FeedId, ");
            sqlCommand.Append(":PubDate, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Author, ");
            sqlCommand.Append(":BlogUrl, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":Link, ");
            sqlCommand.Append(":Confirmed, ");
            sqlCommand.Append(":EntryHash, ");
            sqlCommand.Append(":CachedTimeUtc )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[13];

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

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

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

            arParams[3]           = new SqliteParameter(":FeedId", DbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = feedId;

            arParams[4]           = new SqliteParameter(":PubDate", DbType.DateTime);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = pubDate;

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

            arParams[6]           = new SqliteParameter(":Author", DbType.String, 100);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = author;

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

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

            arParams[9]           = new SqliteParameter(":Link", DbType.String, 255);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = link;

            arParams[10]           = new SqliteParameter(":Confirmed", DbType.Int32);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = intConfirmed;

            arParams[11]           = new SqliteParameter(":EntryHash", DbType.Int32);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = entryHash;

            arParams[12]           = new SqliteParameter(":CachedTimeUtc", DbType.DateTime);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = cachedTimeUtc;


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

            return(rowsAffected);
        }
コード例 #13
0
ファイル: DBRssFeed.cs プロジェクト: zahedbri/mojoportal
        /// <summary>
        /// Gets an IDataReader with one row from the mp_RssFeedEntries table.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        public static DataTable GetEntries(Guid moduleGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT ");
            sqlCommand.Append("f.Author As FeedName, ");
            sqlCommand.Append("e.* ");

            sqlCommand.Append("FROM	mp_RssFeedEntries e ");
            sqlCommand.Append("JOIN ");
            sqlCommand.Append("mp_RssFeeds f ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("e.FeedID = f.ItemID ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("e.ModuleGuid = :ModuleGuid ");
            sqlCommand.Append("ORDER BY e.PubDate DESC ");
            sqlCommand.Append(";");


            SqliteParameter[] arParams = new SqliteParameter[1];

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

            IDataReader reader = SqliteHelper.ExecuteReader(
                GetConnectionString(),
                sqlCommand.ToString(),
                arParams);

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("FeedId", typeof(int));
            dataTable.Columns.Add("FeedName", typeof(string));
            dataTable.Columns.Add("PubDate", typeof(DateTime));
            dataTable.Columns.Add("Author", typeof(string));
            dataTable.Columns.Add("Title", typeof(string));
            dataTable.Columns.Add("Description", typeof(string));
            dataTable.Columns.Add("BlogUrl", typeof(string));
            dataTable.Columns.Add("Link", typeof(string));
            dataTable.Columns.Add("Confirmed", typeof(bool));
            dataTable.Columns.Add("EntryHash", typeof(int));

            using (reader)
            {
                while (reader.Read())
                {
                    DataRow row = dataTable.NewRow();
                    row["FeedId"]      = reader["FeedId"];
                    row["FeedName"]    = reader["FeedName"];
                    row["PubDate"]     = Convert.ToDateTime(reader["PubDate"]);
                    row["Author"]      = reader["Author"];
                    row["Title"]       = reader["Title"];
                    row["Description"] = reader["Description"];
                    row["BlogUrl"]     = reader["BlogUrl"];
                    row["Link"]        = reader["Link"];
                    row["Confirmed"]   = Convert.ToBoolean(reader["Confirmed"]);
                    row["EntryHash"]   = reader["EntryHash"];

                    dataTable.Rows.Add(row);
                }
            }

            return(dataTable);
        }
コード例 #14
0
ファイル: DBRssFeed.cs プロジェクト: zahedbri/mojoportal
        public static int AddRssFeed(
            Guid itemGuid,
            Guid moduleGuid,
            Guid userGuid,
            int moduleId,
            int userId,
            string author,
            string url,
            string rssUrl,
            DateTime createdUtc,
            string imageUrl,
            string feedType,
            bool publishByDefault,
            int sortRank)
        {
            #region Bit Conversion

            int intPublishByDefault;
            if (publishByDefault)
            {
                intPublishByDefault = 1;
            }
            else
            {
                intPublishByDefault = 0;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO mp_RssFeeds (");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("CreatedDate, ");
            sqlCommand.Append("UserID, ");
            sqlCommand.Append("Author, ");
            sqlCommand.Append("Url, ");
            sqlCommand.Append("RssUrl, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("LastModUserGuid, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("ImageUrl, ");
            sqlCommand.Append("FeedType, ");
            sqlCommand.Append("SortRank, ");
            sqlCommand.Append("PublishByDefault )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":ModuleID, ");
            sqlCommand.Append(":CreatedDate, ");
            sqlCommand.Append(":UserID, ");
            sqlCommand.Append(":Author, ");
            sqlCommand.Append(":Url, ");
            sqlCommand.Append(":RssUrl, ");
            sqlCommand.Append(":ItemGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":CreatedDate, ");
            sqlCommand.Append(":ImageUrl, ");
            sqlCommand.Append(":FeedType, ");
            sqlCommand.Append(":SortRank, ");
            sqlCommand.Append(":PublishByDefault )");
            sqlCommand.Append(";");

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

            SqliteParameter[] arParams = new SqliteParameter[13];

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

            arParams[1]           = new SqliteParameter(":UserID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = userId;

            arParams[2]           = new SqliteParameter(":Author", DbType.String, 100);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = author;

            arParams[3]           = new SqliteParameter(":Url", DbType.String, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = url;

            arParams[4]           = new SqliteParameter(":RssUrl", DbType.String, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = rssUrl;

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

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

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

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

            arParams[9]           = new SqliteParameter(":ImageUrl", DbType.String, 255);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = imageUrl;

            arParams[10]           = new SqliteParameter(":FeedType", DbType.String, 20);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = feedType;

            arParams[11]           = new SqliteParameter(":PublishByDefault", DbType.Int32);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = intPublishByDefault;

            arParams[12]           = new SqliteParameter(":SortRank", DbType.Int32);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = sortRank;

            int newID = 0;

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

            return(newID);
        }
コード例 #15
0
ファイル: DBGallery.cs プロジェクト: wqshabib/mojoportal
        public static int AddGalleryImage(
            Guid itemGuid,
            Guid moduleGuid,
            int moduleId,
            int displayOrder,
            string caption,
            string description,
            string metaDataXml,
            string imageFile,
            string webImageFile,
            string thumbnailFile,
            DateTime uploadDate,
            string uploadUser,
            Guid userGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_GalleryImages (");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("DisplayOrder, ");
            sqlCommand.Append("Caption, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("MetaDataXml, ");
            sqlCommand.Append("ImageFile, ");
            sqlCommand.Append("WebImageFile, ");
            sqlCommand.Append("ThumbnailFile, ");
            sqlCommand.Append("UploadDate, ");
            sqlCommand.Append("UploadUser, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("UserGuid )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":ModuleID, ");
            sqlCommand.Append(":DisplayOrder, ");
            sqlCommand.Append(":Caption, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":MetaDataXml, ");
            sqlCommand.Append(":ImageFile, ");
            sqlCommand.Append(":WebImageFile, ");
            sqlCommand.Append(":ThumbnailFile, ");
            sqlCommand.Append(":UploadDate, ");
            sqlCommand.Append(":UploadUser, ");
            sqlCommand.Append(":ItemGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":UserGuid )");
            sqlCommand.Append(";");

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

            SqliteParameter[] arParams = new SqliteParameter[13];

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

            arParams[1]           = new SqliteParameter(":DisplayOrder", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = displayOrder;

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

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

            arParams[4]           = new SqliteParameter(":MetaDataXml", DbType.Object);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = metaDataXml;

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

            arParams[6]           = new SqliteParameter(":WebImageFile", DbType.String, 100);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = webImageFile;

            arParams[7]           = new SqliteParameter(":ThumbnailFile", DbType.String, 100);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = thumbnailFile;

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

            arParams[9]           = new SqliteParameter(":UploadUser", DbType.String, 100);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = uploadUser;

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

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

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

            int newID = 0;

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

            return(newID);
        }
コード例 #16
0
        /// <summary>
        /// Gets a page of data from the mp_RedirectList table with search term.
        /// </summary>
        /// <param name="searchTerm">search term</param>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <param name="totalPages">total pages</param>
        public static IDataReader GetPage(
            int siteId,
            int pageNumber,
            int pageSize,
            out int totalPages,
            string searchTerm = "")
        {
            var useSearch      = !string.IsNullOrWhiteSpace(searchTerm);
            int pageLowerBound = (pageSize * pageNumber) - pageSize;

            totalPages = 1;
            int totalRows = GetCount(siteId, searchTerm);

            if (pageSize > 0)
            {
                totalPages = totalRows / pageSize;
            }

            if (totalRows <= pageSize)
            {
                totalPages = 1;
            }
            else
            {
                Math.DivRem(totalRows, pageSize, out int remainder);
                if (remainder > 0)
                {
                    totalPages += 1;
                }
            }

            var sqlCommand = $@"SELECT	* 
				FROM	mp_RedirectList  
				WHERE SiteID = :SiteID 
				{(useSearch ? "AND NewUrl LIKE :SearchTerm OR OldUrl LIKE :SearchTerm" : "")}
				ORDER BY OldUrl 
				LIMIT :PageSize 
				{(pageNumber > 1 ? "OFFSET :OffsetRows" : "")};"                ;

            var sqlParams = new List <SqliteParameter>
            {
                new SqliteParameter(":SiteID", DbType.Int32)
                {
                    Direction = ParameterDirection.Input,
                    Value     = siteId
                },
                new SqliteParameter(":PageSize", DbType.Int32)
                {
                    Direction = ParameterDirection.Input,
                    Value     = pageSize
                },
                new SqliteParameter(":OffsetRows", DbType.Int32)
                {
                    Direction = ParameterDirection.Input,
                    Value     = pageLowerBound
                }
            };

            if (useSearch)
            {
                sqlParams.Add(
                    new SqliteParameter(":SearchTerm", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = "%" + searchTerm + "%"
                }
                    );
            }

            return(SqliteHelper.ExecuteReader(
                       ConnectionString.GetReadConnectionString(),
                       sqlCommand,
                       sqlParams.ToArray()));
        }
コード例 #17
0
ファイル: DBGallery.cs プロジェクト: wqshabib/mojoportal
        public static DataTable GetWebImageByPage(int moduleId, int pageNumber)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  Count(*) ");
            sqlCommand.Append("FROM	mp_GalleryImages ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ModuleID = :ModuleID ;");

            SqliteParameter[] arParams = new SqliteParameter[1];

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

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

            sqlCommand = new StringBuilder();

            int pageLowerBound = (1 * pageNumber) - 1;

            int totalPages = (int)Math.Ceiling((double)count / (double)1);

            sqlCommand.Append("SELECT i.ItemID As ItemID,  ");
            sqlCommand.Append("i.ModuleID As ModuleID,  ");
            sqlCommand.Append(":TotalPages As TotalPages  ");
            sqlCommand.Append("FROM	mp_GalleryImages i  ");

            sqlCommand.Append("WHERE i.ModuleID = :ModuleID   ");

            sqlCommand.Append("ORDER BY 	DisplayOrder, ItemID    ");
            sqlCommand.Append("LIMIT		1 ");
            sqlCommand.Append("OFFSET		"+ pageLowerBound + " ; ");



            arParams = new SqliteParameter[2];

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

            arParams[1]           = new SqliteParameter(":TotalPages", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = totalPages;

            DataTable dt = new DataTable();

            dt.Columns.Add("ItemID", typeof(int));
            dt.Columns.Add("TotalPages", typeof(int));


            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                while (reader.Read())
                {
                    DataRow row = dt.NewRow();
                    row["ItemID"] = reader["ItemID"];
                    // row["ModuleID"] = reader["ModuleID"];
                    //row["Caption"] = reader["Caption"];

                    row["TotalPages"] = reader["TotalPages"];

                    dt.Rows.Add(row);
                }
            }

            return(dt);
        }
コード例 #18
0
        /// <summary>
        /// Inserts a row in the mp_RedirectList table. Returns rows affected count.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="siteID"> siteID </param>
        /// <param name="oldUrl"> oldUrl </param>
        /// <param name="newUrl"> newUrl </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="expireUtc"> expireUtc </param>
        /// <returns>int</returns>
        public static int Create(
            Guid rowGuid,
            Guid siteGuid,
            int siteID,
            string oldUrl,
            string newUrl,
            DateTime createdUtc,
            DateTime expireUtc)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_RedirectList (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("SiteID, ");
            sqlCommand.Append("OldUrl, ");
            sqlCommand.Append("NewUrl, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("ExpireUtc )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":RowGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":SiteID, ");
            sqlCommand.Append(":OldUrl, ");
            sqlCommand.Append(":NewUrl, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":ExpireUtc )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[7];

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

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

            arParams[2]           = new SqliteParameter(":SiteID", DbType.Int32);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = siteID;

            arParams[3]           = new SqliteParameter(":OldUrl", DbType.String, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = oldUrl;

            arParams[4]           = new SqliteParameter(":NewUrl", DbType.String, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = newUrl;

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

            arParams[6]           = new SqliteParameter(":ExpireUtc", DbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = expireUtc;


            int rowsAffected = 0;

            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
コード例 #19
0
ファイル: DBContentMeta.cs プロジェクト: rheldt/mojoportal
        /// <summary>
        /// Updates a row in the mp_ContentMeta table. Returns true if row updated.
        /// </summary>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            string name,
            string nameProperty,
            string scheme,
            string langCode,
            string dir,
            string metaContent,
            string contentProperty,
            int sortRank,
            DateTime lastModUtc,
            Guid lastModBy
            )
        {
            var sqlCommand = $@"
UPDATE mp_ContentMeta SET
	Name = :Name,
	NameProperty = :NameProperty,
	Scheme = :Scheme,
	LangCode = :LangCode,
	Dir = :Dir,
	MetaContent = :MetaContent,
	ContentProperty = :ContentProperty,
	SortRank = :SortRank,
	LastModUtc = :LastModUtc,
	LastModBy = :LastModBy
WHERE Guid = :Guid;";

            var arParams = new SqliteParameter[]
            {
                new SqliteParameter(":Guid", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = guid.ToString()
                },
                new SqliteParameter(":Name", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = name
                },
                new SqliteParameter(":Scheme", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = scheme
                },
                new SqliteParameter(":LangCode", DbType.String, 10)
                {
                    Direction = ParameterDirection.Input,
                    Value     = langCode
                },
                new SqliteParameter(":Dir", DbType.String, 3)
                {
                    Direction = ParameterDirection.Input,
                    Value     = dir
                },
                new SqliteParameter(":MetaContent", DbType.Object)
                {
                    Direction = ParameterDirection.Input,
                    Value     = metaContent
                },
                new SqliteParameter(":SortRank", DbType.Int32)
                {
                    Direction = ParameterDirection.Input,
                    Value     = sortRank
                },
                new SqliteParameter(":LastModUtc", DbType.DateTime)
                {
                    Direction = ParameterDirection.Input,
                    Value     = lastModUtc
                },
                new SqliteParameter(":LastModBy", DbType.String, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = lastModBy.ToString()
                },
                new SqliteParameter(":NameProperty", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = nameProperty
                },
                new SqliteParameter(":ContentProperty", DbType.String, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = contentProperty
                }
            };

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

            return(rowsAffected > -1);
        }
コード例 #20
0
        public static bool UpdateHtmlContent(
            int itemId,
            int moduleId,
            string title,
            string excerpt,
            string body,
            string moreLink,
            int sortOrder,
            DateTime beginDate,
            DateTime endDate,
            DateTime lastModUtc,
            Guid lastModUserGuid,
            bool excludeFromRecentContent)
        {
            int exclude = 0;

            if (excludeFromRecentContent)
            {
                exclude = 1;
            }

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_HtmlContent ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("BeginDate = :BeginDate  , ");
            sqlCommand.Append("EndDate = :EndDate  , ");
            sqlCommand.Append("Title = :Title  , ");
            sqlCommand.Append("Excerpt = :Excerpt  , ");
            sqlCommand.Append("Body = :Body , ");
            sqlCommand.Append("MoreLink = :MoreLink, ");
            sqlCommand.Append("ExcludeFromRecentContent = :ExcludeFromRecentContent, ");
            sqlCommand.Append("LastModUserGuid = :LastModUserGuid, ");
            sqlCommand.Append("LastModUtc = :LastModUtc ");

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

            SqliteParameter[] arParams = new SqliteParameter[11];

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

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

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

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

            arParams[4]           = new SqliteParameter(":MoreLink", DbType.String, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = moreLink;

            arParams[5]           = new SqliteParameter(":BeginDate", DbType.DateTime);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = beginDate;

            arParams[6]           = new SqliteParameter(":EndDate", DbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = endDate;

            arParams[7]           = new SqliteParameter(":SortOrder", DbType.Int32);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = sortOrder;

            arParams[8]           = new SqliteParameter(":LastModUserGuid", DbType.String, 36);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModUserGuid.ToString();

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

            arParams[10]           = new SqliteParameter(":ExcludeFromRecentContent", DbType.Int32);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = exclude;

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

            return(rowsAffected > -1);
        }
コード例 #21
0
        /// <summary>
        /// Updates a row in the mp_PaymentLog table. Returns true if row updated.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="storeGuid"> storeGuid </param>
        /// <param name="cartGuid"> cartGuid </param>
        /// <param name="rawResponse"> rawResponse </param>
        /// <param name="responseCode"> responseCode </param>
        /// <param name="responseReasonCode"> responseReasonCode </param>
        /// <param name="reason"> reason </param>
        /// <param name="avsCode"> avsCode </param>
        /// <param name="ccvCode"> ccvCode </param>
        /// <param name="cavCode"> cavCode </param>
        /// <param name="transactionId"> transactionId </param>
        /// <param name="transactionType"> transactionType </param>
        /// <param name="method"> method </param>
        /// <param name="authCode"> authCode </param>
        /// <param name="amount"> amount </param>
        /// <param name="tax"> tax </param>
        /// <param name="duty"> duty </param>
        /// <param name="freight"> freight </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid rowGuid,
            Guid siteGuid,
            Guid userGuid,
            Guid storeGuid,
            Guid cartGuid,
            string rawResponse,
            string responseCode,
            string responseReasonCode,
            string reason,
            string avsCode,
            string ccvCode,
            string cavCode,
            string transactionId,
            string transactionType,
            string method,
            string authCode,
            decimal amount,
            decimal tax,
            decimal duty,
            decimal freight)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_PaymentLog ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("SiteGuid = :SiteGuid, ");
            sqlCommand.Append("UserGuid = :UserGuid, ");
            sqlCommand.Append("StoreGuid = :StoreGuid, ");
            sqlCommand.Append("CartGuid = :CartGuid, ");
            sqlCommand.Append("RawResponse = :RawResponse, ");
            sqlCommand.Append("ResponseCode = :ResponseCode, ");
            sqlCommand.Append("ResponseReasonCode = :ResponseReasonCode, ");
            sqlCommand.Append("Reason = :Reason, ");
            sqlCommand.Append("AvsCode = :AvsCode, ");
            sqlCommand.Append("CcvCode = :CcvCode, ");
            sqlCommand.Append("CavCode = :CavCode, ");
            sqlCommand.Append("TransactionId = :TransactionId, ");
            sqlCommand.Append("TransactionType = :TransactionType, ");
            sqlCommand.Append("Method = :Method, ");
            sqlCommand.Append("AuthCode = :AuthCode, ");
            sqlCommand.Append("Amount = :Amount, ");
            sqlCommand.Append("Tax = :Tax, ");
            sqlCommand.Append("Duty = :Duty, ");
            sqlCommand.Append("Freight = :Freight ");

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

            SqliteParameter[] arParams = new SqliteParameter[20];

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

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

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

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

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

            arParams[5]           = new SqliteParameter(":RawResponse", DbType.Object);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = rawResponse;

            arParams[6]           = new SqliteParameter(":ResponseCode", DbType.String, 1);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = responseCode;

            arParams[7]           = new SqliteParameter(":ResponseReasonCode", DbType.String, 20);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = responseReasonCode;

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

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

            arParams[10]           = new SqliteParameter(":CcvCode", DbType.String, 1);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = ccvCode;

            arParams[11]           = new SqliteParameter(":CavCode", DbType.String, 1);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = cavCode;

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

            arParams[13]           = new SqliteParameter(":TransactionType", DbType.String, 50);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = transactionType;

            arParams[14]           = new SqliteParameter(":Method", DbType.String, 20);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = method;

            arParams[15]           = new SqliteParameter(":AuthCode", DbType.String, 50);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = authCode;

            arParams[16]           = new SqliteParameter(":Amount", DbType.Decimal);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = amount;

            arParams[17]           = new SqliteParameter(":Tax", DbType.Decimal);
            arParams[17].Direction = ParameterDirection.Input;
            arParams[17].Value     = tax;

            arParams[18]           = new SqliteParameter(":Duty", DbType.Decimal);
            arParams[18].Direction = ParameterDirection.Input;
            arParams[18].Value     = duty;

            arParams[19]           = new SqliteParameter(":Freight", DbType.Decimal);
            arParams[19].Direction = ParameterDirection.Input;
            arParams[19].Value     = freight;


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

            return(rowsAffected > -1);
        }
コード例 #22
0
        public static int AddHtmlContent(
            Guid itemGuid,
            Guid moduleGuid,
            int moduleId,
            string title,
            string excerpt,
            string body,
            string moreLink,
            int sortOrder,
            DateTime beginDate,
            DateTime endDate,
            DateTime createdDate,
            int userId,
            Guid userGuid,
            bool excludeFromRecentContent)
        {
            int exclude = 0;

            if (excludeFromRecentContent)
            {
                exclude = 1;
            }

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_HtmlContent (");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Excerpt, ");
            sqlCommand.Append("Body, ");
            sqlCommand.Append("MoreLink, ");
            sqlCommand.Append("SortOrder, ");
            sqlCommand.Append("BeginDate, ");
            sqlCommand.Append("EndDate, ");
            sqlCommand.Append("CreatedDate, ");
            sqlCommand.Append("UserID, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("ExcludeFromRecentContent, ");
            sqlCommand.Append("LastModUserGuid, ");
            sqlCommand.Append("LastModUtc )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":ModuleID, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Excerpt, ");
            sqlCommand.Append(":Body, ");
            sqlCommand.Append(":MoreLink, ");
            sqlCommand.Append(":SortOrder, ");
            sqlCommand.Append(":BeginDate, ");
            sqlCommand.Append(":EndDate, ");
            sqlCommand.Append(":CreatedDate, ");
            sqlCommand.Append(":UserID, ");
            sqlCommand.Append(":ItemGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":ExcludeFromRecentContent, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":CreatedDate )");
            sqlCommand.Append(";");

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

            SqliteParameter[] arParams = new SqliteParameter[14];

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

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

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

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

            arParams[4]           = new SqliteParameter(":MoreLink", DbType.String, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = moreLink;

            arParams[5]           = new SqliteParameter(":BeginDate", DbType.DateTime);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = beginDate;

            arParams[6]           = new SqliteParameter(":EndDate", DbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = endDate;

            arParams[7]           = new SqliteParameter(":CreatedDate", DbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = createdDate;

            arParams[8]           = new SqliteParameter(":UserID", DbType.Int32);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = userId;

            arParams[9]           = new SqliteParameter(":SortOrder", DbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = sortOrder;

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

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

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

            arParams[13]           = new SqliteParameter(":ExcludeFromRecentContent", DbType.Int32);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = exclude;

            int newID = 0;

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

            return(newID);
        }
コード例 #23
0
        /// <summary>
        /// Updates a row in the mp_CalendarEvents table. Returns true if row updated.
        /// </summary>
        /// <returns>bool</returns>
        public static bool UpdateCalendarEvent(
            int itemId,
            int moduleId,
            string title,
            string description,
            string imageName,
            DateTime eventDate,
            DateTime startTime,
            DateTime endTime,
            string location,
            bool requiresTicket,
            decimal ticketPrice,
            DateTime lastModUtc,
            Guid lastModUserGuid,
            bool showMap)
        {
            #region Bit Conversion

            int intRequiresTicket = requiresTicket ? 1 : 0;
            //if (requiresTicket)
            //{
            //    intRequiresTicket = 1;
            //}
            //else
            //{
            //    intRequiresTicket = 0;
            //}

            int intShowMap = showMap ? 1 : 0;


            #endregion

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_CalendarEvents ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("ModuleID = :ModuleID, ");
            sqlCommand.Append("Title = :Title, ");
            sqlCommand.Append("Description = :Description, ");
            sqlCommand.Append("ImageName = :ImageName, ");
            sqlCommand.Append("EventDate = :EventDate, ");
            sqlCommand.Append("StartTime = :StartTime, ");
            sqlCommand.Append("EndTime = :EndTime, ");
            sqlCommand.Append("Location = :Location, ");
            sqlCommand.Append("LastModUserGuid = :LastModUserGuid, ");
            sqlCommand.Append("LastModUtc = :LastModUtc, ");
            sqlCommand.Append("TicketPrice = :TicketPrice, ");
            sqlCommand.Append("RequiresTicket = :RequiresTicket,");
            sqlCommand.Append("ShowMap = :ShowMap ");

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

            SqliteParameter[] arParams = new SqliteParameter[14];

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

            arParams[1]           = new SqliteParameter(":ModuleID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = moduleId;

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

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

            arParams[4]           = new SqliteParameter(":ImageName", DbType.String, 100);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = imageName;

            arParams[5]           = new SqliteParameter(":EventDate", DbType.DateTime);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = eventDate;

            arParams[6]           = new SqliteParameter(":StartTime", DbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = startTime;

            arParams[7]           = new SqliteParameter(":EndTime", DbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = endTime;

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

            arParams[9]           = new SqliteParameter(":LastModUserGuid", DbType.String, 36);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = lastModUserGuid.ToString();

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

            arParams[11]           = new SqliteParameter(":TicketPrice", DbType.Decimal);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = ticketPrice;

            arParams[12]           = new SqliteParameter(":RequiresTicket", DbType.Int32);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = intRequiresTicket;

            arParams[13]           = new SqliteParameter(":ShowMap", DbType.Int32);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = intShowMap;

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

            return(rowsAffected > -1);
        }
コード例 #24
0
        public static IDataReader GetHtmlForMetaWeblogApi(int siteId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  ");
            sqlCommand.Append("pm.*, ");
            sqlCommand.Append("m.ModuleTitle, ");
            sqlCommand.Append("m.AuthorizedEditRoles, ");
            sqlCommand.Append("m.IsGlobal, ");
            sqlCommand.Append("h.Body, ");
            sqlCommand.Append("h.ItemID, ");
            sqlCommand.Append("h.ItemGuid, ");
            sqlCommand.Append("h.LastModUserGuid, ");
            sqlCommand.Append("h.LastModUtc, ");
            sqlCommand.Append("p.PageGuid, ");
            sqlCommand.Append("p.ParentID, ");
            sqlCommand.Append("p.ParentGuid, ");
            sqlCommand.Append("p.PageName, ");
            sqlCommand.Append("p.UseUrl, ");
            sqlCommand.Append("p.Url, ");
            sqlCommand.Append("p.EditRoles, ");
            sqlCommand.Append("p.PageOrder, ");
            sqlCommand.Append("p.EnableComments, ");
            sqlCommand.Append("p.IsPending, ");
            sqlCommand.Append("pp.PageName As ParentName ");


            sqlCommand.Append("FROM	mp_PageModules pm ");

            sqlCommand.Append("JOIN ");
            sqlCommand.Append("mp_Modules m ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("pm.ModuleID = m.ModuleID ");

            sqlCommand.Append("LEFT OUTER JOIN ");
            sqlCommand.Append("mp_HtmlContent h ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("h.ModuleID = m.ModuleID ");

            sqlCommand.Append("JOIN ");
            sqlCommand.Append("mp_ModuleDefinitions md ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("md.ModuleDefID = m.ModuleDefID ");

            sqlCommand.Append("JOIN ");
            sqlCommand.Append("mp_Pages p ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("pm.PageID = p.PageID ");

            sqlCommand.Append("LEFT OUTER JOIN ");
            sqlCommand.Append("mp_Pages pp ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("pp.PageID = p.ParentID ");

            sqlCommand.Append("WHERE p.SiteID = :SiteID  ");

            sqlCommand.Append("AND ");
            sqlCommand.Append("md.Guid = '881e4e00-93e4-444c-b7b0-6672fb55de10' ");

            sqlCommand.Append("AND ");
            sqlCommand.Append("pm.PaneName = 'contentpane' ");

            sqlCommand.Append("ORDER BY ");
            sqlCommand.Append("p.PageName, pm.ModuleOrder ");

            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[1];

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

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
コード例 #25
0
        public static bool UpdateModuleDefinition(
            int moduleDefId,
            string featureName,
            string controlSrc,
            int sortOrder,
            int defaultCacheTime,
            String icon,
            bool isAdmin,
            string resourceFile,
            bool isCacheable,
            bool isSearchable,
            string searchListName,
            bool supportsPageReuse,
            string deleteProvider,
            string partialView,
            string skinFileName)
        {
            int intIsAdmin = 0;

            if (isAdmin)
            {
                intIsAdmin = 1;
            }

            int intIsCacheable = 0;

            if (isCacheable)
            {
                intIsCacheable = 1;
            }

            int intIsSearchable = 0;

            if (isSearchable)
            {
                intIsSearchable = 1;
            }

            int intSupportsPageReuse = 0;

            if (supportsPageReuse)
            {
                intSupportsPageReuse = 1;
            }


            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_ModuleDefinitions ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("FeatureName = :FeatureName, ");
            sqlCommand.Append("ControlSrc = :ControlSrc, ");
            sqlCommand.Append("SortOrder = :SortOrder, ");
            sqlCommand.Append("DefaultCacheTime = :DefaultCacheTime, ");
            sqlCommand.Append("Icon = :Icon, ");
            sqlCommand.Append("IsAdmin = :IsAdmin, ");
            sqlCommand.Append("IsCacheable = :IsCacheable, ");
            sqlCommand.Append("IsSearchable = :IsSearchable, ");
            sqlCommand.Append("SearchListName = :SearchListName, ");
            sqlCommand.Append("SupportsPageReuse = :SupportsPageReuse, ");
            sqlCommand.Append("DeleteProvider = :DeleteProvider, ");
            sqlCommand.Append("PartialView = :PartialView, ");
            sqlCommand.Append("ResourceFile = :ResourceFile, ");
            sqlCommand.Append("SkinFileName = :SkinFileName ");

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

            SqliteParameter[] arParams = new SqliteParameter[15];

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

            arParams[1]           = new SqliteParameter(":FeatureName", DbType.String, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = featureName;

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

            arParams[3]           = new SqliteParameter(":SortOrder", DbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = sortOrder;

            arParams[4]           = new SqliteParameter(":IsAdmin", DbType.Int32);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = intIsAdmin;

            arParams[5]           = new SqliteParameter(":Icon", DbType.String, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = icon;

            arParams[6]           = new SqliteParameter(":DefaultCacheTime", DbType.Int32);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = defaultCacheTime;

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

            arParams[8]           = new SqliteParameter(":IsCacheable", DbType.Int32);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = intIsCacheable;

            arParams[9]           = new SqliteParameter(":IsSearchable", DbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = intIsSearchable;

            arParams[10]           = new SqliteParameter(":SearchListName", DbType.String, 255);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = searchListName;

            arParams[11]           = new SqliteParameter(":SupportsPageReuse", DbType.Int32);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = intSupportsPageReuse;

            arParams[12]           = new SqliteParameter(":DeleteProvider", DbType.String, 255);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = deleteProvider;

            arParams[13]           = new SqliteParameter(":PartialView", DbType.String, 255);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = partialView;

            arParams[14]           = new SqliteParameter(":SkinFileName", DbType.String, 255);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = skinFileName;

            int rowsAffected = -1;

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

            return(rowsAffected > -1);
        }
コード例 #26
0
        public static IDataReader GetHtmlContent(
            int moduleId,
            DateTime beginDate)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT ");
            sqlCommand.Append("h.ItemID AS ItemID, ");
            sqlCommand.Append("h.ModuleID AS ModuleID, ");
            sqlCommand.Append("h.Title AS Title, ");
            //sqlCommand.Append("h.Excerpt AS Excerpt, ");
            sqlCommand.Append("h.Body AS Body, ");
            sqlCommand.Append("h.MoreLink AS MoreLink, ");
            sqlCommand.Append("h.SortOrder AS SortOrder, ");
            //sqlCommand.Append("h.BeginDate AS BeginDate, ");
            //sqlCommand.Append("h.EndDate AS EndDate, ");
            sqlCommand.Append("h.CreatedDate AS CreatedDate, ");
            sqlCommand.Append("h.UserID AS UserID, ");
            sqlCommand.Append("h.ItemGuid AS ItemGuid, ");
            sqlCommand.Append("h.ModuleGuid AS ModuleGuid, ");
            sqlCommand.Append("h.UserGuid AS UserGuid, ");
            sqlCommand.Append("h.LastModUserGuid AS LastModUserGuid, ");
            sqlCommand.Append("h.LastModUtc AS LastModUtc, ");
            sqlCommand.Append("h.ExcludeFromRecentContent AS ExcludeFromRecentContent, ");

            sqlCommand.Append("u1.Name AS CreatedByName, ");
            sqlCommand.Append("u1.FirstName AS CreatedByFirstName, ");
            sqlCommand.Append("u1.LastName AS CreatedByLastName, ");
            sqlCommand.Append("u1.Email AS CreatedByEmail, ");
            sqlCommand.Append("u1.AuthorBio, ");
            sqlCommand.Append("u1.AvatarUrl, ");
            sqlCommand.Append("COALESCE(u1.UserID, -1) As AuthorUserID, ");
            sqlCommand.Append("u2.Name AS LastModByName, ");
            sqlCommand.Append("u2.FirstName AS LastModByFirstName, ");
            sqlCommand.Append("u2.LastName AS LastModByLastName, ");
            sqlCommand.Append("u2.Email AS LastModByEmail ");

            sqlCommand.Append("FROM	mp_HtmlContent h ");

            sqlCommand.Append("LEFT OUTER JOIN ");
            sqlCommand.Append("mp_Users u1 ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("h.UserGuid = u1.UserGuid ");

            sqlCommand.Append("LEFT OUTER JOIN ");
            sqlCommand.Append("mp_Users u2 ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("h.LastModUserGuid = u2.UserGuid ");


            sqlCommand.Append("WHERE h.ModuleID = :ModuleID  ");
            sqlCommand.Append("AND h.BeginDate <= :BeginDate  ");
            sqlCommand.Append("AND h.EndDate >= :BeginDate  ");
            sqlCommand.Append("ORDER BY h.BeginDate DESC ;");

            SqliteParameter[] arParams = new SqliteParameter[2];

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

            arParams[1]           = new SqliteParameter(":BeginDate", DbType.DateTime);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = beginDate;

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
コード例 #27
0
        public static bool UpdateModuleDefinitionSetting(
            Guid featureGuid,
            int moduleDefId,
            string resourceFile,
            string groupName,
            string settingName,
            string settingValue,
            string controlType,
            string regexValidationExpression,
            string controlSrc,
            string helpKey,
            int sortOrder,
            string attributes,
            string options)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT count(*)");
            sqlCommand.Append("FROM	mp_ModuleDefinitionSettings ");

            sqlCommand.Append("WHERE (ModuleDefID = :ModuleDefID OR FeatureGuid = :FeatureGuid)  ");
            sqlCommand.Append("AND SettingName = :SettingName  ;");

            SqliteParameter[] arParams = new SqliteParameter[3];

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

            arParams[1]           = new SqliteParameter(":SettingName", DbType.String, 50);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = settingName;

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


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

            sqlCommand = new StringBuilder();

            int rowsAffected = 0;

            if (count > 0)
            {
                sqlCommand.Append("UPDATE mp_ModuleDefinitionSettings ");
                sqlCommand.Append("SET SettingValue = :SettingValue  ,");
                sqlCommand.Append("FeatureGuid = :FeatureGuid,  ");
                sqlCommand.Append("ResourceFile = :ResourceFile,  ");
                sqlCommand.Append("ControlType = :ControlType  ,");
                sqlCommand.Append("ControlSrc = :ControlSrc  ,");
                sqlCommand.Append("HelpKey = :HelpKey  ,");
                sqlCommand.Append("SortOrder = :SortOrder  ,");
                sqlCommand.Append("GroupName = :GroupName  ,");
                sqlCommand.Append("RegexValidationExpression = :RegexValidationExpression,  ");
                sqlCommand.Append("Attributes = :Attributes,  ");
                sqlCommand.Append("Options = :Options  ");

                sqlCommand.Append("WHERE ModuleDefID = :ModuleDefID  ");
                sqlCommand.Append("AND SettingName = :SettingName  ; ");

                arParams = new SqliteParameter[13];

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

                arParams[1]           = new SqliteParameter(":SettingName", DbType.String, 50);
                arParams[1].Direction = ParameterDirection.Input;
                arParams[1].Value     = settingName;

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

                arParams[3]           = new SqliteParameter(":ControlType", DbType.String, 50);
                arParams[3].Direction = ParameterDirection.Input;
                arParams[3].Value     = controlType;

                arParams[4]           = new SqliteParameter(":RegexValidationExpression", DbType.Object);
                arParams[4].Direction = ParameterDirection.Input;
                arParams[4].Value     = regexValidationExpression;

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

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

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

                arParams[8]           = new SqliteParameter(":HelpKey", DbType.String, 255);
                arParams[8].Direction = ParameterDirection.Input;
                arParams[8].Value     = helpKey;

                arParams[9]           = new SqliteParameter(":SortOrder", DbType.Int32);
                arParams[9].Direction = ParameterDirection.Input;
                arParams[9].Value     = sortOrder;

                arParams[10]           = new SqliteParameter(":GroupName", DbType.String, 255);
                arParams[10].Direction = ParameterDirection.Input;
                arParams[10].Value     = groupName;

                arParams[11]           = new SqliteParameter(":Attributes", DbType.Object);
                arParams[11].Direction = ParameterDirection.Input;
                arParams[11].Value     = attributes;

                arParams[12]           = new SqliteParameter(":Options", DbType.Object);
                arParams[12].Direction = ParameterDirection.Input;
                arParams[12].Value     = options;

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

                return(rowsAffected > 0);
            }
            else
            {
                sqlCommand.Append("INSERT INTO mp_ModuleDefinitionSettings ");
                sqlCommand.Append("( ");
                sqlCommand.Append("FeatureGuid, ");
                sqlCommand.Append("ModuleDefID, ");
                sqlCommand.Append("ResourceFile, ");
                sqlCommand.Append("SettingName, ");
                sqlCommand.Append("SettingValue, ");
                sqlCommand.Append("ControlType, ");
                sqlCommand.Append("ControlSrc, ");
                sqlCommand.Append("HelpKey, ");
                sqlCommand.Append("SortOrder, ");
                sqlCommand.Append("GroupName, ");
                sqlCommand.Append("RegexValidationExpression, ");
                sqlCommand.Append("Attributes, ");
                sqlCommand.Append("Options");
                sqlCommand.Append(")");

                sqlCommand.Append("VALUES (  ");
                sqlCommand.Append(" :FeatureGuid  , ");
                sqlCommand.Append(" :ModuleDefID , ");
                sqlCommand.Append(" :ResourceFile  , ");
                sqlCommand.Append(" :SettingName  , ");
                sqlCommand.Append(" :SettingValue  ,");
                sqlCommand.Append(" :ControlType  ,");
                sqlCommand.Append(" :ControlSrc, ");
                sqlCommand.Append(" :HelpKey, ");
                sqlCommand.Append(" :SortOrder, ");
                sqlCommand.Append(" :GroupName, ");
                sqlCommand.Append(" :RegexValidationExpression,  ");
                sqlCommand.Append(" :Attributes,  ");
                sqlCommand.Append(" :Options  ");
                sqlCommand.Append(");");

                arParams = new SqliteParameter[13];

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

                arParams[1]           = new SqliteParameter(":SettingName", DbType.String, 50);
                arParams[1].Direction = ParameterDirection.Input;
                arParams[1].Value     = settingName;

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

                arParams[3]           = new SqliteParameter(":ControlType", DbType.String, 50);
                arParams[3].Direction = ParameterDirection.Input;
                arParams[3].Value     = controlType;

                arParams[4]           = new SqliteParameter(":RegexValidationExpression", DbType.Object);
                arParams[4].Direction = ParameterDirection.Input;
                arParams[4].Value     = regexValidationExpression;

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

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

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

                arParams[8]           = new SqliteParameter(":HelpKey", DbType.String, 255);
                arParams[8].Direction = ParameterDirection.Input;
                arParams[8].Value     = helpKey;

                arParams[9]           = new SqliteParameter(":SortOrder", DbType.Int32);
                arParams[9].Direction = ParameterDirection.Input;
                arParams[9].Value     = sortOrder;

                arParams[10]           = new SqliteParameter(":GroupName", DbType.String, 255);
                arParams[10].Direction = ParameterDirection.Input;
                arParams[10].Value     = groupName;

                arParams[11]           = new SqliteParameter(":Attributes", DbType.Object);
                arParams[11].Direction = ParameterDirection.Input;
                arParams[11].Value     = attributes;

                arParams[12]           = new SqliteParameter(":Options", DbType.Object);
                arParams[12].Direction = ParameterDirection.Input;
                arParams[12].Value     = options;

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

                return(rowsAffected > 0);
            }
        }
コード例 #28
0
ファイル: DBGallery.cs プロジェクト: wqshabib/mojoportal
        public static bool UpdateGalleryImage(
            int itemId,
            int moduleId,
            int displayOrder,
            string caption,
            string description,
            string metaDataXml,
            string imageFile,
            string webImageFile,
            string thumbnailFile,
            DateTime uploadDate,
            string uploadUser)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_GalleryImages ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("ModuleID = :ModuleID, ");
            sqlCommand.Append("DisplayOrder = :DisplayOrder, ");
            sqlCommand.Append("Caption = :Caption, ");
            sqlCommand.Append("Description = :Description, ");
            sqlCommand.Append("MetaDataXml = :MetaDataXml, ");
            sqlCommand.Append("ImageFile = :ImageFile, ");
            sqlCommand.Append("WebImageFile = :WebImageFile, ");
            sqlCommand.Append("ThumbnailFile = :ThumbnailFile, ");
            sqlCommand.Append("UploadDate = :UploadDate, ");
            sqlCommand.Append("UploadUser = :UploadUser ");

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

            SqliteParameter[] arParams = new SqliteParameter[11];

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

            arParams[1]           = new SqliteParameter(":ModuleID", DbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = moduleId;

            arParams[2]           = new SqliteParameter(":DisplayOrder", DbType.Int32);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = displayOrder;

            arParams[3]           = new SqliteParameter(":Caption", DbType.String, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = caption;

            arParams[4]           = new SqliteParameter(":Description", DbType.Object);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = description;

            arParams[5]           = new SqliteParameter(":MetaDataXml", DbType.Object);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = metaDataXml;

            arParams[6]           = new SqliteParameter(":ImageFile", DbType.String, 100);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = imageFile;

            arParams[7]           = new SqliteParameter(":WebImageFile", DbType.String, 100);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = webImageFile;

            arParams[8]           = new SqliteParameter(":ThumbnailFile", DbType.String, 100);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = thumbnailFile;

            arParams[9]           = new SqliteParameter(":UploadDate", DbType.DateTime);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = uploadDate;

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

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

            return(rowsAffected > -1);
        }
コード例 #29
0
ファイル: DBCategory.cs プロジェクト: wqshabib/mojoportal
        /// <summary>
        /// Inserts a row in the mp_Category 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="category"> category </param>
        /// <param name="description"> description </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdBy"> createdBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid parentGuid,
            Guid siteGuid,
            Guid featureGuid,
            Guid moduleGuid,
            string category,
            string description,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_Category (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("ParentGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("FeatureGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("Category, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("ItemCount, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("ModifiedUtc, ");
            sqlCommand.Append("ModifiedBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":ParentGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":FeatureGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":Category, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":ItemCount, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":CreatedBy, ");
            sqlCommand.Append(":ModifiedUtc, ");
            sqlCommand.Append(":ModifiedBy )");
            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(":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(":Category", DbType.String, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = category;

            arParams[6]           = new SqliteParameter(":Description", DbType.Object);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = description;

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

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

            arParams[9]           = new SqliteParameter(":CreatedBy", DbType.String, 36);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = createdBy.ToString();

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

            arParams[11]           = new SqliteParameter(":ModifiedBy", DbType.String, 36);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = createdBy.ToString();


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

            return(rowsAffected);
        }
コード例 #30
0
ファイル: DBEmailSendLog.cs プロジェクト: zahedbri/mojoportal
        /// <summary>
        /// Inserts a row in the mp_EmailSendLog table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="specialGuid1"> specialGuid1 </param>
        /// <param name="specialGuid2"> specialGuid2 </param>
        /// <param name="toAddress"> toAddress </param>
        /// <param name="ccAddress"> ccAddress </param>
        /// <param name="bccAddress"> bccAddress </param>
        /// <param name="subject"> subject </param>
        /// <param name="textBody"> textBody </param>
        /// <param name="htmlBody"> htmlBody </param>
        /// <param name="type"> type </param>
        /// <param name="sentUtc"> sentUtc </param>
        /// <param name="fromAddress"> fromAddress </param>
        /// <param name="replyTo"> replyTo </param>
        /// <param name="userGuid"> userGuid </param>
        /// <returns>int</returns>
        public static void Create(
            Guid guid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid specialGuid1,
            Guid specialGuid2,
            string toAddress,
            string ccAddress,
            string bccAddress,
            string subject,
            string textBody,
            string htmlBody,
            string type,
            DateTime sentUtc,
            string fromAddress,
            string replyTo,
            Guid userGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_EmailSendLog (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("SpecialGuid1, ");
            sqlCommand.Append("SpecialGuid2, ");
            sqlCommand.Append("ToAddress, ");
            sqlCommand.Append("CcAddress, ");
            sqlCommand.Append("BccAddress, ");
            sqlCommand.Append("Subject, ");
            sqlCommand.Append("TextBody, ");
            sqlCommand.Append("HtmlBody, ");
            sqlCommand.Append("Type, ");
            sqlCommand.Append("SentUtc, ");
            sqlCommand.Append("FromAddress, ");
            sqlCommand.Append("ReplyTo, ");
            sqlCommand.Append("UserGuid )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":SpecialGuid1, ");
            sqlCommand.Append(":SpecialGuid2, ");
            sqlCommand.Append(":ToAddress, ");
            sqlCommand.Append(":CcAddress, ");
            sqlCommand.Append(":BccAddress, ");
            sqlCommand.Append(":Subject, ");
            sqlCommand.Append(":TextBody, ");
            sqlCommand.Append(":HtmlBody, ");
            sqlCommand.Append(":Type, ");
            sqlCommand.Append(":SentUtc, ");
            sqlCommand.Append(":FromAddress, ");
            sqlCommand.Append(":ReplyTo, ");
            sqlCommand.Append(":UserGuid )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[16];

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

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

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

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

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

            arParams[5]           = new SqliteParameter(":ToAddress", DbType.String, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = toAddress;

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

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

            arParams[8]           = new SqliteParameter(":Subject", DbType.String, 255);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = subject;

            arParams[9]           = new SqliteParameter(":TextBody", DbType.Object);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = textBody;

            arParams[10]           = new SqliteParameter(":HtmlBody", DbType.Object);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = htmlBody;

            arParams[11]           = new SqliteParameter(":Type", DbType.String, 50);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = type;

            arParams[12]           = new SqliteParameter(":SentUtc", DbType.DateTime);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = sentUtc;

            arParams[13]           = new SqliteParameter(":FromAddress", DbType.String, 100);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = fromAddress;

            arParams[14]           = new SqliteParameter(":ReplyTo", DbType.String, 100);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = replyTo;

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

            SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                arParams);
        }