Пример #1
0
        /// <summary>
        /// Inserts a row in the cy_Currency table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="title"> title </param>
        /// <param name="code"> code </param>
        /// <param name="symbolLeft"> symbolLeft </param>
        /// <param name="symbolRight"> symbolRight </param>
        /// <param name="decimalPointChar"> decimalPointChar </param>
        /// <param name="thousandsPointChar"> thousandsPointChar </param>
        /// <param name="decimalPlaces"> decimalPlaces </param>
        /// <param name="value"> value </param>
        /// <param name="lastModified"> lastModified </param>
        /// <param name="created"> created </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            string title,
            string code,
            string symbolLeft,
            string symbolRight,
            string decimalPointChar,
            string thousandsPointChar,
            string decimalPlaces,
            decimal value,
            DateTime lastModified,
            DateTime created)
        {
            #region Bit Conversion


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_Currency (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Code, ");
            sqlCommand.Append("SymbolLeft, ");
            sqlCommand.Append("SymbolRight, ");
            sqlCommand.Append("DecimalPointChar, ");
            sqlCommand.Append("ThousandsPointChar, ");
            sqlCommand.Append("DecimalPlaces, ");
            sqlCommand.Append("Value, ");
            sqlCommand.Append("LastModified, ");
            sqlCommand.Append("Created )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Code, ");
            sqlCommand.Append(":SymbolLeft, ");
            sqlCommand.Append(":SymbolRight, ");
            sqlCommand.Append(":DecimalPointChar, ");
            sqlCommand.Append(":ThousandsPointChar, ");
            sqlCommand.Append(":DecimalPlaces, ");
            sqlCommand.Append(":Value, ");
            sqlCommand.Append(":LastModified, ");
            sqlCommand.Append(":Created )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[11];

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

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

            arParams[2]           = new SqliteParameter(":Code", DbType.String, 3);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = code;

            arParams[3]           = new SqliteParameter(":SymbolLeft", DbType.String, 15);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = symbolLeft;

            arParams[4]           = new SqliteParameter(":SymbolRight", DbType.String, 15);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = symbolRight;

            arParams[5]           = new SqliteParameter(":DecimalPointChar", DbType.String, 1);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = decimalPointChar;

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

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

            arParams[8]           = new SqliteParameter(":Value", DbType.Decimal);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = value;

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

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


            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
Пример #2
0
        /// <summary>
        /// Updates a row in the cy_AuthorizeNetLog 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 cy_AuthorizeNetLog ");
            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);
        }
Пример #3
0
        /// <summary>
        /// Updates a row in the cy_EmailTemplate table. Returns true if row updated.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="name"> name </param>
        /// <param name="subject"> subject </param>
        /// <param name="textBody"> textBody </param>
        /// <param name="htmlBody"> htmlBody </param>
        /// <param name="hasHtml"> hasHtml </param>
        /// <param name="isEditable"> isEditable </param>
        /// <param name="lastModUtc"> lastModUtc </param>
        /// <param name="lastModBy"> lastModBy </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            string name,
            string subject,
            string textBody,
            string htmlBody,
            bool hasHtml,
            bool isEditable,
            DateTime lastModUtc,
            Guid lastModBy)
        {
            #region Bit Conversion

            int intHasHtml = 0;
            if (hasHtml)
            {
                intHasHtml = 1;
            }

            int intIsEditable = 0;
            if (isEditable)
            {
                intIsEditable = 1;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_EmailTemplate ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("Name = :Name, ");
            sqlCommand.Append("Subject = :Subject, ");
            sqlCommand.Append("TextBody = :TextBody, ");
            sqlCommand.Append("HtmlBody = :HtmlBody, ");
            sqlCommand.Append("HasHtml = :HasHtml, ");
            sqlCommand.Append("IsEditable = :IsEditable, ");
            sqlCommand.Append("LastModUtc = :LastModUtc, ");
            sqlCommand.Append("LastModBy = :LastModBy ");

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

            SqliteParameter[] arParams = new SqliteParameter[9];

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

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

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

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

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

            arParams[5]           = new SqliteParameter(":HasHtml", DbType.Int32);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = intHasHtml;

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

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

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

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

            return(rowsAffected > -1);
        }
Пример #4
0
        public static DataTable GetByHostName(string hostName)
        {
            DataTable dt     = new DataTable();
            int       siteId = 1;

            dt.Columns.Add("UrlID", typeof(int));
            dt.Columns.Add("FriendlyUrl", typeof(string));
            dt.Columns.Add("RealUrl", typeof(string));
            dt.Columns.Add("IsPattern", typeof(bool));


            StringBuilder sqlCommand = new StringBuilder();

            SqliteParameter[] arParams = new SqliteParameter[1];

            arParams[0]           = new SqliteParameter(":HostName", DbType.String, 255);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = hostName;

            sqlCommand.Append("SELECT cy_SiteHosts.SiteID As SiteID ");
            sqlCommand.Append("FROM cy_SiteHosts ");
            sqlCommand.Append("WHERE cy_SiteHosts.HostName = :HostName ;");

            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                if (reader.Read())
                {
                    siteId = Convert.ToInt32(reader["SiteID"]);
                }
            }

            sqlCommand = new StringBuilder();
            sqlCommand.Append("SELECT  * ");
            sqlCommand.Append("FROM	cy_FriendlyUrls ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("SiteID = :SiteID ;");

            arParams = new SqliteParameter[1];

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

            using (IDataReader reader = SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams))
            {
                while (reader.Read())
                {
                    DataRow row = dt.NewRow();
                    row["UrlID"]       = reader["UrlID"];
                    row["FriendlyUrl"] = reader["FriendlyUrl"];
                    row["RealUrl"]     = reader["RealUrl"];
                    row["IsPattern"]   = reader["IsPattern"];
                    dt.Rows.Add(row);
                }
            }

            return(dt);
        }
