/// <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);
        }
        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);
        }
Beispiel #6
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);
        }
        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);
        }
Beispiel #8
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);
        }
Beispiel #9
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);
        }
        public static bool UpdateSharedFile(
            int itemId,
            int moduleId,
            int uploadUserId,
            string friendlyName,
            string originalFileName,
            string serverFileName,
            int sizeInKB,
            DateTime uploadDate,
            int folderId,
            Guid folderGuid,
            Guid userGuid,
            string description)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_SharedFiles ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("ModuleID = :ModuleID, ");
            sqlCommand.Append("UploadUserID = :UploadUserID, ");
            sqlCommand.Append("FriendlyName = :FriendlyName, ");
            sqlCommand.Append("OriginalFileName = :OriginalFileName, ");
            sqlCommand.Append("ServerFileName = :ServerFileName, ");
            sqlCommand.Append("SizeInKB = :SizeInKB, ");
            sqlCommand.Append("UploadDate = :UploadDate, ");
            sqlCommand.Append("FolderID = :FolderID, ");
            sqlCommand.Append("UserGuid = :UserGuid, ");
            sqlCommand.Append("Description = :Description, ");
            sqlCommand.Append("FolderGuid = :FolderGuid ");

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

            SqliteParameter[] arParams = new SqliteParameter[12];

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

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

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

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

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

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

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

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

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

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

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

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

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

            return(rowsAffected > -1);
        }
Beispiel #11
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);
        }