Пример #5
0
        public static IDataReader GetPage(
            int siteId,
            string searchTerm,
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            int pageLowerBound = (pageSize * pageNumber) - pageSize;

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

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

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

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT	* ");
            sqlCommand.Append("FROM	cy_FriendlyUrls  ");
            sqlCommand.Append("WHERE ");
            sqlCommand.Append("SiteID = :SiteID ");
            sqlCommand.Append("AND ");
            sqlCommand.Append("FriendlyUrl LIKE :SearchTerm ");
            sqlCommand.Append("ORDER BY FriendlyUrl  ");
            //sqlCommand.Append("  ");
            //sqlCommand.Append("LIMIT " + pageLowerBound.ToString() + ", :PageSize ");
            sqlCommand.Append("LIMIT :Offset, :PageSize ");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[4];

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

            arParams[1]           = new SqliteParameter(":SearchTerm", DbType.String, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = "%" + searchTerm + "%";

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

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

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Пример #6
0
        /// <summary>
        /// Updates a row in the cy_ContentMeta table. Returns true if row updated.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="name"> name </param>
        /// <param name="scheme"> scheme </param>
        /// <param name="langCode"> langCode </param>
        /// <param name="dir"> dir </param>
        /// <param name="metaContent"> metaContent </param>
        /// <param name="sortRank"> sortRank </param>
        /// <param name="lastModUtc"> lastModUtc </param>
        /// <param name="lastModBy"> lastModBy </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            string name,
            string scheme,
            string langCode,
            string dir,
            string metaContent,
            int sortRank,
            DateTime lastModUtc,
            Guid lastModBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

            sqlCommand.Append("Name = :Name, ");
            sqlCommand.Append("Scheme = :Scheme, ");
            sqlCommand.Append("LangCode = :LangCode, ");
            sqlCommand.Append("Dir = :Dir, ");
            sqlCommand.Append("MetaContent = :MetaContent, ");
            sqlCommand.Append("SortRank = :SortRank, ");
            sqlCommand.Append("LastModUtc = :LastModUtc, ");
            sqlCommand.Append("LastModBy = :LastModBy ");

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

            SqliteParameter[] arParams = new SqliteParameter[9];

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

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

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

            arParams[3]           = new SqliteParameter(":LangCode", DbType.String, 10);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = langCode;

            arParams[4]           = new SqliteParameter(":Dir", DbType.String, 3);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = dir;

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

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

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

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


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

            return(rowsAffected > -1);
        }
Пример #7
0
        /// <summary>
        /// Inserts a row in the cy_LetterInfo table. Returns rows affected count.
        /// </summary>
        /// <param name="letterInfoGuid"> letterInfoGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="title"> title </param>
        /// <param name="description"> description </param>
        /// <param name="availableToRoles"> availableToRoles </param>
        /// <param name="enabled"> enabled </param>
        /// <param name="allowUserFeedback"> allowUserFeedback </param>
        /// <param name="allowAnonFeedback"> allowAnonFeedback </param>
        /// <param name="fromAddress"> fromAddress </param>
        /// <param name="fromName"> fromName </param>
        /// <param name="replyToAddress"> replyToAddress </param>
        /// <param name="sendMode"> sendMode </param>
        /// <param name="enableViewAsWebPage"> enableViewAsWebPage </param>
        /// <param name="enableSendLog"> enableSendLog </param>
        /// <param name="rolesThatCanEdit"> rolesThatCanEdit </param>
        /// <param name="rolesThatCanApprove"> rolesThatCanApprove </param>
        /// <param name="rolesThatCanSend"> rolesThatCanSend </param>
        /// <param name="createdUTC"> createdUTC </param>
        /// <param name="createdBy"> createdBy </param>
        /// <param name="lastModUTC"> lastModUTC </param>
        /// <param name="lastModBy"> lastModBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid letterInfoGuid,
            Guid siteGuid,
            string title,
            string description,
            string availableToRoles,
            bool enabled,
            bool allowUserFeedback,
            bool allowAnonFeedback,
            string fromAddress,
            string fromName,
            string replyToAddress,
            int sendMode,
            bool enableViewAsWebPage,
            bool enableSendLog,
            string rolesThatCanEdit,
            string rolesThatCanApprove,
            string rolesThatCanSend,
            DateTime createdUtc,
            Guid createdBy,
            DateTime lastModUtc,
            Guid lastModBy,
            bool allowArchiveView,
            bool profileOptIn,
            int sortRank)
        {
            #region Bit Conversion

            int intAllowArchiveView = 0;
            if (allowArchiveView)
            {
                intAllowArchiveView = 1;
            }

            int intProfileOptIn = 0;
            if (profileOptIn)
            {
                intProfileOptIn = 1;
            }

            int intEnabled = 0;
            if (enabled)
            {
                intEnabled = 1;
            }

            int intAllowUserFeedback = 0;
            if (allowUserFeedback)
            {
                intAllowUserFeedback = 1;
            }

            int intAllowAnonFeedback = 0;
            if (allowAnonFeedback)
            {
                intAllowAnonFeedback = 1;
            }

            int intEnableViewAsWebPage = 0;
            if (enableViewAsWebPage)
            {
                intEnableViewAsWebPage = 1;
            }

            int intEnableSendLog = 0;
            if (enableSendLog)
            {
                intEnableSendLog = 1;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_LetterInfo (");
            sqlCommand.Append("LetterInfoGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("AvailableToRoles, ");
            sqlCommand.Append("Enabled, ");
            sqlCommand.Append("AllowUserFeedback, ");
            sqlCommand.Append("AllowAnonFeedback, ");
            sqlCommand.Append("FromAddress, ");
            sqlCommand.Append("FromName, ");
            sqlCommand.Append("ReplyToAddress, ");
            sqlCommand.Append("SendMode, ");
            sqlCommand.Append("EnableViewAsWebPage, ");
            sqlCommand.Append("EnableSendLog, ");
            sqlCommand.Append("RolesThatCanEdit, ");
            sqlCommand.Append("RolesThatCanApprove, ");
            sqlCommand.Append("RolesThatCanSend, ");
            sqlCommand.Append("SubscriberCount, ");
            sqlCommand.Append("UnVerifiedCount, ");
            sqlCommand.Append("AllowArchiveView, ");
            sqlCommand.Append("ProfileOptIn, ");
            sqlCommand.Append("SortRank, ");

            sqlCommand.Append("CreatedUTC, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("LastModUTC, ");
            sqlCommand.Append("LastModBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":LetterInfoGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":AvailableToRoles, ");
            sqlCommand.Append(":Enabled, ");
            sqlCommand.Append(":AllowUserFeedback, ");
            sqlCommand.Append(":AllowAnonFeedback, ");
            sqlCommand.Append(":FromAddress, ");
            sqlCommand.Append(":FromName, ");
            sqlCommand.Append(":ReplyToAddress, ");
            sqlCommand.Append(":SendMode, ");
            sqlCommand.Append(":EnableViewAsWebPage, ");
            sqlCommand.Append(":EnableSendLog, ");
            sqlCommand.Append(":RolesThatCanEdit, ");
            sqlCommand.Append(":RolesThatCanApprove, ");
            sqlCommand.Append(":RolesThatCanSend, ");
            sqlCommand.Append("0, ");
            sqlCommand.Append("0, ");
            sqlCommand.Append(":AllowArchiveView, ");
            sqlCommand.Append(":ProfileOptIn, ");
            sqlCommand.Append(":SortRank, ");

            sqlCommand.Append(":CreatedUTC, ");
            sqlCommand.Append(":CreatedBy, ");
            sqlCommand.Append(":LastModUTC, ");
            sqlCommand.Append(":LastModBy );");

            SqliteParameter[] arParams = new SqliteParameter[24];

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

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

            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(":AvailableToRoles", DbType.Object);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = availableToRoles;

            arParams[5]           = new SqliteParameter(":Enabled", DbType.Int32);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = intEnabled;

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

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

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

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

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

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

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

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

            arParams[14]           = new SqliteParameter(":RolesThatCanEdit", DbType.Object);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = rolesThatCanEdit;

            arParams[15]           = new SqliteParameter(":RolesThatCanApprove", DbType.Object);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = rolesThatCanApprove;

            arParams[16]           = new SqliteParameter(":RolesThatCanSend", DbType.Object);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = rolesThatCanSend;

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

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

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

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

            arParams[21]           = new SqliteParameter(":AllowArchiveView", DbType.Int32);
            arParams[21].Direction = ParameterDirection.Input;
            arParams[21].Value     = intAllowArchiveView;

            arParams[22]           = new SqliteParameter(":ProfileOptIn", DbType.Int32);
            arParams[22].Direction = ParameterDirection.Input;
            arParams[22].Value     = intProfileOptIn;

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

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

            return(rowsAffected);
        }
        public static bool UpdateModuleDefinitionSetting(
            Guid featureGuid,
            int moduleDefId,
            string resourceFile,
            string settingName,
            string settingValue,
            string controlType,
            string regexValidationExpression,
            string controlSrc,
            string helpKey,
            int sortOrder)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT count(*)");
            sqlCommand.Append("FROM	cy_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 cy_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("RegexValidationExpression = :RegexValidationExpression  ");

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

                arParams = new SqliteParameter[10];

                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;

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

                return(rowsAffected > 0);
            }
            else
            {
                sqlCommand.Append("INSERT INTO cy_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("RegexValidationExpression");
                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(" :RegexValidationExpression  ");
                sqlCommand.Append(");");

                arParams = new SqliteParameter[10];

                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;

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

                return(rowsAffected > 0);
            }
        }
        public static bool UpdateModuleDefinitionSettingById(
            int id,
            int moduleDefId,
            string resourceFile,
            string settingName,
            string settingValue,
            string controlType,
            string regexValidationExpression,
            string controlSrc,
            string helpKey,
            int sortOrder)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_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("RegexValidationExpression = :RegexValidationExpression  ");

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

            SqliteParameter[] arParams = new SqliteParameter[10];

            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;

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

            return(rowsAffected > 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)
        {
            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 cy_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("ResourceFile ");
            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(":ResourceFile ");
            sqlCommand.Append(" );");

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

            SqliteParameter[] arParams = new SqliteParameter[14];

            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;


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

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

                sqlCommand.Append(" VALUES (");
                sqlCommand.Append(":SiteID, ");
                sqlCommand.Append("(SELECT SiteGuid FROM cy_Sites WHERE SiteID = :SiteID LIMIT 1), ");
                sqlCommand.Append("(SELECT Guid FROM cy_ModuleDefinitions WHERE ModuleDefID = :ModuleDefID LIMIT 1), ");
                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);
        }
        public static void SyncDefinitions()
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_ModuleSettings ");
            sqlCommand.Append("SET ControlSrc = (SELECT mds.ControlSrc ");
            sqlCommand.Append("FROM cy_ModuleDefinitionSettings mds  ");
            sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
            sqlCommand.Append("FROM cy_Modules m ");
            sqlCommand.Append("WHERE m.ModuleID = cy_ModuleSettings.ModuleID) ");
            sqlCommand.Append("AND mds.SettingName = cy_ModuleSettings.SettingName LIMIT 1 ) ");
            //sqlCommand.Append(" ");
            sqlCommand.Append("; ");

            SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                null);

            sqlCommand = new StringBuilder();
            sqlCommand.Append("UPDATE cy_ModuleSettings ");
            sqlCommand.Append("SET ControlType = (SELECT  mds.ControlType ");
            sqlCommand.Append("FROM cy_ModuleDefinitionSettings mds  ");
            sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
            sqlCommand.Append("FROM cy_Modules m ");
            sqlCommand.Append("WHERE m.ModuleID = cy_ModuleSettings.ModuleID) ");
            sqlCommand.Append("AND mds.SettingName = cy_ModuleSettings.SettingName LIMIT 1 ) ");

            sqlCommand.Append("; ");

            SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                null);

            sqlCommand = new StringBuilder();
            sqlCommand.Append("UPDATE cy_ModuleSettings ");
            sqlCommand.Append("SET SortOrder = (SELECT mds.SortOrder ");
            sqlCommand.Append("FROM cy_ModuleDefinitionSettings mds  ");
            sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
            sqlCommand.Append("FROM cy_Modules m ");
            sqlCommand.Append("WHERE m.ModuleID = cy_ModuleSettings.ModuleID) ");
            sqlCommand.Append("AND mds.SettingName = cy_ModuleSettings.SettingName LIMIT 1 ); ");
            sqlCommand.Append(" ");

            SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                null);

            sqlCommand = new StringBuilder();
            sqlCommand.Append("UPDATE cy_ModuleSettings ");
            sqlCommand.Append("SET HelpKey = (SELECT mds.HelpKey ");
            sqlCommand.Append("FROM cy_ModuleDefinitionSettings mds  ");
            sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
            sqlCommand.Append("FROM cy_Modules m ");
            sqlCommand.Append("WHERE m.ModuleID = cy_ModuleSettings.ModuleID) ");
            sqlCommand.Append("AND mds.SettingName = cy_ModuleSettings.SettingName LIMIT 1 ); ");
            sqlCommand.Append(" ");

            SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                null);

            sqlCommand = new StringBuilder();
            sqlCommand.Append("UPDATE cy_ModuleSettings ");
            sqlCommand.Append("SET RegexValidationExpression = (SELECT mds.RegexValidationExpression ");
            sqlCommand.Append("FROM cy_ModuleDefinitionSettings mds  ");
            sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
            sqlCommand.Append("FROM cy_Modules m ");
            sqlCommand.Append("WHERE m.ModuleID = cy_ModuleSettings.ModuleID) ");
            sqlCommand.Append("AND mds.SettingName = cy_ModuleSettings.SettingName LIMIT 1 ); ");
            sqlCommand.Append(" ");

            SqliteHelper.ExecuteNonQuery(
                GetConnectionString(),
                sqlCommand.ToString(),
                null);
        }
        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)
        {
            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 cy_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("ResourceFile = :ResourceFile ");

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

            SqliteParameter[] arParams = new SqliteParameter[13];

            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;

            int rowsAffected = -1;

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

            return(rowsAffected > -1);
        }
Пример #13
0
        /// <summary>
        /// Inserts a row in the cy_TaxRate table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="geoZoneGuid"> geoZoneGuid </param>
        /// <param name="taxClassGuid"> taxClassGuid </param>
        /// <param name="priority"> priority </param>
        /// <param name="rate"> rate </param>
        /// <param name="description"> description </param>
        /// <param name="created"> created </param>
        /// <param name="createdBy"> createdBy </param>
        /// <param name="lastModified"> lastModified </param>
        /// <param name="modifiedBy"> modifiedBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            Guid geoZoneGuid,
            Guid taxClassGuid,
            int priority,
            decimal rate,
            string description,
            DateTime created,
            Guid createdBy,
            DateTime lastModified,
            Guid modifiedBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO cy_TaxRate (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("GeoZoneGuid, ");
            sqlCommand.Append("TaxClassGuid, ");
            sqlCommand.Append("Priority, ");
            sqlCommand.Append("Rate, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("Created, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("LastModified, ");
            sqlCommand.Append("ModifiedBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":GeoZoneGuid, ");
            sqlCommand.Append(":TaxClassGuid, ");
            sqlCommand.Append(":Priority, ");
            sqlCommand.Append(":Rate, ");
            sqlCommand.Append(":Description, ");
            sqlCommand.Append(":Created, ");
            sqlCommand.Append(":CreatedBy, ");
            sqlCommand.Append(":LastModified, ");
            sqlCommand.Append(":ModifiedBy )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[11];

            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(":GeoZoneGuid", DbType.String, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = geoZoneGuid.ToString();

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

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

            arParams[5]           = new SqliteParameter(":Rate", DbType.Decimal);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = rate;

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

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

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

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

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


            int rowsAffected = 0;

            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
Пример #14
0
        /// <summary>
        /// Updates a row in the cy_TaxRate table. Returns true if row updated.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="geoZoneGuid"> geoZoneGuid </param>
        /// <param name="taxClassGuid"> taxClassGuid </param>
        /// <param name="priority"> priority </param>
        /// <param name="rate"> rate </param>
        /// <param name="description"> description </param>
        /// <param name="lastModified"> lastModified </param>
        /// <param name="modifiedBy"> modifiedBy </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            Guid geoZoneGuid,
            Guid taxClassGuid,
            int priority,
            decimal rate,
            string description,
            DateTime lastModified,
            Guid modifiedBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

            sqlCommand.Append("GeoZoneGuid = :GeoZoneGuid, ");
            sqlCommand.Append("TaxClassGuid = :TaxClassGuid, ");
            sqlCommand.Append("Priority = :Priority, ");
            sqlCommand.Append("Rate = :Rate, ");
            sqlCommand.Append("Description = :Description, ");
            sqlCommand.Append("LastModified = :LastModified, ");
            sqlCommand.Append("ModifiedBy = :ModifiedBy ");

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

            SqliteParameter[] arParams = new SqliteParameter[8];

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

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

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

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

            arParams[4]           = new SqliteParameter(":Rate", DbType.Decimal);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = rate;

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

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

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


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

            return(rowsAffected > -1);
        }
Пример #15
0
        /// <summary>
        /// Updates a row in the cy_PayPalLog table. Returns true if row updated.
        /// </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="requestType"> requestType </param>
        /// <param name="apiVersion"> apiVersion </param>
        /// <param name="rawResponse"> rawResponse </param>
        /// <param name="token"> token </param>
        /// <param name="payerId"> payerId </param>
        /// <param name="transactionId"> transactionId </param>
        /// <param name="paymentType"> paymentType </param>
        /// <param name="paymentStatus"> paymentStatus </param>
        /// <param name="pendingReason"> pendingReason </param>
        /// <param name="reasonCode"> reasonCode </param>
        /// <param name="currencyCode"> currencyCode </param>
        /// <param name="exchangeRate"> exchangeRate </param>
        /// <param name="cartTotal"> cartTotal </param>
        /// <param name="payPalAmt"> payPalAmt </param>
        /// <param name="taxAmt"> taxAmt </param>
        /// <param name="feeAmt"> feeAmt </param>
        /// <param name="settleAmt"> settleAmt </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid rowGuid,
            DateTime createdUtc,
            Guid siteGuid,
            Guid userGuid,
            Guid storeGuid,
            Guid cartGuid,
            string requestType,
            string apiVersion,
            string rawResponse,
            string token,
            string payerId,
            string transactionId,
            string paymentType,
            string paymentStatus,
            string pendingReason,
            string reasonCode,
            string currencyCode,
            decimal exchangeRate,
            decimal cartTotal,
            decimal payPalAmt,
            decimal taxAmt,
            decimal feeAmt,
            decimal settleAmt)
        {
            #region Bit Conversion


            #endregion

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_PayPalLog ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("CreatedUtc = :CreatedUtc, ");
            sqlCommand.Append("SiteGuid = :SiteGuid, ");
            sqlCommand.Append("UserGuid = :UserGuid, ");
            sqlCommand.Append("StoreGuid = :StoreGuid, ");
            sqlCommand.Append("CartGuid = :CartGuid, ");
            sqlCommand.Append("RequestType = :RequestType, ");
            sqlCommand.Append("ApiVersion = :ApiVersion, ");
            sqlCommand.Append("RawResponse = :RawResponse, ");
            sqlCommand.Append("Token = :Token, ");
            sqlCommand.Append("PayerId = :PayerId, ");
            sqlCommand.Append("TransactionId = :TransactionId, ");
            sqlCommand.Append("PaymentType = :PaymentType, ");
            sqlCommand.Append("PaymentStatus = :PaymentStatus, ");
            sqlCommand.Append("PendingReason = :PendingReason, ");
            sqlCommand.Append("ReasonCode = :ReasonCode, ");
            sqlCommand.Append("CurrencyCode = :CurrencyCode, ");
            sqlCommand.Append("ExchangeRate = :ExchangeRate, ");
            sqlCommand.Append("CartTotal = :CartTotal, ");
            sqlCommand.Append("PayPalAmt = :PayPalAmt, ");
            sqlCommand.Append("TaxAmt = :TaxAmt, ");
            sqlCommand.Append("FeeAmt = :FeeAmt, ");
            sqlCommand.Append("SettleAmt = :SettleAmt ");

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

            SqliteParameter[] arParams = new SqliteParameter[23];

            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(":RequestType", DbType.String, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = requestType;

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

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

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

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

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

            arParams[12]           = new SqliteParameter(":PaymentType", DbType.String, 10);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = paymentType;

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

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

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

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

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

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

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

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

            arParams[21]           = new SqliteParameter(":FeeAmt", DbType.Decimal);
            arParams[21].Direction = ParameterDirection.Input;
            arParams[21].Value     = feeAmt;

            arParams[22]           = new SqliteParameter(":SettleAmt", DbType.Decimal);
            arParams[22].Direction = ParameterDirection.Input;
            arParams[22].Value     = settleAmt;


            int rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected > -1);
        }
Пример #16
0
        /// <summary>
        /// Inserts a row in the cy_FileAttachment table. Returns rows affected count.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="itemGuid"> itemGuid </param>
        /// <param name="specialGuid1"> specialGuid1 </param>
        /// <param name="specialGuid2"> specialGuid2 </param>
        /// <param name="serverFileName"> serverFileName </param>
        /// <param name="fileName"> fileName </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdBy"> createdBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid rowGuid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid itemGuid,
            Guid specialGuid1,
            Guid specialGuid2,
            string serverFileName,
            string fileName,
            DateTime createdUtc,
            Guid createdBy)
        {
            #region Bit Conversion


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_FileAttachment (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("SpecialGuid1, ");
            sqlCommand.Append("SpecialGuid2, ");
            sqlCommand.Append("ServerFileName, ");
            sqlCommand.Append("FileName, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("CreatedBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":RowGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":ItemGuid, ");
            sqlCommand.Append(":SpecialGuid1, ");
            sqlCommand.Append(":SpecialGuid2, ");
            sqlCommand.Append(":ServerFileName, ");
            sqlCommand.Append(":FileName, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":CreatedBy )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[10];

            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(":ModuleGuid", DbType.String, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = moduleGuid.ToString();

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

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

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

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

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

            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();


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

            return(rowsAffected);
        }
Пример #17
0
        /// <summary>
        /// Inserts a row in the cy_PayPalLog 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="requestType"> requestType </param>
        /// <param name="apiVersion"> apiVersion </param>
        /// <param name="rawResponse"> rawResponse </param>
        /// <param name="token"> token </param>
        /// <param name="payerId"> payerId </param>
        /// <param name="transactionId"> transactionId </param>
        /// <param name="paymentType"> paymentType </param>
        /// <param name="paymentStatus"> paymentStatus </param>
        /// <param name="pendingReason"> pendingReason </param>
        /// <param name="reasonCode"> reasonCode </param>
        /// <param name="currencyCode"> currencyCode </param>
        /// <param name="exchangeRate"> exchangeRate </param>
        /// <param name="cartTotal"> cartTotal </param>
        /// <param name="payPalAmt"> payPalAmt </param>
        /// <param name="taxAmt"> taxAmt </param>
        /// <param name="feeAmt"> feeAmt </param>
        /// <param name="settleAmt"> settleAmt </param>
        /// <returns>int</returns>
        public static int Create(
            Guid rowGuid,
            DateTime createdUtc,
            Guid siteGuid,
            Guid userGuid,
            Guid storeGuid,
            Guid cartGuid,
            string requestType,
            string apiVersion,
            string rawResponse,
            string token,
            string payerId,
            string transactionId,
            string paymentType,
            string paymentStatus,
            string pendingReason,
            string reasonCode,
            string currencyCode,
            decimal exchangeRate,
            decimal cartTotal,
            decimal payPalAmt,
            decimal taxAmt,
            decimal feeAmt,
            decimal settleAmt,
            string providerName,
            string returnUrl,
            string serializedObject,
            string pdtProviderName,
            string ipnProviderName,
            string response)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO cy_PayPalLog (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("StoreGuid, ");
            sqlCommand.Append("CartGuid, ");
            sqlCommand.Append("RequestType, ");
            sqlCommand.Append("ApiVersion, ");
            sqlCommand.Append("RawResponse, ");
            sqlCommand.Append("Token, ");
            sqlCommand.Append("PayerId, ");
            sqlCommand.Append("TransactionId, ");
            sqlCommand.Append("PaymentType, ");
            sqlCommand.Append("PaymentStatus, ");
            sqlCommand.Append("PendingReason, ");
            sqlCommand.Append("ReasonCode, ");
            sqlCommand.Append("CurrencyCode, ");
            sqlCommand.Append("ExchangeRate, ");
            sqlCommand.Append("CartTotal, ");
            sqlCommand.Append("PayPalAmt, ");
            sqlCommand.Append("TaxAmt, ");
            sqlCommand.Append("FeeAmt, ");
            sqlCommand.Append("ProviderName, ");
            sqlCommand.Append("ReturnUrl, ");
            sqlCommand.Append("SerializedObject, ");

            sqlCommand.Append("PDTProviderName, ");
            sqlCommand.Append("IPNProviderName, ");
            sqlCommand.Append("Response, ");

            sqlCommand.Append("SettleAmt )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":RowGuid, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":StoreGuid, ");
            sqlCommand.Append(":CartGuid, ");
            sqlCommand.Append(":RequestType, ");
            sqlCommand.Append(":ApiVersion, ");
            sqlCommand.Append(":RawResponse, ");
            sqlCommand.Append(":Token, ");
            sqlCommand.Append(":PayerId, ");
            sqlCommand.Append(":TransactionId, ");
            sqlCommand.Append(":PaymentType, ");
            sqlCommand.Append(":PaymentStatus, ");
            sqlCommand.Append(":PendingReason, ");
            sqlCommand.Append(":ReasonCode, ");
            sqlCommand.Append(":CurrencyCode, ");
            sqlCommand.Append(":ExchangeRate, ");
            sqlCommand.Append(":CartTotal, ");
            sqlCommand.Append(":PayPalAmt, ");
            sqlCommand.Append(":TaxAmt, ");
            sqlCommand.Append(":FeeAmt, ");
            sqlCommand.Append(":ProviderName, ");
            sqlCommand.Append(":ReturnUrl, ");
            sqlCommand.Append(":SerializedObject, ");

            sqlCommand.Append(":PDTProviderName, ");
            sqlCommand.Append(":IPNProviderName, ");
            sqlCommand.Append(":Response, ");

            sqlCommand.Append(":SettleAmt )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[29];

            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(":RequestType", DbType.String, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = requestType;

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

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

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

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

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

            arParams[12]           = new SqliteParameter(":PaymentType", DbType.String, 10);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = paymentType;

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

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

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

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

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

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

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

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

            arParams[21]           = new SqliteParameter(":FeeAmt", DbType.Decimal);
            arParams[21].Direction = ParameterDirection.Input;
            arParams[21].Value     = feeAmt;

            arParams[22]           = new SqliteParameter(":SettleAmt", DbType.Decimal);
            arParams[22].Direction = ParameterDirection.Input;
            arParams[22].Value     = settleAmt;

            arParams[23]           = new SqliteParameter(":ProviderName", DbType.String, 255);
            arParams[23].Direction = ParameterDirection.Input;
            arParams[23].Value     = providerName;

            arParams[24]           = new SqliteParameter(":ReturnUrl", DbType.String, 255);
            arParams[24].Direction = ParameterDirection.Input;
            arParams[24].Value     = returnUrl;

            arParams[25]           = new SqliteParameter(":SerializedObject", DbType.Object);
            arParams[25].Direction = ParameterDirection.Input;
            arParams[25].Value     = serializedObject;

            arParams[26]           = new SqliteParameter(":PDTProviderName", DbType.String, 255);
            arParams[26].Direction = ParameterDirection.Input;
            arParams[26].Value     = pdtProviderName;

            arParams[27]           = new SqliteParameter(":IPNProviderName", DbType.String, 255);
            arParams[27].Direction = ParameterDirection.Input;
            arParams[27].Value     = ipnProviderName;

            arParams[28]           = new SqliteParameter(":Response", DbType.String, 255);
            arParams[28].Direction = ParameterDirection.Input;
            arParams[28].Value     = response;

            int rowsAffected = 0;

            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
Пример #18
0
        /// <summary>
        /// Updates a row in the cy_Letter table. Returns true if row updated.
        /// </summary>
        /// <param name="letterGuid"> letterGuid </param>
        /// <param name="letterInfoGuid"> letterInfoGuid </param>
        /// <param name="subject"> subject </param>
        /// <param name="htmlBody"> htmlBody </param>
        /// <param name="textBody"> textBody </param>
        /// <param name="lastModBy"> lastModBy </param>
        /// <param name="lastModUTC"> lastModUTC </param>
        /// <param name="isApproved"> isApproved </param>
        /// <param name="approvedBy"> approvedBy </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid letterGuid,
            Guid letterInfoGuid,
            string subject,
            string htmlBody,
            string textBody,
            Guid lastModBy,
            DateTime lastModUtc,
            bool isApproved,
            Guid approvedBy)
        {
            #region Bit Conversion

            int intIsApproved;
            if (isApproved)
            {
                intIsApproved = 1;
            }
            else
            {
                intIsApproved = 0;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_Letter ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("LetterInfoGuid = :LetterInfoGuid, ");
            sqlCommand.Append("Subject = :Subject, ");
            sqlCommand.Append("HtmlBody = :HtmlBody, ");
            sqlCommand.Append("TextBody = :TextBody, ");
            sqlCommand.Append("LastModBy = :LastModBy, ");
            sqlCommand.Append("LastModUTC = :LastModUTC, ");
            sqlCommand.Append("IsApproved = :IsApproved, ");
            sqlCommand.Append("ApprovedBy = :ApprovedBy ");

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

            SqliteParameter[] arParams = new SqliteParameter[9];

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

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

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

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

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

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

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

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

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

            int rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected > -1);
        }
Пример #19
0
        /// <summary>
        /// Inserts a row in the cy_ContentMeta table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="contentGuid"> contentGuid </param>
        /// <param name="name"> name </param>
        /// <param name="scheme"> scheme </param>
        /// <param name="langCode"> langCode </param>
        /// <param name="dir"> dir </param>
        /// <param name="metaContent"> metaContent </param>
        /// <param name="sortRank"> sortRank </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdBy"> createdBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid contentGuid,
            string name,
            string scheme,
            string langCode,
            string dir,
            string metaContent,
            int sortRank,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO cy_ContentMeta (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("ContentGuid, ");
            sqlCommand.Append("Name, ");
            sqlCommand.Append("Scheme, ");
            sqlCommand.Append("LangCode, ");
            sqlCommand.Append("Dir, ");
            sqlCommand.Append("MetaContent, ");
            sqlCommand.Append("SortRank, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("LastModBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":ContentGuid, ");
            sqlCommand.Append(":Name, ");
            sqlCommand.Append(":Scheme, ");
            sqlCommand.Append(":LangCode, ");
            sqlCommand.Append(":Dir, ");
            sqlCommand.Append(":MetaContent, ");
            sqlCommand.Append(":SortRank, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":CreatedBy, ");
            sqlCommand.Append(":LastModUtc, ");
            sqlCommand.Append(":LastModBy )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[14];

            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(":ContentGuid", DbType.String, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = contentGuid.ToString();

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

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

            arParams[6]           = new SqliteParameter(":LangCode", DbType.String, 10);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = langCode;

            arParams[7]           = new SqliteParameter(":Dir", DbType.String, 3);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = dir;

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

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

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

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

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

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


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

            return(rowsAffected);
        }
Пример #20
0
        /// <summary>
        /// Inserts a row in the cy_Letter table. Returns rows affected count.
        /// </summary>
        /// <param name="letterGuid"> letterGuid </param>
        /// <param name="letterInfoGuid"> letterInfoGuid </param>
        /// <param name="subject"> subject </param>
        /// <param name="htmlBody"> htmlBody </param>
        /// <param name="textBody"> textBody </param>
        /// <param name="createdBy"> createdBy </param>
        /// <param name="createdUTC"> createdUTC </param>
        /// <param name="lastModBy"> lastModBy </param>
        /// <param name="lastModUTC"> lastModUTC </param>
        /// <param name="isApproved"> isApproved </param>
        /// <param name="approvedBy"> approvedBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid letterGuid,
            Guid letterInfoGuid,
            string subject,
            string htmlBody,
            string textBody,
            Guid createdBy,
            DateTime createdUtc,
            Guid lastModBy,
            DateTime lastModUtc,
            bool isApproved,
            Guid approvedBy)
        {
            #region Bit Conversion

            int intIsApproved;
            if (isApproved)
            {
                intIsApproved = 1;
            }
            else
            {
                intIsApproved = 0;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_Letter (");
            sqlCommand.Append("LetterGuid, ");
            sqlCommand.Append("LetterInfoGuid, ");
            sqlCommand.Append("Subject, ");
            sqlCommand.Append("HtmlBody, ");
            sqlCommand.Append("TextBody, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("CreatedUTC, ");
            sqlCommand.Append("LastModBy, ");
            sqlCommand.Append("LastModUTC, ");
            sqlCommand.Append("IsApproved, ");
            sqlCommand.Append("ApprovedBy, ");
            sqlCommand.Append("SendCount ");
            sqlCommand.Append(" )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":LetterGuid, ");
            sqlCommand.Append(":LetterInfoGuid, ");
            sqlCommand.Append(":Subject, ");
            sqlCommand.Append(":HtmlBody, ");
            sqlCommand.Append(":TextBody, ");
            sqlCommand.Append(":CreatedBy, ");
            sqlCommand.Append(":CreatedUTC, ");
            sqlCommand.Append(":LastModBy, ");
            sqlCommand.Append(":LastModUTC, ");
            sqlCommand.Append(":IsApproved, ");
            sqlCommand.Append(":ApprovedBy, ");
            sqlCommand.Append("0 ");
            sqlCommand.Append(" );");

            SqliteParameter[] arParams = new SqliteParameter[11];

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

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

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

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

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

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

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

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

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

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

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

            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
Пример #21
0
        public static bool UpdateFriendlyUrl(
            int urlId,
            int siteId,
            Guid pageGuid,
            string friendlyUrl,
            string realUrl,
            bool isPattern)
        {
            int intIsPattern;

            if (isPattern)
            {
                intIsPattern = 1;
            }
            else
            {
                intIsPattern = 0;
            }


            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_FriendlyUrls ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("SiteID = :SiteID, ");
            sqlCommand.Append("FriendlyUrl = :FriendlyUrl, ");
            sqlCommand.Append("RealUrl = :RealUrl, ");
            sqlCommand.Append("PageGuid = :PageGuid, ");
            sqlCommand.Append("IsPattern = :IsPattern ");

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

            SqliteParameter[] arParams = new SqliteParameter[6];

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

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

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

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

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

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

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

            return(rowsAffected > -1);
        }
Пример #22
0
        /// <summary>
        /// Gets a page of data from the cy_ContentHistory table.
        /// </summary>
        /// <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(
            Guid contentGuid,
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            int pageLowerBound = (pageSize * pageNumber) - pageSize;

            totalPages = 1;
            int totalRows = GetCount(contentGuid);

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

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

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("SELECT  ch.*, ");
            sqlCommand.Append("u.Name, ");
            sqlCommand.Append("u.LoginName, ");
            sqlCommand.Append("u.Email ");

            sqlCommand.Append("FROM	cy_ContentHistory ch ");

            sqlCommand.Append("LEFT OUTER JOIN ");
            sqlCommand.Append("cy_Users u ");
            sqlCommand.Append("ON ");
            sqlCommand.Append("u.UserGuid = ch.UserGuid ");

            sqlCommand.Append("WHERE ");
            sqlCommand.Append("ch.ContentGuid = :ContentGuid ");
            sqlCommand.Append("ORDER BY  ");
            sqlCommand.Append("ch.HistoryUtc DESC  ");
            sqlCommand.Append("LIMIT :PageSize ");
            if (pageNumber > 1)
            {
                sqlCommand.Append(", :OffsetRows ");
            }
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[3];

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

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

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

            return(SqliteHelper.ExecuteReader(
                       GetConnectionString(),
                       sqlCommand.ToString(),
                       arParams));
        }
Пример #23
0
        /// <summary>
        /// Inserts a row in the cy_FriendlyUrls table. Returns new integer id.
        /// </summary>
        /// <param name="itemGuid"> itemGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="pageGuid"> pageGuid </param>
        /// <param name="siteID"> siteID </param>
        /// <param name="friendlyUrl"> friendlyUrl </param>
        /// <param name="realUrl"> realUrl </param>
        /// <param name="isPattern"> isPattern </param>
        /// <returns>int</returns>
        public static int AddFriendlyUrl(
            Guid itemGuid,
            Guid siteGuid,
            Guid pageGuid,
            int siteId,
            string friendlyUrl,
            string realUrl,
            bool isPattern)
        {
            int intIsPattern;

            if (isPattern)
            {
                intIsPattern = 1;
            }
            else
            {
                intIsPattern = 0;
            }


            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO cy_FriendlyUrls ( ");
            sqlCommand.Append("SiteID, ");
            sqlCommand.Append("FriendlyUrl, ");
            sqlCommand.Append("RealUrl, ");
            sqlCommand.Append("IsPattern, ");
            sqlCommand.Append("PageGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("ItemGuid )");

            sqlCommand.Append(" VALUES ( ");
            sqlCommand.Append(":SiteID, ");
            sqlCommand.Append(":FriendlyUrl, ");
            sqlCommand.Append(":RealUrl, ");
            sqlCommand.Append(":IsPattern, ");
            sqlCommand.Append(":PageGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":ItemGuid )");
            sqlCommand.Append(";");

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

            SqliteParameter[] arParams = new SqliteParameter[7];

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

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

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

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

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

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

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

            int newID = 0;

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

            return(newID);
        }
Пример #24
0
        /// <summary>
        /// Inserts a row in the cy_ContentHistory table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="contentGuid"> contentGuid </param>
        /// <param name="title"> title </param>
        /// <param name="contentText"> contentText </param>
        /// <param name="customData"> customData </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="historyUtc"> historyUtc </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            Guid userGuid,
            Guid contentGuid,
            string title,
            string contentText,
            string customData,
            DateTime createdUtc,
            DateTime historyUtc)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO cy_ContentHistory (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("ContentGuid, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("ContentText, ");
            sqlCommand.Append("CustomData, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("HistoryUtc )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":ContentGuid, ");
            sqlCommand.Append(":Title, ");
            sqlCommand.Append(":ContentText, ");
            sqlCommand.Append(":CustomData, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":HistoryUtc )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[9];

            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(":UserGuid", DbType.String, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = userGuid.ToString();

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

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

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

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

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

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


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

            return(rowsAffected);
        }
Пример #25
0
        /// <summary>
        /// Inserts a row in the cy_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 cy_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);
        }
Пример #26
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)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_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("LastModUserGuid = :LastModUserGuid, ");
            sqlCommand.Append("LastModUtc = :LastModUtc ");

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

            SqliteParameter[] arParams = new SqliteParameter[10];

            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;

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

            return(rowsAffected > -1);
        }
Пример #27
0
        /// <summary>
        /// Inserts a row in the cy_AuthorizeNetLog 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="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 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)
        {
            #region Bit Conversion


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_AuthorizeNetLog (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("StoreGuid, ");
            sqlCommand.Append("CartGuid, ");
            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(":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[21];

            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;


            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
Пример #28
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)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO cy_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("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(":UserGuid, ");
            sqlCommand.Append(":CreatedDate )");
            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(":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();

            int newID = 0;

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

            return(newID);
        }
Пример #29
0
        /// <summary>
        /// Inserts a row in the cy_EmailTemplate table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="featureGuid"> featureGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="specialGuid1"> specialGuid1 </param>
        /// <param name="specialGuid2"> specialGuid2 </param>
        /// <param name="name"> name </param>
        /// <param name="subject"> subject </param>
        /// <param name="textBody"> textBody </param>
        /// <param name="htmlBody"> htmlBody </param>
        /// <param name="hasHtml"> hasHtml </param>
        /// <param name="isEditable"> isEditable </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="lastModUtc"> lastModUtc </param>
        /// <param name="lastModBy"> lastModBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            Guid featureGuid,
            Guid moduleGuid,
            Guid specialGuid1,
            Guid specialGuid2,
            string name,
            string subject,
            string textBody,
            string htmlBody,
            bool hasHtml,
            bool isEditable,
            DateTime createdUtc,
            Guid lastModBy)
        {
            #region Bit Conversion

            int intHasHtml = 0;
            if (hasHtml)
            {
                intHasHtml = 1;
            }

            int intIsEditable = 0;
            if (isEditable)
            {
                intIsEditable = 1;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_EmailTemplate (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("FeatureGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("SpecialGuid1, ");
            sqlCommand.Append("SpecialGuid2, ");
            sqlCommand.Append("Name, ");
            sqlCommand.Append("Subject, ");
            sqlCommand.Append("TextBody, ");
            sqlCommand.Append("HtmlBody, ");
            sqlCommand.Append("HasHtml, ");
            sqlCommand.Append("IsEditable, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("LastModBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":FeatureGuid, ");
            sqlCommand.Append(":ModuleGuid, ");
            sqlCommand.Append(":SpecialGuid1, ");
            sqlCommand.Append(":SpecialGuid2, ");
            sqlCommand.Append(":Name, ");
            sqlCommand.Append(":Subject, ");
            sqlCommand.Append(":TextBody, ");
            sqlCommand.Append(":HtmlBody, ");
            sqlCommand.Append(":HasHtml, ");
            sqlCommand.Append(":IsEditable, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":LastModUtc, ");
            sqlCommand.Append(":LastModBy )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[15];

            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(":FeatureGuid", DbType.String, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = featureGuid.ToString();

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

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

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

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

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

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

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

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

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

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

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

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

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

            return(rowsAffected);
        }
Пример #30
0
        /// <summary>
        /// Inserts a row in the cy_LetterSubscribeHx table. Returns rows affected count.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="subscribeGuid"> subscribeGuid </param>
        /// <param name="letterInfoGuid"> letterInfoGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="email"> email </param>
        /// <param name="isVerified"> isVerified </param>
        /// <param name="useHtml"> useHtml </param>
        /// <param name="beginUtc"> beginUtc </param>
        /// <param name="endUtc"> endUtc </param>
        /// <returns>int</returns>
        public static int CreateHistory(
            Guid rowGuid,
            Guid siteGuid,
            Guid subscribeGuid,
            Guid letterInfoGuid,
            Guid userGuid,
            string email,
            bool isVerified,
            bool useHtml,
            DateTime beginUtc,
            DateTime endUtc,
            string ipAddress)
        {
            #region Bit Conversion

            int intIsVerified = 0;
            if (isVerified)
            {
                intIsVerified = 1;
            }
            int intUseHtml = 0;
            if (useHtml)
            {
                intUseHtml = 1;
            }

            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_LetterSubscribeHx (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("SubscribeGuid, ");
            sqlCommand.Append("LetterInfoGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("Email, ");
            sqlCommand.Append("IsVerified, ");
            sqlCommand.Append("IpAddress, ");
            sqlCommand.Append("UseHtml, ");
            sqlCommand.Append("BeginUtc, ");
            sqlCommand.Append("EndUtc )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":RowGuid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":SubscribeGuid, ");
            sqlCommand.Append(":LetterInfoGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":Email, ");
            sqlCommand.Append(":IsVerified, ");
            sqlCommand.Append(":IpAddress, ");
            sqlCommand.Append(":UseHtml, ");
            sqlCommand.Append(":BeginUtc, ");
            sqlCommand.Append(":EndUtc )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[11];

            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(":SubscribeGuid", DbType.String, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = subscribeGuid.ToString();

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

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

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

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

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

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

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

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


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

            return(rowsAffected);
        }