Beispiel #12
0
        public static bool SchemaVersionAddSchemaVersion(
            Guid applicationId,
            string applicationName,
            int major,
            int minor,
            int build,
            int revision)
        {
            #region Bit Conversion


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_SchemaVersion (");
            sqlCommand.Append("ApplicationID, ");
            sqlCommand.Append("ApplicationName, ");
            sqlCommand.Append("Major, ");
            sqlCommand.Append("Minor, ");
            sqlCommand.Append("Build, ");
            sqlCommand.Append("Revision )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":ApplicationID, ");
            sqlCommand.Append(":ApplicationName, ");
            sqlCommand.Append(":Major, ");
            sqlCommand.Append(":Minor, ");
            sqlCommand.Append(":Build, ");
            sqlCommand.Append(":Revision );");

            SqliteParameter[] arParams = new SqliteParameter[6];

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

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

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

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

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

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

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

            return(rowsAffected > 0);
        }
        /// <summary>
        /// Inserts a row in the cy_ContentMetaLink 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="rel"> rel </param>
        /// <param name="href"> href </param>
        /// <param name="hrefLang"> hrefLang </param>
        /// <param name="rev"> rev </param>
        /// <param name="type"> type </param>
        /// <param name="media"> media </param>
        /// <param name="sortRank"> sortRank </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 guid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid contentGuid,
            string rel,
            string href,
            string hrefLang,
            string rev,
            string type,
            string media,
            int sortRank,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO cy_ContentMetaLink (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("ContentGuid, ");
            sqlCommand.Append("Rel, ");
            sqlCommand.Append("Href, ");
            sqlCommand.Append("HrefLang, ");
            sqlCommand.Append("Rev, ");
            sqlCommand.Append("Type, ");
            sqlCommand.Append("Media, ");
            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(":Rel, ");
            sqlCommand.Append(":Href, ");
            sqlCommand.Append(":HrefLang, ");
            sqlCommand.Append(":Rev, ");
            sqlCommand.Append(":Type, ");
            sqlCommand.Append(":Media, ");
            sqlCommand.Append(":SortRank, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":CreatedBy, ");
            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(":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(":Rel", DbType.String, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = rel;

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

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

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

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

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

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

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

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

            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     = createdBy.ToString();


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

            return(rowsAffected);
        }
        /// <summary>
        /// Updates a row in the cy_ContentMetaLink table. Returns true if row updated.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="rel"> rel </param>
        /// <param name="href"> href </param>
        /// <param name="hrefLang"> hrefLang </param>
        /// <param name="rev"> rev </param>
        /// <param name="type"> type </param>
        /// <param name="media"> media </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 rel,
            string href,
            string hrefLang,
            string rev,
            string type,
            string media,
            int sortRank,
            DateTime lastModUtc,
            Guid lastModBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE cy_ContentMetaLink ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("Rel = :Rel, ");
            sqlCommand.Append("Href = :Href, ");
            sqlCommand.Append("HrefLang = :HrefLang, ");
            sqlCommand.Append("Rev = :Rev, ");
            sqlCommand.Append("Type = :Type, ");
            sqlCommand.Append("Media = :Media, ");
            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[10];

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

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

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

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

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

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

            arParams[6]           = new SqliteParameter(":Media", DbType.String, 50);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = media;

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

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

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


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

            return(rowsAffected > -1);
        }
        /// <summary>
        /// Inserts a row in the cy_GoogleCheckoutLog 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="notificationType"> notificationType </param>
        /// <param name="rawResponse"> rawResponse </param>
        /// <param name="serialNumber"> serialNumber </param>
        /// <param name="gTimestamp"> gTimestamp </param>
        /// <param name="orderNumber"> orderNumber </param>
        /// <param name="buyerId"> buyerId </param>
        /// <param name="fullfillState"> fullfillState </param>
        /// <param name="financeState"> financeState </param>
        /// <param name="emailListOptIn"> emailListOptIn </param>
        /// <param name="avsResponse"> avsResponse </param>
        /// <param name="cvnResponse"> cvnResponse </param>
        /// <param name="authExpDate"> authExpDate </param>
        /// <param name="authAmt"> authAmt </param>
        /// <param name="discountTotal"> discountTotal </param>
        /// <param name="shippingTotal"> shippingTotal </param>
        /// <param name="taxTotal"> taxTotal </param>
        /// <param name="orderTotal"> orderTotal </param>
        /// <param name="latestChgAmt"> latestChgAmt </param>
        /// <param name="totalChgAmt"> totalChgAmt </param>
        /// <param name="latestRefundAmt"> latestRefundAmt </param>
        /// <param name="totalRefundAmt"> totalRefundAmt </param>
        /// <param name="latestChargeback"> latestChargeback </param>
        /// <param name="totalChargeback"> totalChargeback </param>
        /// <param name="cartXml"> cartXml </param>
        /// <returns>int</returns>
        public static int Create(
            Guid rowGuid,
            DateTime createdUtc,
            Guid siteGuid,
            Guid userGuid,
            Guid storeGuid,
            Guid cartGuid,
            string notificationType,
            string rawResponse,
            string serialNumber,
            DateTime gTimestamp,
            string orderNumber,
            string buyerId,
            string fullfillState,
            string financeState,
            bool emailListOptIn,
            string avsResponse,
            string cvnResponse,
            DateTime authExpDate,
            decimal authAmt,
            decimal discountTotal,
            decimal shippingTotal,
            decimal taxTotal,
            decimal orderTotal,
            decimal latestChgAmt,
            decimal totalChgAmt,
            decimal latestRefundAmt,
            decimal totalRefundAmt,
            decimal latestChargeback,
            decimal totalChargeback,
            string cartXml,
            string providerName)
        {
            #region Bit Conversion

            int intEmailListOptIn;
            if (emailListOptIn)
            {
                intEmailListOptIn = 1;
            }
            else
            {
                intEmailListOptIn = 0;
            }


            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_GoogleCheckoutLog (");
            sqlCommand.Append("RowGuid, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("StoreGuid, ");
            sqlCommand.Append("CartGuid, ");
            sqlCommand.Append("NotificationType, ");
            sqlCommand.Append("RawResponse, ");
            sqlCommand.Append("SerialNumber, ");
            sqlCommand.Append("GTimestamp, ");
            sqlCommand.Append("OrderNumber, ");
            sqlCommand.Append("BuyerId, ");
            sqlCommand.Append("FullfillState, ");
            sqlCommand.Append("FinanceState, ");
            sqlCommand.Append("EmailListOptIn, ");
            sqlCommand.Append("AvsResponse, ");
            sqlCommand.Append("CvnResponse, ");
            sqlCommand.Append("AuthExpDate, ");
            sqlCommand.Append("AuthAmt, ");
            sqlCommand.Append("DiscountTotal, ");
            sqlCommand.Append("ShippingTotal, ");
            sqlCommand.Append("TaxTotal, ");
            sqlCommand.Append("OrderTotal, ");
            sqlCommand.Append("LatestChgAmt, ");
            sqlCommand.Append("TotalChgAmt, ");
            sqlCommand.Append("LatestRefundAmt, ");
            sqlCommand.Append("TotalRefundAmt, ");
            sqlCommand.Append("LatestChargeback, ");
            sqlCommand.Append("TotalChargeback, ");
            sqlCommand.Append("CartXml, ");
            sqlCommand.Append("ProviderName )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":RowGuid, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":UserGuid, ");
            sqlCommand.Append(":StoreGuid, ");
            sqlCommand.Append(":CartGuid, ");
            sqlCommand.Append(":NotificationType, ");
            sqlCommand.Append(":RawResponse, ");
            sqlCommand.Append(":SerialNumber, ");
            sqlCommand.Append(":GTimestamp, ");
            sqlCommand.Append(":OrderNumber, ");
            sqlCommand.Append(":BuyerId, ");
            sqlCommand.Append(":FullfillState, ");
            sqlCommand.Append(":FinanceState, ");
            sqlCommand.Append(":EmailListOptIn, ");
            sqlCommand.Append(":AvsResponse, ");
            sqlCommand.Append(":CvnResponse, ");
            sqlCommand.Append(":AuthExpDate, ");
            sqlCommand.Append(":AuthAmt, ");
            sqlCommand.Append(":DiscountTotal, ");
            sqlCommand.Append(":ShippingTotal, ");
            sqlCommand.Append(":TaxTotal, ");
            sqlCommand.Append(":OrderTotal, ");
            sqlCommand.Append(":LatestChgAmt, ");
            sqlCommand.Append(":TotalChgAmt, ");
            sqlCommand.Append(":LatestRefundAmt, ");
            sqlCommand.Append(":TotalRefundAmt, ");
            sqlCommand.Append(":LatestChargeback, ");
            sqlCommand.Append(":TotalChargeback, ");
            sqlCommand.Append(":CartXml, ");
            sqlCommand.Append(":ProviderName )");
            sqlCommand.Append(";");

            SqliteParameter[] arParams = new SqliteParameter[31];

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

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

            arParams[8]           = new SqliteParameter(":SerialNumber", DbType.String, 50);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = serialNumber;

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

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

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

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

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

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

            arParams[15]           = new SqliteParameter(":AvsResponse", DbType.String, 5);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = avsResponse;

            arParams[16]           = new SqliteParameter(":CvnResponse", DbType.String, 5);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = cvnResponse;

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

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

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

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

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

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

            arParams[23]           = new SqliteParameter(":LatestChgAmt", DbType.Decimal);
            arParams[23].Direction = ParameterDirection.Input;
            arParams[23].Value     = latestChgAmt;

            arParams[24]           = new SqliteParameter(":TotalChgAmt", DbType.Decimal);
            arParams[24].Direction = ParameterDirection.Input;
            arParams[24].Value     = totalChgAmt;

            arParams[25]           = new SqliteParameter(":LatestRefundAmt", DbType.Decimal);
            arParams[25].Direction = ParameterDirection.Input;
            arParams[25].Value     = latestRefundAmt;

            arParams[26]           = new SqliteParameter(":TotalRefundAmt", DbType.Decimal);
            arParams[26].Direction = ParameterDirection.Input;
            arParams[26].Value     = totalRefundAmt;

            arParams[27]           = new SqliteParameter(":LatestChargeback", DbType.Decimal);
            arParams[27].Direction = ParameterDirection.Input;
            arParams[27].Value     = latestChargeback;

            arParams[28]           = new SqliteParameter(":TotalChargeback", DbType.Decimal);
            arParams[28].Direction = ParameterDirection.Input;
            arParams[28].Value     = totalChargeback;

            arParams[29]           = new SqliteParameter(":CartXml", DbType.Object);
            arParams[29].Direction = ParameterDirection.Input;
            arParams[29].Value     = cartXml;

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


            int rowsAffected = 0;
            rowsAffected = SqliteHelper.ExecuteNonQuery(GetConnectionString(), sqlCommand.ToString(), arParams);
            return(rowsAffected);
        }
        /// <summary>
        /// Inserts a row in the cy_ContentStyle table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="name"> name </param>
        /// <param name="element"> element </param>
        /// <param name="cssClass"> cssClass </param>
        /// <param name="skinName"> skinName </param>
        /// <param name="isActive"> isActive </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdBy"> createdBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            string name,
            string element,
            string cssClass,
            string skinName,
            bool isActive,
            DateTime createdUtc,
            Guid createdBy)
        {
            #region Bit Conversion

            int intIsActive = 0;
            if (isActive)
            {
                intIsActive = 1;
            }

            #endregion

            StringBuilder sqlCommand = new StringBuilder();
            sqlCommand.Append("INSERT INTO cy_ContentStyle (");
            sqlCommand.Append("Guid, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("Name, ");
            sqlCommand.Append("Element, ");
            sqlCommand.Append("CssClass, ");
            sqlCommand.Append("SkinName, ");
            sqlCommand.Append("IsActive, ");
            sqlCommand.Append("CreatedUtc, ");
            sqlCommand.Append("LastModUtc, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("LastModBy )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":Guid, ");
            sqlCommand.Append(":SiteGuid, ");
            sqlCommand.Append(":Name, ");
            sqlCommand.Append(":Element, ");
            sqlCommand.Append(":CssClass, ");
            sqlCommand.Append(":SkinName, ");
            sqlCommand.Append(":IsActive, ");
            sqlCommand.Append(":CreatedUtc, ");
            sqlCommand.Append(":LastModUtc, ");
            sqlCommand.Append(":CreatedBy, ");
            sqlCommand.Append(":LastModBy )");
            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(":Name", DbType.String, 100);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = name;

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

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

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

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

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

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

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

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

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

            return(rowsAffected);
        }