Exemple #1
0
        /// <summary>
        /// Inserts a row in the mp_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 mp_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(";");

            MySqlParameter[] arParams = new MySqlParameter[15];

            arParams[0]           = new MySqlParameter("?Guid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new MySqlParameter("?SiteGuid", MySqlDbType.VarChar, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new MySqlParameter("?FeatureGuid", MySqlDbType.VarChar, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = featureGuid.ToString();

            arParams[3]           = new MySqlParameter("?ModuleGuid", MySqlDbType.VarChar, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = moduleGuid.ToString();

            arParams[4]           = new MySqlParameter("?SpecialGuid1", MySqlDbType.VarChar, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = specialGuid1.ToString();

            arParams[5]           = new MySqlParameter("?SpecialGuid2", MySqlDbType.VarChar, 36);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = specialGuid2.ToString();

            arParams[6]           = new MySqlParameter("?Name", MySqlDbType.VarChar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = name;

            arParams[7]           = new MySqlParameter("?Subject", MySqlDbType.VarChar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = subject;

            arParams[8]           = new MySqlParameter("?TextBody", MySqlDbType.LongText);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = textBody;

            arParams[9]           = new MySqlParameter("?HtmlBody", MySqlDbType.LongText);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = htmlBody;

            arParams[10]           = new MySqlParameter("?HasHtml", MySqlDbType.Int32);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = intHasHtml;

            arParams[11]           = new MySqlParameter("?IsEditable", MySqlDbType.Int32);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = intIsEditable;

            arParams[12]           = new MySqlParameter("?CreatedUtc", MySqlDbType.DateTime);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = createdUtc;

            arParams[13]           = new MySqlParameter("?LastModUtc", MySqlDbType.DateTime);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = createdUtc;

            arParams[14]           = new MySqlParameter("?LastModBy", MySqlDbType.VarChar, 36);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = lastModBy.ToString();

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Exemple #2
0
        /// <summary>
        /// Inserts a row in the mp_Tag 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="tag"> tag </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdBy"> createdBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid vocabularyGuid,
            Guid siteGuid,
            Guid featureGuid,
            Guid moduleGuid,
            string tag,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_tag (");
            sqlCommand.Append("guid, ");
            sqlCommand.Append("vocabularyguid, ");
            sqlCommand.Append("siteguid, ");
            sqlCommand.Append("featureguid, ");
            sqlCommand.Append("moduleguid, ");
            sqlCommand.Append("tag, ");
            sqlCommand.Append("createdutc, ");
            sqlCommand.Append("createdby, ");
            sqlCommand.Append("modifiedutc, ");
            sqlCommand.Append("modifiedby, ");
            sqlCommand.Append("itemcount )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":guid, ");
            sqlCommand.Append(":vocabularyguid, ");
            sqlCommand.Append(":siteguid, ");
            sqlCommand.Append(":featureguid, ");
            sqlCommand.Append(":moduleguid, ");
            sqlCommand.Append(":tag, ");
            sqlCommand.Append(":createdutc, ");
            sqlCommand.Append(":createdby, ");
            sqlCommand.Append(":modifiedutc, ");
            sqlCommand.Append(":modifiedby, ");
            sqlCommand.Append(":itemcount ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[11];

            arParams[0]           = new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new NpgsqlParameter("vocabularyguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = vocabularyGuid.ToString();

            arParams[2]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = siteGuid.ToString();

            arParams[3]           = new NpgsqlParameter("featureguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = featureGuid.ToString();

            arParams[4]           = new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = moduleGuid.ToString();

            arParams[5]           = new NpgsqlParameter("tag", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = tag;

            arParams[6]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = createdUtc;

            arParams[7]           = new NpgsqlParameter("createdby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = createdBy.ToString();

            arParams[8]           = new NpgsqlParameter("modifiedutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdUtc;

            arParams[9]           = new NpgsqlParameter("modifiedby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = createdBy.ToString();

            arParams[10]           = new NpgsqlParameter("itemcount", NpgsqlTypes.NpgsqlDbType.Integer);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = 0;

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Exemple #3
0
        /// <summary>
        /// Inserts a row in the mp_ContentMeta table. Returns rows affected count.
        /// </summary>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid contentGuid,
            string name,
            string nameProperty,
            string scheme,
            string langCode,
            string dir,
            string metaContent,
            string contentProperty,
            int sortRank,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_contentmeta (");

            sqlCommand.Append("guid, ");
            sqlCommand.Append("siteguid, ");
            sqlCommand.Append("moduleguid, ");
            sqlCommand.Append("contentguid, ");
            sqlCommand.Append("name, ");
            sqlCommand.Append("nameproperty, ");
            sqlCommand.Append("scheme, ");
            sqlCommand.Append("langcode, ");
            sqlCommand.Append("dir, ");
            sqlCommand.Append("metacontent, ");
            sqlCommand.Append("contentproperty, ");
            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(":nameproperty, ");
            sqlCommand.Append(":scheme, ");
            sqlCommand.Append(":langcode, ");
            sqlCommand.Append(":dir, ");
            sqlCommand.Append(":metacontent, ");
            sqlCommand.Append(":metacontentproperty, ");
            sqlCommand.Append(":sortrank, ");
            sqlCommand.Append(":createdutc, ");
            sqlCommand.Append(":createdby, ");
            sqlCommand.Append(":lastmodutc, ");
            sqlCommand.Append(":lastmodby ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[16];

            arParams[0]           = new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = moduleGuid.ToString();

            arParams[3]           = new NpgsqlParameter("contentguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = contentGuid.ToString();

            arParams[4]           = new NpgsqlParameter("name", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = name;

            arParams[5]           = new NpgsqlParameter("scheme", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = scheme;

            arParams[6]           = new NpgsqlParameter("langcode", NpgsqlTypes.NpgsqlDbType.Varchar, 10);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = langCode;

            arParams[7]           = new NpgsqlParameter("dir", NpgsqlTypes.NpgsqlDbType.Varchar, 3);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = dir;

            arParams[8]           = new NpgsqlParameter("metacontent", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = metaContent;

            arParams[9]           = new NpgsqlParameter("sortrank", NpgsqlTypes.NpgsqlDbType.Integer);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = sortRank;

            arParams[10]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = createdUtc;

            arParams[11]           = new NpgsqlParameter("createdby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = createdBy.ToString();

            arParams[12]           = new NpgsqlParameter("lastmodutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = createdUtc;

            arParams[13]           = new NpgsqlParameter("lastmodby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = createdBy.ToString();

            arParams[14]           = new NpgsqlParameter("nameproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = name;

            arParams[15]           = new NpgsqlParameter("contentproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = name;

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Exemple #4
0
        /// <summary>
        /// Updates a row in the mp_TaxRate table. Returns true if row updated.
        /// </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>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 mp_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(";");

            MySqlParameter[] arParams = new MySqlParameter[8];

            arParams[0]           = new MySqlParameter("?Guid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new MySqlParameter("?GeoZoneGuid", MySqlDbType.VarChar, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = geoZoneGuid.ToString();

            arParams[2]           = new MySqlParameter("?TaxClassGuid", MySqlDbType.VarChar, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = taxClassGuid.ToString();

            arParams[3]           = new MySqlParameter("?Priority", MySqlDbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = priority;

            arParams[4]           = new MySqlParameter("?Rate", MySqlDbType.Decimal);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = rate;

            arParams[5]           = new MySqlParameter("?Description", MySqlDbType.VarChar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = description;

            arParams[6]           = new MySqlParameter("?LastModified", MySqlDbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = lastModified;

            arParams[7]           = new MySqlParameter("?ModifiedBy", MySqlDbType.VarChar, 36);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = modifiedBy.ToString();

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
        /// <summary>
        /// Updates a row in the mp_ContentTemplate table. Returns true if row updated.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="title"> title </param>
        /// <param name="imageFileName"> imageFileName </param>
        /// <param name="description"> description </param>
        /// <param name="body"> body </param>
        /// <param name="allowedRoles"> allowedRoles </param>
        /// <param name="lastModUser"> lastModUser </param>
        /// <param name="lastModUtc"> lastModUtc </param>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            Guid siteGuid,
            string title,
            string imageFileName,
            string description,
            string body,
            string allowedRoles,
            Guid lastModUser,
            DateTime lastModUtc)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_contenttemplate ");
            sqlCommand.Append("SET  ");
            sqlCommand.Append("siteguid = :siteguid, ");
            sqlCommand.Append("title = :title, ");
            sqlCommand.Append("imagefilename = :imagefilename, ");
            sqlCommand.Append("description = :description, ");
            sqlCommand.Append("body = :body, ");
            sqlCommand.Append("allowedroles = :allowedroles, ");
            sqlCommand.Append("lastmoduser = :lastmoduser, ");
            sqlCommand.Append("lastmodutc = :lastmodutc ");

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

            NpgsqlParameter[] arParams = new NpgsqlParameter[9];

            arParams[0]           = new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new NpgsqlParameter("title", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = title;

            arParams[3]           = new NpgsqlParameter("imagefilename", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = imageFileName;

            arParams[4]           = new NpgsqlParameter("description", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = description;

            arParams[5]           = new NpgsqlParameter("body", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = body;

            arParams[6]           = new NpgsqlParameter("allowedroles", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = allowedRoles;

            arParams[7]           = new NpgsqlParameter("lastmoduser", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = lastModUser.ToString();

            arParams[8]           = new NpgsqlParameter("lastmodutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModUtc;


            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
        ///// <summary>
        ///// Gets the connection string.
        ///// </summary>
        ///// <returns></returns>
        //private static string GetConnectionString()
        //{
        //    return ConfigurationManager.AppSettings["MSSQLConnectionString"];

        //}


        /// <summary>
        /// Inserts a row in the mp_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)
        {
            SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_GoogleCheckoutLog_Insert", 31);

            sph.DefineSqlParameter("@RowGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, rowGuid);
            sph.DefineSqlParameter("@CreatedUtc", SqlDbType.DateTime, ParameterDirection.Input, createdUtc);
            sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
            sph.DefineSqlParameter("@UserGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, userGuid);
            sph.DefineSqlParameter("@StoreGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, storeGuid);
            sph.DefineSqlParameter("@CartGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, cartGuid);
            sph.DefineSqlParameter("@NotificationType", SqlDbType.NVarChar, 255, ParameterDirection.Input, notificationType);
            sph.DefineSqlParameter("@RawResponse", SqlDbType.NVarChar, -1, ParameterDirection.Input, rawResponse);
            sph.DefineSqlParameter("@SerialNumber", SqlDbType.NVarChar, 50, ParameterDirection.Input, serialNumber);
            sph.DefineSqlParameter("@GTimestamp", SqlDbType.DateTime, ParameterDirection.Input, gTimestamp);
            sph.DefineSqlParameter("@OrderNumber", SqlDbType.NVarChar, 50, ParameterDirection.Input, orderNumber);
            sph.DefineSqlParameter("@BuyerId", SqlDbType.NVarChar, 50, ParameterDirection.Input, buyerId);
            sph.DefineSqlParameter("@FullfillState", SqlDbType.NVarChar, 50, ParameterDirection.Input, fullfillState);
            sph.DefineSqlParameter("@FinanceState", SqlDbType.NVarChar, 50, ParameterDirection.Input, financeState);
            sph.DefineSqlParameter("@EmailListOptIn", SqlDbType.Bit, ParameterDirection.Input, emailListOptIn);
            sph.DefineSqlParameter("@AvsResponse", SqlDbType.NVarChar, 5, ParameterDirection.Input, avsResponse);
            sph.DefineSqlParameter("@CvnResponse", SqlDbType.NVarChar, 5, ParameterDirection.Input, cvnResponse);
            sph.DefineSqlParameter("@AuthExpDate", SqlDbType.DateTime, ParameterDirection.Input, authExpDate);
            sph.DefineSqlParameter("@AuthAmt", SqlDbType.Decimal, ParameterDirection.Input, authAmt);
            sph.DefineSqlParameter("@DiscountTotal", SqlDbType.Decimal, ParameterDirection.Input, discountTotal);
            sph.DefineSqlParameter("@ShippingTotal", SqlDbType.Decimal, ParameterDirection.Input, shippingTotal);
            sph.DefineSqlParameter("@TaxTotal", SqlDbType.Decimal, ParameterDirection.Input, taxTotal);
            sph.DefineSqlParameter("@OrderTotal", SqlDbType.Decimal, ParameterDirection.Input, orderTotal);
            sph.DefineSqlParameter("@LatestChgAmt", SqlDbType.Decimal, ParameterDirection.Input, latestChgAmt);
            sph.DefineSqlParameter("@TotalChgAmt", SqlDbType.Decimal, ParameterDirection.Input, totalChgAmt);
            sph.DefineSqlParameter("@LatestRefundAmt", SqlDbType.Decimal, ParameterDirection.Input, latestRefundAmt);
            sph.DefineSqlParameter("@TotalRefundAmt", SqlDbType.Decimal, ParameterDirection.Input, totalRefundAmt);
            sph.DefineSqlParameter("@LatestChargeback", SqlDbType.Decimal, ParameterDirection.Input, latestChargeback);
            sph.DefineSqlParameter("@TotalChargeback", SqlDbType.Decimal, ParameterDirection.Input, totalChargeback);
            sph.DefineSqlParameter("@CartXml", SqlDbType.NVarChar, -1, ParameterDirection.Input, cartXml);
            sph.DefineSqlParameter("@ProviderName", SqlDbType.NVarChar, 255, ParameterDirection.Input, providerName);
            int rowsAffected = sph.ExecuteNonQuery();

            return(rowsAffected);
        }
        /// <summary>
        /// Inserts a row in the mp_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,
            string contentTitle,
            long contentLength,
            string contentType,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_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("contentTitle, ");
            sqlCommand.Append("contentlength, ");
            sqlCommand.Append("contenttype, ");
            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(":contentTitle, ");
            sqlCommand.Append(":contentlength, ");
            sqlCommand.Append(":contenttype, ");
            sqlCommand.Append(":createdutc, ");
            sqlCommand.Append(":createdby ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[13];

            arParams[0]           = new NpgsqlParameter("rowguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = rowGuid.ToString();

            arParams[1]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = moduleGuid.ToString();

            arParams[3]           = new NpgsqlParameter("itemguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = itemGuid.ToString();

            arParams[4]           = new NpgsqlParameter("specialguid1", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = specialGuid1.ToString();

            arParams[5]           = new NpgsqlParameter("specialguid2", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = specialGuid2.ToString();

            arParams[6]           = new NpgsqlParameter("serverfilename", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = serverFileName;

            arParams[7]           = new NpgsqlParameter("filename", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = fileName;

            arParams[8]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdUtc;

            arParams[9]           = new NpgsqlParameter("createdby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = createdBy.ToString();

            arParams[10]           = new NpgsqlParameter("contentlength", NpgsqlTypes.NpgsqlDbType.Bigint);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = contentLength;

            arParams[11]           = new NpgsqlParameter("contenttype", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = contentType;

            arParams[12]           = new NpgsqlParameter("contenttitle", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = contentTitle;

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Exemple #8
0
        public static bool Create(
            Guid guid,
            Guid siteGuid,
            Guid featureGuid,
            Guid moduleGuid,
            string tagText,
            DateTime createdUtc,
            Guid createdBy,
            Guid vocabularyGuid
            )
        {
            const string sqlCommand =
                @"INSERT INTO mp_tag (
					guid,
					siteguid,
					featureguid,
					moduleguid,
					tag,
					createdutc,
					createdby,
					modifiedutc,
					modifiedby,
					itemcount,
					vocabularyguid
				)

				VALUES (
					:guid,
					:siteguid,
					:featureguid,
					:moduleguid,
					:tag,
					:createdutc,
					:createdby,
					:modifiedutc,
					:modifiedby,
					:itemcount,
					:vocabularyguid
				);"                ;

            var arParams = new List <NpgsqlParameter>
            {
                new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = guid.ToString()
                },
                new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = siteGuid.ToString()
                },
                new NpgsqlParameter("featureguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = featureGuid.ToString()
                },
                new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = moduleGuid.ToString()
                },
                new NpgsqlParameter("tag", NpgsqlTypes.NpgsqlDbType.Varchar, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = tagText
                },
                new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdUtc
                },
                new NpgsqlParameter("createdby", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdBy.ToString()
                },
                new NpgsqlParameter("modifiedutc", NpgsqlTypes.NpgsqlDbType.Timestamp)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdUtc
                },
                new NpgsqlParameter("modifiedby", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = createdBy.ToString()
                },
                new NpgsqlParameter("itemcount", NpgsqlTypes.NpgsqlDbType.Integer)
                {
                    Direction = ParameterDirection.Input,
                    Value     = 0
                },
                new NpgsqlParameter("vocabularyguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = vocabularyGuid.ToString()
                }
            }.ToArray();

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams
                );

            return(rowsAffected > -1);
        }
Exemple #9
0
        public static bool UpdateModuleDefinitionSettingById(
            int id,
            int moduleDefId,
            string resourceFile,
            string groupName,
            string settingName,
            string settingValue,
            string controlType,
            string regexValidationExpression,
            string controlSrc,
            string helpKey,
            int sortOrder,
            string attributes,
            string options)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            MySqlParameter[] arParams = new MySqlParameter[13];

            arParams[0]           = new MySqlParameter("?ID", MySqlDbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = id;

            arParams[1]           = new MySqlParameter("?ModuleDefID", MySqlDbType.Int32);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = moduleDefId;

            arParams[2]           = new MySqlParameter("?SettingName", MySqlDbType.VarChar, 50);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = settingName;

            arParams[3]           = new MySqlParameter("?SettingValue", MySqlDbType.Text);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = settingValue;

            arParams[4]           = new MySqlParameter("?ControlType", MySqlDbType.VarChar, 50);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = controlType;

            arParams[5]           = new MySqlParameter("?RegexValidationExpression", MySqlDbType.Text);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = regexValidationExpression;

            arParams[6]           = new MySqlParameter("?ResourceFile", MySqlDbType.VarChar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = resourceFile;

            arParams[7]           = new MySqlParameter("?ControlSrc", MySqlDbType.VarChar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = controlSrc;

            arParams[8]           = new MySqlParameter("?HelpKey", MySqlDbType.VarChar, 255);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = helpKey;

            arParams[9]           = new MySqlParameter("?SortOrder", MySqlDbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = sortOrder;

            arParams[10]           = new MySqlParameter("?GroupName", MySqlDbType.VarChar, 255);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = groupName;

            arParams[11]           = new MySqlParameter("?Attributes", MySqlDbType.Text);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = attributes;

            arParams[12]           = new MySqlParameter("?Options", MySqlDbType.Text);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = options;

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > 0);
        }
Exemple #10
0
        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,
            string viewRoles
            )
        {
            StringBuilder sqlCommand = new StringBuilder();

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

            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("folderguid = :folderguid, ");
            sqlCommand.Append("description = :description, ");
            sqlCommand.Append("viewroles = :viewroles ");
            sqlCommand.Append("WHERE  ");
            sqlCommand.Append("itemid = :itemid ");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[13];

            arParams[0] = new NpgsqlParameter("itemid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = itemId
            };

            arParams[1] = new NpgsqlParameter("moduleid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = moduleId
            };

            arParams[2] = new NpgsqlParameter("uploaduserid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = uploadUserId
            };

            arParams[3] = new NpgsqlParameter("friendlyname", NpgsqlTypes.NpgsqlDbType.Varchar, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = friendlyName
            };

            arParams[4] = new NpgsqlParameter("originalfilename", NpgsqlTypes.NpgsqlDbType.Varchar, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = originalFileName
            };

            arParams[5] = new NpgsqlParameter("serverfilename", NpgsqlTypes.NpgsqlDbType.Varchar, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = serverFileName
            };

            arParams[6] = new NpgsqlParameter("sizeinkb", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = sizeInKB
            };

            arParams[7] = new NpgsqlParameter("uploaddate", NpgsqlTypes.NpgsqlDbType.Timestamp)
            {
                Direction = ParameterDirection.Input,
                Value     = uploadDate
            };

            arParams[8] = new NpgsqlParameter("folderid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = folderId
            };

            arParams[9] = new NpgsqlParameter("userguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = userGuid.ToString()
            };

            arParams[10] = new NpgsqlParameter("folderguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = folderGuid.ToString()
            };

            arParams[11] = new NpgsqlParameter("description", NpgsqlTypes.NpgsqlDbType.Text)
            {
                Direction = ParameterDirection.Input,
                Value     = description
            };

            arParams[12] = new NpgsqlParameter("viewroles", NpgsqlTypes.NpgsqlDbType.Text)
            {
                Direction = ParameterDirection.Input,
                Value     = viewRoles
            };

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Exemple #11
0
        public static bool AddHistory(
            Guid itemGuid,
            Guid moduleGuid,
            Guid userGuid,
            int itemId,
            int moduleId,
            string friendlyName,
            string originalFileName,
            string serverFileName,
            int sizeInKB,
            DateTime uploadDate,
            int uploadUserId,
            DateTime archiveDate,
            string viewRoles
            )
        {
            NpgsqlParameter[] arParams = new NpgsqlParameter[13];

            arParams[0] = new NpgsqlParameter("itemid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = itemId
            };

            arParams[1] = new NpgsqlParameter("moduleid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = moduleId
            };

            arParams[2] = new NpgsqlParameter("friendlyname", NpgsqlTypes.NpgsqlDbType.Text, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = friendlyName
            };

            arParams[3] = new NpgsqlParameter("originalfilename", NpgsqlTypes.NpgsqlDbType.Text, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = originalFileName
            };

            arParams[4] = new NpgsqlParameter("serverfilename", NpgsqlTypes.NpgsqlDbType.Text, 50)
            {
                Direction = ParameterDirection.Input,
                Value     = serverFileName
            };

            arParams[5] = new NpgsqlParameter("sizeinkb", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = sizeInKB
            };

            arParams[6] = new NpgsqlParameter("uploaddate", NpgsqlTypes.NpgsqlDbType.Timestamp)
            {
                Direction = ParameterDirection.Input,
                Value     = uploadDate
            };

            arParams[7] = new NpgsqlParameter("uploaduserid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = uploadUserId
            };

            arParams[8] = new NpgsqlParameter("archivedate", NpgsqlTypes.NpgsqlDbType.Timestamp)
            {
                Direction = ParameterDirection.Input,
                Value     = archiveDate
            };

            arParams[9] = new NpgsqlParameter("itemguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = itemGuid.ToString()
            };

            arParams[10] = new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = moduleGuid.ToString()
            };

            arParams[11] = new NpgsqlParameter("userguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = userGuid.ToString()
            };

            arParams[12] = new NpgsqlParameter("viewroles", NpgsqlTypes.NpgsqlDbType.Text)
            {
                Direction = ParameterDirection.Input,
                Value     = viewRoles
            };

            int newID = Convert.ToInt32(NpgsqlHelper.ExecuteScalar(
                                            ConnectionString.GetWriteConnectionString(),
                                            CommandType.StoredProcedure,
                                            "mp_sharedfileshistory_insert(:itemid,:moduleid,:friendlyname,:originalfilename,:serverfilename,:sizeinkb,:uploaddate,:uploaduserid,:archivedate,:itemguid,:moduleguid,:userguid,:viewroles)",
                                            arParams));

            return(newID > 0);
        }
Exemple #12
0
        /// <summary>
        /// Add a new folder to the module.
        /// </summary>
        /// <param name="folderGuid">folderGuid</param>
        /// <param name="moduleGuid">moduleGuid</param>
        /// <param name="parentGuid">parentGuid</param>
        /// <param name="moduleId">moduleId</param>
        /// <param name="folderName">folderName</param>
        /// <param name="parentId">parentId</param>
        /// <param name="viewRoles">viewRoles</param>
        /// <returns></returns>
        public static int AddSharedFileFolder(
            Guid folderGuid,
            Guid moduleGuid,
            Guid parentGuid,
            int moduleId,
            string folderName,
            int parentId,
            string viewRoles
            )
        {
            string sqlCommand = @"
				mp_sharedfilefolders_insert(
					:moduleid,
					:foldername,
					:parentid,
					:moduleguid,
					:folderguid,
					:parentguid,
					:viewroles
				)"                ;

            var arParams = new List <NpgsqlParameter>
            {
                new NpgsqlParameter("moduleid", NpgsqlTypes.NpgsqlDbType.Integer)
                {
                    Direction = ParameterDirection.Input,
                    Value     = moduleId
                },
                new NpgsqlParameter("foldername", NpgsqlTypes.NpgsqlDbType.Text, 255)
                {
                    Direction = ParameterDirection.Input,
                    Value     = folderName
                },
                new NpgsqlParameter("parentid", NpgsqlTypes.NpgsqlDbType.Integer)
                {
                    Direction = ParameterDirection.Input,
                    Value     = parentId
                },
                new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = moduleGuid.ToString()
                },
                new NpgsqlParameter("folderguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = folderGuid.ToString()
                },
                new NpgsqlParameter("parentguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
                {
                    Direction = ParameterDirection.Input,
                    Value     = parentGuid.ToString()
                },
                new NpgsqlParameter("viewroles", NpgsqlTypes.NpgsqlDbType.Text)
                {
                    Direction = ParameterDirection.Input,
                    Value     = viewRoles
                }
            };

            int newID = Convert.ToInt32(
                NpgsqlHelper.ExecuteScalar(
                    ConnectionString.GetWriteConnectionString(),
                    CommandType.StoredProcedure,
                    sqlCommand,
                    arParams.ToArray()
                    )
                );

            return(newID);
        }
Exemple #13
0
        public static int AddSharedFile(
            Guid itemGuid,
            Guid moduleGuid,
            Guid userGuid,
            Guid folderGuid,
            int moduleId,
            int uploadUserId,
            string friendlyName,
            string originalFileName,
            string serverFileName,
            int sizeInKB,
            DateTime uploadDate,
            int folderId,
            string description,
            string viewRoles
            )
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_sharedfiles (");
            sqlCommand.Append("moduleid, ");
            sqlCommand.Append("uploaduserid, ");
            sqlCommand.Append("friendlyname, ");
            sqlCommand.Append("originalfilename, ");
            sqlCommand.Append("serverfilename, ");
            sqlCommand.Append("sizeinkb, ");
            sqlCommand.Append("uploaddate, ");
            sqlCommand.Append("folderid, ");
            sqlCommand.Append("itemguid, ");
            sqlCommand.Append("moduleguid, ");
            sqlCommand.Append("userguid, ");
            sqlCommand.Append("folderguid, ");
            sqlCommand.Append("downloadcount, ");
            sqlCommand.Append("description, ");
            sqlCommand.Append("viewroles)");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":moduleid, ");
            sqlCommand.Append(":uploaduserid, ");
            sqlCommand.Append(":friendlyname, ");
            sqlCommand.Append(":originalfilename, ");
            sqlCommand.Append(":serverfilename, ");
            sqlCommand.Append(":sizeinkb, ");
            sqlCommand.Append(":uploaddate, ");
            sqlCommand.Append(":folderid, ");
            sqlCommand.Append(":itemguid, ");
            sqlCommand.Append(":moduleguid, ");
            sqlCommand.Append(":userguid, ");
            sqlCommand.Append(":folderguid, ");
            sqlCommand.Append("0, ");
            sqlCommand.Append(":description, ");
            sqlCommand.Append(":viewroles)");
            sqlCommand.Append(";");
            sqlCommand.Append(" SELECT CURRVAL('mp_sharedfiles_itemid_seq');");

            NpgsqlParameter[] arParams = new NpgsqlParameter[14];

            arParams[0] = new NpgsqlParameter("moduleid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = moduleId
            };

            arParams[1] = new NpgsqlParameter("uploaduserid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = uploadUserId
            };

            arParams[2] = new NpgsqlParameter("friendlyname", NpgsqlTypes.NpgsqlDbType.Varchar, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = friendlyName
            };

            arParams[3] = new NpgsqlParameter("originalfilename", NpgsqlTypes.NpgsqlDbType.Varchar, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = originalFileName
            };

            arParams[4] = new NpgsqlParameter("serverfilename", NpgsqlTypes.NpgsqlDbType.Varchar, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = serverFileName
            };

            arParams[5] = new NpgsqlParameter("sizeinkb", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = sizeInKB
            };

            arParams[6] = new NpgsqlParameter("uploaddate", NpgsqlTypes.NpgsqlDbType.Timestamp)
            {
                Direction = ParameterDirection.Input,
                Value     = uploadDate
            };

            arParams[7] = new NpgsqlParameter("folderid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = folderId
            };

            arParams[8] = new NpgsqlParameter("itemguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = itemGuid.ToString()
            };

            arParams[9] = new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = moduleGuid.ToString()
            };

            arParams[10] = new NpgsqlParameter("userguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = userGuid.ToString()
            };

            arParams[11] = new NpgsqlParameter("folderguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = folderGuid.ToString()
            };

            arParams[12] = new NpgsqlParameter("description", NpgsqlTypes.NpgsqlDbType.Text)
            {
                Direction = ParameterDirection.Input,
                Value     = description
            };

            arParams[13] = new NpgsqlParameter("viewroles", NpgsqlTypes.NpgsqlDbType.Text)
            {
                Direction = ParameterDirection.Input,
                Value     = viewRoles
            };

            int newID = Convert.ToInt32(NpgsqlHelper.ExecuteScalar(
                                            ConnectionString.GetWriteConnectionString(),
                                            CommandType.Text,
                                            sqlCommand.ToString(),
                                            arParams));

            return(newID);
        }
Exemple #14
0
        /// <summary>
        /// Update a folder
        /// </summary>
        /// <param name="folderId">folderId</param>
        /// <param name="moduleId">moduleId</param>
        /// <param name="folderName">folderName</param>
        /// <param name="parentId">parentId</param>
        /// <param name="parentGuid">parentGuid</param>
        /// <param name="viewRoles">viewRoles</param>
        /// <returns></returns>
        public static bool UpdateSharedFileFolder(
            int folderId,
            int moduleId,
            string folderName,
            int parentId,
            Guid parentGuid,
            string viewRoles
            )
        {
            string sqlCommand = @"
				mp_sharedfilefolders_update(
					:folderid,
					:moduleid,
					:foldername,
					:parentid,
					:parentguid,
					:viewroles
				)"                ;

            NpgsqlParameter[] arParams = new NpgsqlParameter[6];

            arParams[0] = new NpgsqlParameter("folderid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = folderId
            };

            arParams[1] = new NpgsqlParameter("moduleid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = moduleId
            };

            arParams[2] = new NpgsqlParameter("foldername", NpgsqlTypes.NpgsqlDbType.Text, 255)
            {
                Direction = ParameterDirection.Input,
                Value     = folderName
            };

            arParams[3] = new NpgsqlParameter("parentid", NpgsqlTypes.NpgsqlDbType.Integer)
            {
                Direction = ParameterDirection.Input,
                Value     = parentId
            };

            arParams[4] = new NpgsqlParameter("parentguid", NpgsqlTypes.NpgsqlDbType.Char, 36)
            {
                Direction = ParameterDirection.Input,
                Value     = parentGuid.ToString()
            };

            arParams[5] = new NpgsqlParameter("viewroles", NpgsqlTypes.NpgsqlDbType.Text)
            {
                Direction = ParameterDirection.Input,
                Value     = viewRoles
            };

            int rowsAffected = Convert.ToInt32(NpgsqlHelper.ExecuteScalar(
                                                   ConnectionString.GetWriteConnectionString(),
                                                   CommandType.StoredProcedure,
                                                   sqlCommand,
                                                   arParams));

            return(rowsAffected > -1);
        }
        /// <summary>
        /// Updates a row in the mp_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)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_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(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[9];

            arParams[0]           = new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new NpgsqlParameter("name", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = name;

            arParams[2]           = new NpgsqlParameter("subject", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = subject;

            arParams[3]           = new NpgsqlParameter("textbody", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = textBody;

            arParams[4]           = new NpgsqlParameter("htmlbody", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = htmlBody;

            arParams[5]           = new NpgsqlParameter("hashtml", NpgsqlTypes.NpgsqlDbType.Boolean);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = hasHtml;

            arParams[6]           = new NpgsqlParameter("iseditable", NpgsqlTypes.NpgsqlDbType.Boolean);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = isEditable;

            arParams[7]           = new NpgsqlParameter("lastmodutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = lastModUtc;

            arParams[8]           = new NpgsqlParameter("lastmodby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModBy.ToString();

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
Exemple #16
0
        public static bool UpdateModuleDefinition(
            int moduleDefId,
            string featureName,
            string controlSrc,
            int sortOrder,
            int defaultCacheTime,
            String icon,
            bool isAdmin,
            string resourceFile,
            bool isCacheable,
            bool isSearchable,
            string searchListName,
            bool supportsPageReuse,
            string deleteProvider,
            string partialView,
            string skinFileName)
        {
            int intIsAdmin = 0;

            if (isAdmin)
            {
                intIsAdmin = 1;
            }

            int intIsCacheable = 0;

            if (isCacheable)
            {
                intIsCacheable = 1;
            }

            int intIsSearchable = 0;

            if (isSearchable)
            {
                intIsSearchable = 1;
            }

            int intSupportsPageReuse = 0;

            if (supportsPageReuse)
            {
                intSupportsPageReuse = 1;
            }

            StringBuilder sqlCommand = new StringBuilder();

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

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

            MySqlParameter[] arParams = new MySqlParameter[15];

            arParams[0]           = new MySqlParameter("?ModuleDefID", MySqlDbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleDefId;

            arParams[1]           = new MySqlParameter("?FeatureName", MySqlDbType.VarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = featureName;

            arParams[2]           = new MySqlParameter("?ControlSrc", MySqlDbType.VarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = controlSrc;

            arParams[3]           = new MySqlParameter("?SortOrder", MySqlDbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = sortOrder;

            arParams[4]           = new MySqlParameter("?IsAdmin", MySqlDbType.Int32);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = intIsAdmin;

            arParams[5]           = new MySqlParameter("?Icon", MySqlDbType.VarChar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = icon;

            arParams[6]           = new MySqlParameter("?DefaultCacheTime", MySqlDbType.Int32);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = defaultCacheTime;

            arParams[7]           = new MySqlParameter("?ResourceFile", MySqlDbType.VarChar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = resourceFile;

            arParams[8]           = new MySqlParameter("?IsCacheable", MySqlDbType.Int32);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = intIsCacheable;

            arParams[9]           = new MySqlParameter("?IsSearchable", MySqlDbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = intIsSearchable;

            arParams[10]           = new MySqlParameter("?SearchListName", MySqlDbType.VarChar, 255);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = searchListName;

            arParams[11]           = new MySqlParameter("?SupportsPageReuse", MySqlDbType.Int32);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = intSupportsPageReuse;

            arParams[12]           = new MySqlParameter("?DeleteProvider", MySqlDbType.VarChar, 255);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = deleteProvider;

            arParams[13]           = new MySqlParameter("?PartialView", MySqlDbType.VarChar, 255);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = partialView;

            arParams[14]           = new MySqlParameter("?SkinFileName", MySqlDbType.VarChar, 255);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = skinFileName;

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
        /// <summary>
        /// Inserts a row in the mp_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)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_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(")");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[15];

            arParams[0]           = new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new NpgsqlParameter("featureguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = featureGuid.ToString();

            arParams[3]           = new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = moduleGuid.ToString();

            arParams[4]           = new NpgsqlParameter("specialguid1", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = specialGuid1.ToString();

            arParams[5]           = new NpgsqlParameter("specialguid2", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = specialGuid2.ToString();

            arParams[6]           = new NpgsqlParameter("name", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = name;

            arParams[7]           = new NpgsqlParameter("subject", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = subject;

            arParams[8]           = new NpgsqlParameter("textbody", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = textBody;

            arParams[9]           = new NpgsqlParameter("htmlbody", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = htmlBody;

            arParams[10]           = new NpgsqlParameter("hashtml", NpgsqlTypes.NpgsqlDbType.Boolean);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = hasHtml;

            arParams[11]           = new NpgsqlParameter("iseditable", NpgsqlTypes.NpgsqlDbType.Boolean);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = isEditable;

            arParams[12]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = createdUtc;

            arParams[13]           = new NpgsqlParameter("lastmodutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = createdUtc;

            arParams[14]           = new NpgsqlParameter("lastmodby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = lastModBy.ToString();

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Exemple #18
0
        public static int AddModuleDefinition(
            Guid featureGuid,
            int siteId,
            string featureName,
            string controlSrc,
            int sortOrder,
            int defaultCacheTime,
            String icon,
            bool isAdmin,
            string resourceFile,
            bool isCacheable,
            bool isSearchable,
            string searchListName,
            bool supportsPageReuse,
            string deleteProvider,
            string partialView,
            string skinFileName)
        {
            int intIsAdmin = 0;

            if (isAdmin)
            {
                intIsAdmin = 1;
            }

            int intIsCacheable = 0;

            if (isCacheable)
            {
                intIsCacheable = 1;
            }

            int intIsSearchable = 0;

            if (isSearchable)
            {
                intIsSearchable = 1;
            }

            int intSupportsPageReuse = 0;

            if (supportsPageReuse)
            {
                intSupportsPageReuse = 1;
            }


            StringBuilder sqlCommand = new StringBuilder();

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

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

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

            MySqlParameter[] arParams = new MySqlParameter[16];

            arParams[0]           = new MySqlParameter("?SiteID", MySqlDbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = siteId;

            arParams[1]           = new MySqlParameter("?FeatureName", MySqlDbType.VarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = featureName;

            arParams[2]           = new MySqlParameter("?ControlSrc", MySqlDbType.VarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = controlSrc;

            arParams[3]           = new MySqlParameter("?SortOrder", MySqlDbType.Int32);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = sortOrder;

            arParams[4]           = new MySqlParameter("?IsAdmin", MySqlDbType.Int32);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = intIsAdmin;

            arParams[5]           = new MySqlParameter("?Icon", MySqlDbType.VarChar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = icon;

            arParams[6]           = new MySqlParameter("?DefaultCacheTime", MySqlDbType.Int32);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = defaultCacheTime;

            arParams[7]           = new MySqlParameter("?FeatureGuid", MySqlDbType.VarChar, 36);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = featureGuid;

            arParams[8]           = new MySqlParameter("?ResourceFile", MySqlDbType.VarChar, 255);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = resourceFile;

            arParams[9]           = new MySqlParameter("?IsCacheable", MySqlDbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = intIsCacheable;

            arParams[10]           = new MySqlParameter("?IsSearchable", MySqlDbType.Int32);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = intIsSearchable;

            arParams[11]           = new MySqlParameter("?SearchListName", MySqlDbType.VarChar, 255);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = searchListName;

            arParams[12]           = new MySqlParameter("?SupportsPageReuse", MySqlDbType.Int32);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = intSupportsPageReuse;

            arParams[13]           = new MySqlParameter("?DeleteProvider", MySqlDbType.VarChar, 255);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = deleteProvider;

            arParams[14]           = new MySqlParameter("?PartialView", MySqlDbType.VarChar, 255);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = partialView;

            arParams[15]           = new MySqlParameter("?SkinFileName", MySqlDbType.VarChar, 255);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = skinFileName;

            int newID = -1;

            newID = Convert.ToInt32(
                MySqlHelper.ExecuteScalar(
                    ConnectionString.GetWriteConnectionString(),
                    sqlCommand.ToString(),
                    arParams).ToString());

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

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

                arParams = new MySqlParameter[2];

                arParams[0]           = new MySqlParameter("?SiteID", MySqlDbType.Int32);
                arParams[0].Direction = ParameterDirection.Input;
                arParams[0].Value     = siteId;

                arParams[1]           = new MySqlParameter("?ModuleDefID", MySqlDbType.Int32);
                arParams[1].Direction = ParameterDirection.Input;
                arParams[1].Value     = newID;

                MySqlHelper.ExecuteNonQuery(
                    ConnectionString.GetWriteConnectionString(),
                    sqlCommand.ToString(),
                    arParams);
            }

            return(newID);
        }
Exemple #19
0
        /// <summary>
        /// Inserts a row in the mp_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 mp_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(" );");

            MySqlParameter[] arParams = new MySqlParameter[11];

            arParams[0]           = new MySqlParameter("?LetterGuid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = letterGuid.ToString();

            arParams[1]           = new MySqlParameter("?LetterInfoGuid", MySqlDbType.VarChar, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = letterInfoGuid.ToString();

            arParams[2]           = new MySqlParameter("?Subject", MySqlDbType.VarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = subject;

            arParams[3]           = new MySqlParameter("?HtmlBody", MySqlDbType.LongText);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = htmlBody;

            arParams[4]           = new MySqlParameter("?TextBody", MySqlDbType.LongText);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = textBody;

            arParams[5]           = new MySqlParameter("?CreatedBy", MySqlDbType.VarChar, 36);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = createdBy.ToString();

            arParams[6]           = new MySqlParameter("?CreatedUTC", MySqlDbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = createdUtc;

            arParams[7]           = new MySqlParameter("?LastModBy", MySqlDbType.VarChar, 36);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = lastModBy.ToString();

            arParams[8]           = new MySqlParameter("?LastModUTC", MySqlDbType.DateTime);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModUtc;

            arParams[9]           = new MySqlParameter("?IsApproved", MySqlDbType.Int32);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = intIsApproved;

            arParams[10]           = new MySqlParameter("?ApprovedBy", MySqlDbType.VarChar, 36);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = approvedBy.ToString();

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);
            return(rowsAffected);
        }
Exemple #20
0
        //public static void SyncDefinitions()
        //{
        //    StringBuilder sqlCommand = new StringBuilder();
        //    sqlCommand.Append("UPDATE mp_ModuleSettings ");
        //    sqlCommand.Append("SET ControlSrc = (SELECT mds.ControlSrc ");
        //    sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds  ");
        //    sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
        //    sqlCommand.Append("FROM mp_Modules m ");
        //    sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) ");
        //    sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName LIMIT 1 ) ");
        //    //sqlCommand.Append(" ");
        //    sqlCommand.Append("; ");

        //    MySqlHelper.ExecuteNonQuery(
        //        ConnectionString.GetWriteConnectionString(),
        //        sqlCommand.ToString(),
        //        null);

        //    sqlCommand = new StringBuilder();
        //    sqlCommand.Append("UPDATE mp_ModuleSettings ");
        //    sqlCommand.Append("SET ControlType = (SELECT  mds.ControlType ");
        //    sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds  ");
        //    sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
        //    sqlCommand.Append("FROM mp_Modules m ");
        //    sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) ");
        //    sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName LIMIT 1 ) ");

        //    sqlCommand.Append("; ");

        //    MySqlHelper.ExecuteNonQuery(
        //        ConnectionString.GetWriteConnectionString(),
        //        sqlCommand.ToString(),
        //        null);

        //    sqlCommand = new StringBuilder();
        //    sqlCommand.Append("UPDATE mp_ModuleSettings ");
        //    sqlCommand.Append("SET SortOrder = COALESCE((SELECT mds.SortOrder ");
        //    sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds  ");
        //    sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
        //    sqlCommand.Append("FROM mp_Modules m ");
        //    sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) ");
        //    sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName LIMIT 1 ), 100); ");
        //    sqlCommand.Append(" ");

        //    MySqlHelper.ExecuteNonQuery(
        //        ConnectionString.GetWriteConnectionString(),
        //        sqlCommand.ToString(),
        //        null);

        //    sqlCommand = new StringBuilder();
        //    sqlCommand.Append("UPDATE mp_ModuleSettings ");
        //    sqlCommand.Append("SET HelpKey = (SELECT mds.HelpKey ");
        //    sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds  ");
        //    sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
        //    sqlCommand.Append("FROM mp_Modules m ");
        //    sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) ");
        //    sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName LIMIT 1 ); ");
        //    sqlCommand.Append(" ");

        //    MySqlHelper.ExecuteNonQuery(
        //        ConnectionString.GetWriteConnectionString(),
        //        sqlCommand.ToString(),
        //        null);

        //    sqlCommand = new StringBuilder();
        //    sqlCommand.Append("UPDATE mp_ModuleSettings ");
        //    sqlCommand.Append("SET RegexValidationExpression = (SELECT mds.RegexValidationExpression ");
        //    sqlCommand.Append("FROM mp_ModuleDefinitionSettings mds  ");
        //    sqlCommand.Append("WHERE mds.ModuleDefId IN (SELECT ModuleDefId  ");
        //    sqlCommand.Append("FROM mp_Modules m ");
        //    sqlCommand.Append("WHERE m.ModuleID = mp_ModuleSettings.ModuleID) ");
        //    sqlCommand.Append("AND mds.SettingName = mp_ModuleSettings.SettingName LIMIT 1 ); ");
        //    sqlCommand.Append(" ");

        //    MySqlHelper.ExecuteNonQuery(
        //        ConnectionString.GetWriteConnectionString(),
        //        sqlCommand.ToString(),
        //        null);



        //}


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

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

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

            MySqlParameter[] arParams = new MySqlParameter[3];

            arParams[0]           = new MySqlParameter("?ModuleDefID", MySqlDbType.Int32);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleDefId;

            arParams[1]           = new MySqlParameter("?SettingName", MySqlDbType.VarChar, 50);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = settingName;

            arParams[2]           = new MySqlParameter("?FeatureGuid", MySqlDbType.VarChar, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = featureGuid;

            int count = Convert.ToInt32(MySqlHelper.ExecuteScalar(
                                            ConnectionString.GetReadConnectionString(),
                                            sqlCommand.ToString(),
                                            arParams).ToString());

            sqlCommand = new StringBuilder();

            int rowsAffected = 0;

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

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

                arParams = new MySqlParameter[13];

                arParams[0]           = new MySqlParameter("?ModuleDefID", MySqlDbType.Int32);
                arParams[0].Direction = ParameterDirection.Input;
                arParams[0].Value     = moduleDefId;

                arParams[1]           = new MySqlParameter("?SettingName", MySqlDbType.VarChar, 50);
                arParams[1].Direction = ParameterDirection.Input;
                arParams[1].Value     = settingName;

                arParams[2]           = new MySqlParameter("?SettingValue", MySqlDbType.Text);
                arParams[2].Direction = ParameterDirection.Input;
                arParams[2].Value     = settingValue;

                arParams[3]           = new MySqlParameter("?ControlType", MySqlDbType.VarChar, 50);
                arParams[3].Direction = ParameterDirection.Input;
                arParams[3].Value     = controlType;

                arParams[4]           = new MySqlParameter("?RegexValidationExpression", MySqlDbType.Text);
                arParams[4].Direction = ParameterDirection.Input;
                arParams[4].Value     = regexValidationExpression;

                arParams[5]           = new MySqlParameter("?FeatureGuid", MySqlDbType.VarChar, 36);
                arParams[5].Direction = ParameterDirection.Input;
                arParams[5].Value     = featureGuid;

                arParams[6]           = new MySqlParameter("?ResourceFile", MySqlDbType.VarChar, 255);
                arParams[6].Direction = ParameterDirection.Input;
                arParams[6].Value     = resourceFile;

                arParams[7]           = new MySqlParameter("?ControlSrc", MySqlDbType.VarChar, 255);
                arParams[7].Direction = ParameterDirection.Input;
                arParams[7].Value     = controlSrc;

                arParams[8]           = new MySqlParameter("?HelpKey", MySqlDbType.VarChar, 255);
                arParams[8].Direction = ParameterDirection.Input;
                arParams[8].Value     = helpKey;

                arParams[9]           = new MySqlParameter("?SortOrder", MySqlDbType.Int32);
                arParams[9].Direction = ParameterDirection.Input;
                arParams[9].Value     = sortOrder;

                arParams[10]           = new MySqlParameter("?GroupName", MySqlDbType.VarChar, 255);
                arParams[10].Direction = ParameterDirection.Input;
                arParams[10].Value     = groupName;

                arParams[11]           = new MySqlParameter("?Attributes", MySqlDbType.Text);
                arParams[11].Direction = ParameterDirection.Input;
                arParams[11].Value     = attributes;

                arParams[12]           = new MySqlParameter("?Options", MySqlDbType.Text);
                arParams[12].Direction = ParameterDirection.Input;
                arParams[12].Value     = options;

                rowsAffected = MySqlHelper.ExecuteNonQuery(
                    ConnectionString.GetWriteConnectionString(),
                    sqlCommand.ToString(),
                    arParams);

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

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

                arParams = new MySqlParameter[13];

                arParams[0]           = new MySqlParameter("?ModuleDefID", MySqlDbType.Int32);
                arParams[0].Direction = ParameterDirection.Input;
                arParams[0].Value     = moduleDefId;

                arParams[1]           = new MySqlParameter("?SettingName", MySqlDbType.VarChar, 50);
                arParams[1].Direction = ParameterDirection.Input;
                arParams[1].Value     = settingName;

                arParams[2]           = new MySqlParameter("?SettingValue", MySqlDbType.Text);
                arParams[2].Direction = ParameterDirection.Input;
                arParams[2].Value     = settingValue;

                arParams[3]           = new MySqlParameter("?ControlType", MySqlDbType.VarChar, 50);
                arParams[3].Direction = ParameterDirection.Input;
                arParams[3].Value     = controlType;

                arParams[4]           = new MySqlParameter("?RegexValidationExpression", MySqlDbType.Text);
                arParams[4].Direction = ParameterDirection.Input;
                arParams[4].Value     = regexValidationExpression;

                arParams[5]           = new MySqlParameter("?FeatureGuid", MySqlDbType.VarChar, 36);
                arParams[5].Direction = ParameterDirection.Input;
                arParams[5].Value     = featureGuid;

                arParams[6]           = new MySqlParameter("?ResourceFile", MySqlDbType.VarChar, 255);
                arParams[6].Direction = ParameterDirection.Input;
                arParams[6].Value     = resourceFile;

                arParams[7]           = new MySqlParameter("?ControlSrc", MySqlDbType.VarChar, 255);
                arParams[7].Direction = ParameterDirection.Input;
                arParams[7].Value     = controlSrc;

                arParams[8]           = new MySqlParameter("?HelpKey", MySqlDbType.VarChar, 255);
                arParams[8].Direction = ParameterDirection.Input;
                arParams[8].Value     = helpKey;

                arParams[9]           = new MySqlParameter("?SortOrder", MySqlDbType.Int32);
                arParams[9].Direction = ParameterDirection.Input;
                arParams[9].Value     = sortOrder;

                arParams[10]           = new MySqlParameter("?GroupName", MySqlDbType.VarChar, 255);
                arParams[10].Direction = ParameterDirection.Input;
                arParams[10].Value     = groupName;

                arParams[11]           = new MySqlParameter("?Attributes", MySqlDbType.Text);
                arParams[11].Direction = ParameterDirection.Input;
                arParams[11].Value     = attributes;

                arParams[12]           = new MySqlParameter("?Options", MySqlDbType.Text);
                arParams[12].Direction = ParameterDirection.Input;
                arParams[12].Value     = options;

                rowsAffected = MySqlHelper.ExecuteNonQuery(
                    ConnectionString.GetWriteConnectionString(),
                    sqlCommand.ToString(),
                    arParams);

                return(rowsAffected > 0);
            }
        }
        /// <summary>
        /// Inserts a row in the mp_ContactFormMessage table. Returns rows affected count.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="email"> email </param>
        /// <param name="url"> url </param>
        /// <param name="subject"> subject </param>
        /// <param name="message"> message </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdFromIpAddress"> createdFromIpAddress </param>
        /// <param name="userGuid"> userGuid </param>
        /// <returns>int</returns>
        public static int Create(
            Guid rowGuid,
            Guid siteGuid,
            Guid moduleGuid,
            string email,
            string url,
            string subject,
            string message,
            DateTime createdUtc,
            string createdFromIpAddress,
            Guid userGuid)
        {
            NpgsqlParameter[] arParams = new NpgsqlParameter[10];

            arParams[0]           = new NpgsqlParameter("rowguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = rowGuid.ToString();

            arParams[1]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new NpgsqlParameter("moduleguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = moduleGuid.ToString();

            arParams[3]           = new NpgsqlParameter("email", NpgsqlTypes.NpgsqlDbType.Varchar, 100);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = email;

            arParams[4]           = new NpgsqlParameter("url", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = url;

            arParams[5]           = new NpgsqlParameter("subject", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = subject;

            arParams[6]           = new NpgsqlParameter("message", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = message;

            arParams[7]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = createdUtc;

            arParams[8]           = new NpgsqlParameter("createdfromipaddress", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdFromIpAddress;

            arParams[9]           = new NpgsqlParameter("userguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = userGuid.ToString();

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_contactformmessage (");
            sqlCommand.Append("rowguid, ");
            sqlCommand.Append("siteguid, ");
            sqlCommand.Append("moduleguid, ");
            sqlCommand.Append("email, ");
            sqlCommand.Append("url, ");
            sqlCommand.Append("subject, ");
            sqlCommand.Append("message, ");
            sqlCommand.Append("createdutc, ");
            sqlCommand.Append("createdfromipaddress, ");
            sqlCommand.Append("userguid )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":rowguid, ");
            sqlCommand.Append(":siteguid, ");
            sqlCommand.Append(":moduleguid, ");
            sqlCommand.Append(":email, ");
            sqlCommand.Append(":url, ");
            sqlCommand.Append(":subject, ");
            sqlCommand.Append(":message, ");
            sqlCommand.Append(":createdutc, ");
            sqlCommand.Append(":createdfromipaddress, ");
            sqlCommand.Append(":userguid ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(ConnectionString.GetWriteConnectionString(),
                                                            CommandType.Text,
                                                            sqlCommand.ToString(),
                                                            arParams);


            return(rowsAffected);
        }
Exemple #22
0
        /// <summary>
        /// Inserts a row in the mp_EmailSendLog table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="specialGuid1"> specialGuid1 </param>
        /// <param name="specialGuid2"> specialGuid2 </param>
        /// <param name="toAddress"> toAddress </param>
        /// <param name="ccAddress"> ccAddress </param>
        /// <param name="bccAddress"> bccAddress </param>
        /// <param name="subject"> subject </param>
        /// <param name="textBody"> textBody </param>
        /// <param name="htmlBody"> htmlBody </param>
        /// <param name="type"> type </param>
        /// <param name="sentUtc"> sentUtc </param>
        /// <param name="fromAddress"> fromAddress </param>
        /// <param name="replyTo"> replyTo </param>
        /// <param name="userGuid"> userGuid </param>
        /// <returns>int</returns>
        public static void Create(
            Guid guid,
            Guid siteGuid,
            Guid moduleGuid,
            Guid specialGuid1,
            Guid specialGuid2,
            string toAddress,
            string ccAddress,
            string bccAddress,
            string subject,
            string textBody,
            string htmlBody,
            string type,
            DateTime sentUtc,
            string fromAddress,
            string replyTo,
            Guid userGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            MySqlParameter[] arParams = new MySqlParameter[16];

            arParams[0]           = new MySqlParameter("?Guid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new MySqlParameter("?SiteGuid", MySqlDbType.VarChar, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new MySqlParameter("?ModuleGuid", MySqlDbType.VarChar, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = moduleGuid.ToString();

            arParams[3]           = new MySqlParameter("?SpecialGuid1", MySqlDbType.VarChar, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = specialGuid1.ToString();

            arParams[4]           = new MySqlParameter("?SpecialGuid2", MySqlDbType.VarChar, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = specialGuid2.ToString();

            arParams[5]           = new MySqlParameter("?ToAddress", MySqlDbType.VarChar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = toAddress;

            arParams[6]           = new MySqlParameter("?CcAddress", MySqlDbType.VarChar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = ccAddress;

            arParams[7]           = new MySqlParameter("?BccAddress", MySqlDbType.VarChar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = bccAddress;

            arParams[8]           = new MySqlParameter("?Subject", MySqlDbType.VarChar, 255);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = subject;

            arParams[9]           = new MySqlParameter("?TextBody", MySqlDbType.LongText);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = textBody;

            arParams[10]           = new MySqlParameter("?HtmlBody", MySqlDbType.LongText);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = htmlBody;

            arParams[11]           = new MySqlParameter("?Type", MySqlDbType.VarChar, 50);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = type;

            arParams[12]           = new MySqlParameter("?SentUtc", MySqlDbType.DateTime);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = sentUtc;

            arParams[13]           = new MySqlParameter("?FromAddress", MySqlDbType.VarChar, 100);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = fromAddress;

            arParams[14]           = new MySqlParameter("?ReplyTo", MySqlDbType.VarChar, 100);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = replyTo;

            arParams[15]           = new MySqlParameter("?UserGuid", MySqlDbType.VarChar, 36);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = userGuid.ToString();

            MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);
        }
Exemple #23
0
        /// <summary>
        /// Inserts a row in the mp_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 mp_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(";");

            MySqlParameter[] arParams = new MySqlParameter[11];

            arParams[0]           = new MySqlParameter("?Guid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new MySqlParameter("?SiteGuid", MySqlDbType.VarChar, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new MySqlParameter("?GeoZoneGuid", MySqlDbType.VarChar, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = geoZoneGuid.ToString();

            arParams[3]           = new MySqlParameter("?TaxClassGuid", MySqlDbType.VarChar, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = taxClassGuid.ToString();

            arParams[4]           = new MySqlParameter("?Priority", MySqlDbType.Int32);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = priority;

            arParams[5]           = new MySqlParameter("?Rate", MySqlDbType.Decimal);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = rate;

            arParams[6]           = new MySqlParameter("?Description", MySqlDbType.VarChar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = description;

            arParams[7]           = new MySqlParameter("?Created", MySqlDbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = created;

            arParams[8]           = new MySqlParameter("?CreatedBy", MySqlDbType.VarChar, 36);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdBy.ToString();

            arParams[9]           = new MySqlParameter("?LastModified", MySqlDbType.DateTime);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = lastModified;

            arParams[10]           = new MySqlParameter("?ModifiedBy", MySqlDbType.VarChar, 36);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = modifiedBy.ToString();

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
        /// <summary>
        /// Inserts a row in the mp_ContentRating table. Returns rows affected count.
        /// </summary>
        /// <param name="rowGuid"> rowGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="contentGuid"> contentGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="emailAddress"> emailAddress </param>
        /// <param name="rating"> rating </param>
        /// <param name="comments"> comments </param>
        /// <param name="ipAddress"> ipAddress </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <returns>int</returns>
        public static int Create(
            Guid rowGuid,
            Guid siteGuid,
            Guid contentGuid,
            Guid userGuid,
            string emailAddress,
            int rating,
            string comments,
            string ipAddress,
            DateTime createdUtc)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_contentrating (");
            sqlCommand.Append("rowguid, ");
            sqlCommand.Append("siteguid, ");
            sqlCommand.Append("contentguid, ");
            sqlCommand.Append("userguid, ");
            sqlCommand.Append("emailaddress, ");
            sqlCommand.Append("rating, ");
            sqlCommand.Append("comments, ");
            sqlCommand.Append("ipaddress, ");
            sqlCommand.Append("createdutc, ");
            sqlCommand.Append("lastmodutc )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":rowguid, ");
            sqlCommand.Append(":siteguid, ");
            sqlCommand.Append(":contentguid, ");
            sqlCommand.Append(":userguid, ");
            sqlCommand.Append(":emailaddress, ");
            sqlCommand.Append(":rating, ");
            sqlCommand.Append(":comments, ");
            sqlCommand.Append(":ipaddress, ");
            sqlCommand.Append(":createdutc, ");
            sqlCommand.Append(":createdutc ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[9];

            arParams[0]           = new NpgsqlParameter("rowguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = rowGuid.ToString();

            arParams[1]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new NpgsqlParameter("contentguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = contentGuid.ToString();

            arParams[3]           = new NpgsqlParameter("userguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = userGuid.ToString();

            arParams[4]           = new NpgsqlParameter("emailaddress", NpgsqlTypes.NpgsqlDbType.Varchar, 100);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = emailAddress;

            arParams[5]           = new NpgsqlParameter("rating", NpgsqlTypes.NpgsqlDbType.Integer);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = rating;

            arParams[6]           = new NpgsqlParameter("comments", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = comments;

            arParams[7]           = new NpgsqlParameter("ipaddress", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = ipAddress;

            arParams[8]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdUtc;

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(ConnectionString.GetWriteConnectionString(),
                                                            CommandType.Text,
                                                            sqlCommand.ToString(),
                                                            arParams);

            return(rowsAffected);
        }
        /// <summary>
        /// Inserts a row in the mp_ContentTemplate table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="title"> title </param>
        /// <param name="imageFileName"> imageFileName </param>
        /// <param name="description"> description </param>
        /// <param name="body"> body </param>
        /// <param name="allowedRoles"> allowedRoles </param>
        /// <param name="createdByUser"> createdByUser </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid siteGuid,
            string title,
            string imageFileName,
            string description,
            string body,
            string allowedRoles,
            Guid createdByUser,
            DateTime createdUtc)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_contenttemplate (");
            sqlCommand.Append("guid, ");
            sqlCommand.Append("siteguid, ");
            sqlCommand.Append("title, ");
            sqlCommand.Append("imagefilename, ");
            sqlCommand.Append("description, ");
            sqlCommand.Append("body, ");
            sqlCommand.Append("allowedroles, ");
            sqlCommand.Append("createdbyuser, ");
            sqlCommand.Append("lastmoduser, ");
            sqlCommand.Append("createdutc, ");
            sqlCommand.Append("lastmodutc )");

            sqlCommand.Append(" VALUES (");
            sqlCommand.Append(":guid, ");
            sqlCommand.Append(":siteguid, ");
            sqlCommand.Append(":title, ");
            sqlCommand.Append(":imagefilename, ");
            sqlCommand.Append(":description, ");
            sqlCommand.Append(":body, ");
            sqlCommand.Append(":allowedroles, ");
            sqlCommand.Append(":createdbyuser, ");
            sqlCommand.Append(":lastmoduser, ");
            sqlCommand.Append(":createdutc, ");
            sqlCommand.Append(":lastmodutc ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[11];

            arParams[0]           = new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = siteGuid.ToString();

            arParams[2]           = new NpgsqlParameter("title", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = title;

            arParams[3]           = new NpgsqlParameter("imagefilename", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = imageFileName;

            arParams[4]           = new NpgsqlParameter("description", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = description;

            arParams[5]           = new NpgsqlParameter("body", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = body;

            arParams[6]           = new NpgsqlParameter("allowedroles", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = allowedRoles;

            arParams[7]           = new NpgsqlParameter("createdbyuser", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = createdByUser.ToString();

            arParams[8]           = new NpgsqlParameter("lastmoduser", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdByUser.ToString();

            arParams[9]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = createdUtc;

            arParams[10]           = new NpgsqlParameter("lastmodutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = createdUtc;

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Exemple #26
0
        /// <summary>
        /// Inserts a row in the mp_Category table. Returns rows affected count.
        /// </summary>
        /// <param name="guid"> guid </param>
        /// <param name="parentGuid"> parentGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="featureGuid"> featureGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="category"> category </param>
        /// <param name="description"> description </param>
        /// <param name="createdUtc"> createdUtc </param>
        /// <param name="createdBy"> createdBy </param>
        /// <returns>int</returns>
        public static int Create(
            Guid guid,
            Guid parentGuid,
            Guid siteGuid,
            Guid featureGuid,
            Guid moduleGuid,
            string category,
            string description,
            DateTime createdUtc,
            Guid createdBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            MySqlParameter[] arParams = new MySqlParameter[12];

            arParams[0]           = new MySqlParameter("?Guid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new MySqlParameter("?ParentGuid", MySqlDbType.VarChar, 36);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = parentGuid.ToString();

            arParams[2]           = new MySqlParameter("?SiteGuid", MySqlDbType.VarChar, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = siteGuid.ToString();

            arParams[3]           = new MySqlParameter("?FeatureGuid", MySqlDbType.VarChar, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = featureGuid.ToString();

            arParams[4]           = new MySqlParameter("?ModuleGuid", MySqlDbType.VarChar, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = moduleGuid.ToString();

            arParams[5]           = new MySqlParameter("?Category", MySqlDbType.VarChar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = category;

            arParams[6]           = new MySqlParameter("?Description", MySqlDbType.Text);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = description;

            arParams[7]           = new MySqlParameter("?ItemCount", MySqlDbType.Int32);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = 0;

            arParams[8]           = new MySqlParameter("?CreatedUtc", MySqlDbType.DateTime);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdUtc;

            arParams[9]           = new MySqlParameter("?CreatedBy", MySqlDbType.VarChar, 36);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = createdBy.ToString();

            arParams[10]           = new MySqlParameter("?ModifiedUtc", MySqlDbType.DateTime);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = createdUtc;

            arParams[11]           = new MySqlParameter("?ModifiedBy", MySqlDbType.VarChar, 36);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = createdBy.ToString();

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected);
        }
Exemple #27
0
        /// <summary>
        /// Updates a row in the mp_ContentMeta table. Returns true if row updated.
        /// </summary>
        /// <returns>bool</returns>
        public static bool Update(
            Guid guid,
            string name,
            string nameProperty,
            string scheme,
            string langCode,
            string dir,
            string metaContent,
            string contentProperty,
            int sortRank,
            DateTime lastModUtc,
            Guid lastModBy)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

            sqlCommand.Append("name = :name, ");
            sqlCommand.Append("nameproperty = :nameproperty, ");
            sqlCommand.Append("scheme = :scheme, ");
            sqlCommand.Append("langcode = :langcode, ");
            sqlCommand.Append("dir = :dir, ");
            sqlCommand.Append("metacontent = :metacontent, ");
            sqlCommand.Append("contentproperty = :contentproperty, ");
            sqlCommand.Append("sortrank = :sortrank, ");
            sqlCommand.Append("lastmodutc = :lastmodutc, ");
            sqlCommand.Append("lastmodby = :lastmodby ");

            sqlCommand.Append("WHERE  ");

            sqlCommand.Append("guid = :guid ");
            sqlCommand.Append(";");

            NpgsqlParameter[] arParams = new NpgsqlParameter[11];

            arParams[0]           = new NpgsqlParameter("guid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new NpgsqlParameter("name", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = name;

            arParams[2]           = new NpgsqlParameter("scheme", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = scheme;

            arParams[3]           = new NpgsqlParameter("langcode", NpgsqlTypes.NpgsqlDbType.Varchar, 10);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = langCode;

            arParams[4]           = new NpgsqlParameter("dir", NpgsqlTypes.NpgsqlDbType.Varchar, 3);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = dir;

            arParams[5]           = new NpgsqlParameter("metacontent", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = metaContent;

            arParams[6]           = new NpgsqlParameter("sortrank", NpgsqlTypes.NpgsqlDbType.Integer);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = sortRank;

            arParams[7]           = new NpgsqlParameter("lastmodutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = lastModUtc;

            arParams[8]           = new NpgsqlParameter("lastmodby", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModBy.ToString();

            arParams[9]           = new NpgsqlParameter("nameproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = name;

            arParams[10]           = new NpgsqlParameter("contentproperty", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = name;

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                CommandType.Text,
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }
        public static int Create(
            Guid siteGuid,
            String siteName,
            String skin,
            String logo,
            String icon,
            bool allowNewRegistration,
            bool allowUserSkins,
            bool allowPageSkins,
            bool allowHideMenuOnPages,
            bool useSecureRegistration,
            bool useSslOnAllPages,
            String defaultPageKeywords,
            String defaultPageDescription,
            String defaultPageEncoding,
            String defaultAdditionalMetaTags,
            bool isServerAdminSite,
            bool useLdapAuth,
            bool autoCreateLdapUserOnFirstLogin,
            String ldapServer,
            int ldapPort,
            String ldapDomain,
            String ldapRootDN,
            String ldapUserDNKey,
            bool allowUserFullNameChange,
            bool useEmailForLogin,
            bool reallyDeleteUsers,
            String editorSkin,
            String defaultFriendlyUrlPattern,
            bool enableMyPageFeature,
            string editorProvider,
            string datePickerProvider,
            string captchaProvider,
            string recaptchaPrivateKey,
            string recaptchaPublicKey,
            string wordpressApiKey,
            string windowsLiveAppId,
            string windowsLiveKey,
            bool allowOpenIdAuth,
            bool allowWindowsLiveAuth,
            string gmapApiKey,
            string apiKeyExtra1,
            string apiKeyExtra2,
            string apiKeyExtra3,
            string apiKeyExtra4,
            string apiKeyExtra5,
            bool disableDbAuth)
        {
            SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Sites_Insert", 46);

            sph.DefineSqlParameter("@SiteName", SqlDbType.NVarChar, 128, ParameterDirection.Input, siteName);
            sph.DefineSqlParameter("@Skin", SqlDbType.NVarChar, 100, ParameterDirection.Input, skin);
            sph.DefineSqlParameter("@Logo", SqlDbType.NVarChar, 50, ParameterDirection.Input, logo);
            sph.DefineSqlParameter("@Icon", SqlDbType.NVarChar, 50, ParameterDirection.Input, icon);
            sph.DefineSqlParameter("@AllowUserSkins", SqlDbType.Bit, ParameterDirection.Input, allowUserSkins);
            sph.DefineSqlParameter("@AllowNewRegistration", SqlDbType.Bit, ParameterDirection.Input, allowNewRegistration);
            sph.DefineSqlParameter("@UseSecureRegistration", SqlDbType.Bit, ParameterDirection.Input, useSecureRegistration);
            sph.DefineSqlParameter("@UseSSLOnAllPages", SqlDbType.Bit, ParameterDirection.Input, useSslOnAllPages);
            sph.DefineSqlParameter("@DefaultPageKeywords", SqlDbType.NVarChar, 255, ParameterDirection.Input, defaultPageKeywords);
            sph.DefineSqlParameter("@DefaultPageDescription", SqlDbType.NVarChar, 255, ParameterDirection.Input, defaultPageDescription);
            sph.DefineSqlParameter("@DefaultPageEncoding", SqlDbType.NVarChar, 255, ParameterDirection.Input, defaultPageEncoding);
            sph.DefineSqlParameter("@DefaultAdditionalMetaTags", SqlDbType.NVarChar, 255, ParameterDirection.Input, defaultAdditionalMetaTags);
            sph.DefineSqlParameter("@IsServerAdminSite", SqlDbType.Bit, ParameterDirection.Input, isServerAdminSite);
            sph.DefineSqlParameter("@AllowPageSkins", SqlDbType.Bit, ParameterDirection.Input, allowPageSkins);
            sph.DefineSqlParameter("@AllowHideMenuOnPages", SqlDbType.Bit, ParameterDirection.Input, allowHideMenuOnPages);
            sph.DefineSqlParameter("@UseLdapAuth", SqlDbType.Bit, ParameterDirection.Input, useLdapAuth);
            sph.DefineSqlParameter("@AutoCreateLDAPUserOnFirstLogin", SqlDbType.Bit, ParameterDirection.Input, autoCreateLdapUserOnFirstLogin);
            sph.DefineSqlParameter("@LdapServer", SqlDbType.NVarChar, 255, ParameterDirection.Input, ldapServer);
            sph.DefineSqlParameter("@LdapPort", SqlDbType.Int, ParameterDirection.Input, ldapPort);
            sph.DefineSqlParameter("@LdapDomain", SqlDbType.NVarChar, 255, ParameterDirection.Input, ldapDomain);
            sph.DefineSqlParameter("@LdapRootDN", SqlDbType.NVarChar, 255, ParameterDirection.Input, ldapRootDN);
            sph.DefineSqlParameter("@LdapUserDNKey", SqlDbType.NVarChar, 10, ParameterDirection.Input, ldapUserDNKey);
            sph.DefineSqlParameter("@AllowUserFullNameChange", SqlDbType.Bit, ParameterDirection.Input, allowUserFullNameChange);
            sph.DefineSqlParameter("@UseEmailForLogin", SqlDbType.Bit, ParameterDirection.Input, useEmailForLogin);
            sph.DefineSqlParameter("@ReallyDeleteUsers", SqlDbType.Bit, ParameterDirection.Input, reallyDeleteUsers);
            sph.DefineSqlParameter("@EditorSkin", SqlDbType.NVarChar, 50, ParameterDirection.Input, editorSkin);
            sph.DefineSqlParameter("@DefaultFriendlyUrlPatternEnum", SqlDbType.NVarChar, 50, ParameterDirection.Input, defaultFriendlyUrlPattern);
            sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
            sph.DefineSqlParameter("@EnableMyPageFeature", SqlDbType.Bit, ParameterDirection.Input, enableMyPageFeature);
            sph.DefineSqlParameter("@EditorProvider", SqlDbType.NVarChar, 255, ParameterDirection.Input, editorProvider);
            sph.DefineSqlParameter("@DatePickerProvider", SqlDbType.NVarChar, 255, ParameterDirection.Input, datePickerProvider);
            sph.DefineSqlParameter("@CaptchaProvider", SqlDbType.NVarChar, 255, ParameterDirection.Input, captchaProvider);
            sph.DefineSqlParameter("@RecaptchaPrivateKey", SqlDbType.NVarChar, 255, ParameterDirection.Input, recaptchaPrivateKey);
            sph.DefineSqlParameter("@RecaptchaPublicKey", SqlDbType.NVarChar, 255, ParameterDirection.Input, recaptchaPublicKey);
            sph.DefineSqlParameter("@WordpressAPIKey", SqlDbType.NVarChar, 255, ParameterDirection.Input, wordpressApiKey);
            sph.DefineSqlParameter("@WindowsLiveAppID", SqlDbType.NVarChar, 255, ParameterDirection.Input, windowsLiveAppId);
            sph.DefineSqlParameter("@WindowsLiveKey", SqlDbType.NVarChar, 255, ParameterDirection.Input, windowsLiveKey);
            sph.DefineSqlParameter("@AllowOpenIDAuth", SqlDbType.Bit, ParameterDirection.Input, allowOpenIdAuth);
            sph.DefineSqlParameter("@AllowWindowsLiveAuth", SqlDbType.Bit, ParameterDirection.Input, allowWindowsLiveAuth);

            sph.DefineSqlParameter("@GmapApiKey", SqlDbType.NVarChar, 255, ParameterDirection.Input, gmapApiKey);
            sph.DefineSqlParameter("@ApiKeyExtra1", SqlDbType.NVarChar, 255, ParameterDirection.Input, apiKeyExtra1);
            sph.DefineSqlParameter("@ApiKeyExtra2", SqlDbType.NVarChar, 255, ParameterDirection.Input, apiKeyExtra2);
            sph.DefineSqlParameter("@ApiKeyExtra3", SqlDbType.NVarChar, 255, ParameterDirection.Input, apiKeyExtra3);
            sph.DefineSqlParameter("@ApiKeyExtra4", SqlDbType.NVarChar, 255, ParameterDirection.Input, apiKeyExtra4);
            sph.DefineSqlParameter("@ApiKeyExtra5", SqlDbType.NVarChar, 255, ParameterDirection.Input, apiKeyExtra5);
            sph.DefineSqlParameter("@DisableDbAuth", SqlDbType.Bit, ParameterDirection.Input, disableDbAuth);

            int newID = Convert.ToInt32(sph.ExecuteScalar());

            return(newID);
        }
Exemple #29
0
        /// <summary>
        /// Updates a row in the mp_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)
        {
            NpgsqlParameter[] arParams = new NpgsqlParameter[23];

            arParams[0]           = new NpgsqlParameter("rowguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = rowGuid.ToString();

            arParams[1]           = new NpgsqlParameter("createdutc", NpgsqlTypes.NpgsqlDbType.Timestamp);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = createdUtc;

            arParams[2]           = new NpgsqlParameter("siteguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = siteGuid.ToString();

            arParams[3]           = new NpgsqlParameter("userguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = userGuid.ToString();

            arParams[4]           = new NpgsqlParameter("storeguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = storeGuid.ToString();

            arParams[5]           = new NpgsqlParameter("cartguid", NpgsqlTypes.NpgsqlDbType.Char, 36);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = cartGuid.ToString();

            arParams[6]           = new NpgsqlParameter("requesttype", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = requestType;

            arParams[7]           = new NpgsqlParameter("apiversion", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = apiVersion;

            arParams[8]           = new NpgsqlParameter("rawresponse", NpgsqlTypes.NpgsqlDbType.Text);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = rawResponse;

            arParams[9]           = new NpgsqlParameter("token", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = token;

            arParams[10]           = new NpgsqlParameter("payerid", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = payerId;

            arParams[11]           = new NpgsqlParameter("transactionid", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = transactionId;

            arParams[12]           = new NpgsqlParameter("paymenttype", NpgsqlTypes.NpgsqlDbType.Varchar, 10);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = paymentType;

            arParams[13]           = new NpgsqlParameter("paymentstatus", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = paymentStatus;

            arParams[14]           = new NpgsqlParameter("pendingreason", NpgsqlTypes.NpgsqlDbType.Varchar, 255);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = pendingReason;

            arParams[15]           = new NpgsqlParameter("reasoncode", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = reasonCode;

            arParams[16]           = new NpgsqlParameter("currencycode", NpgsqlTypes.NpgsqlDbType.Varchar, 50);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = currencyCode;

            arParams[17]           = new NpgsqlParameter("exchangerate", NpgsqlTypes.NpgsqlDbType.Numeric);
            arParams[17].Direction = ParameterDirection.Input;
            arParams[17].Value     = exchangeRate;

            arParams[18]           = new NpgsqlParameter("carttotal", NpgsqlTypes.NpgsqlDbType.Numeric);
            arParams[18].Direction = ParameterDirection.Input;
            arParams[18].Value     = cartTotal;

            arParams[19]           = new NpgsqlParameter("paypalamt", NpgsqlTypes.NpgsqlDbType.Numeric);
            arParams[19].Direction = ParameterDirection.Input;
            arParams[19].Value     = payPalAmt;

            arParams[20]           = new NpgsqlParameter("taxamt", NpgsqlTypes.NpgsqlDbType.Numeric);
            arParams[20].Direction = ParameterDirection.Input;
            arParams[20].Value     = taxAmt;

            arParams[21]           = new NpgsqlParameter("feeamt", NpgsqlTypes.NpgsqlDbType.Numeric);
            arParams[21].Direction = ParameterDirection.Input;
            arParams[21].Value     = feeAmt;

            arParams[22]           = new NpgsqlParameter("settleamt", NpgsqlTypes.NpgsqlDbType.Numeric);
            arParams[22].Direction = ParameterDirection.Input;
            arParams[22].Value     = settleAmt;

            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("UPDATE mp_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(";");

            int rowsAffected = NpgsqlHelper.ExecuteNonQuery(ConnectionString.GetWriteConnectionString(),
                                                            CommandType.Text,
                                                            sqlCommand.ToString(),
                                                            arParams);

            return(rowsAffected > -1);
        }
Exemple #30
0
        /// <summary>
        /// Updates a row in the mp_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 mp_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(";");

            MySqlParameter[] arParams = new MySqlParameter[9];

            arParams[0]           = new MySqlParameter("?Guid", MySqlDbType.VarChar, 36);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = guid.ToString();

            arParams[1]           = new MySqlParameter("?Name", MySqlDbType.VarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = name;

            arParams[2]           = new MySqlParameter("?Subject", MySqlDbType.VarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = subject;

            arParams[3]           = new MySqlParameter("?TextBody", MySqlDbType.LongText);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = textBody;

            arParams[4]           = new MySqlParameter("?HtmlBody", MySqlDbType.LongText);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = htmlBody;

            arParams[5]           = new MySqlParameter("?HasHtml", MySqlDbType.Int32);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = intHasHtml;

            arParams[6]           = new MySqlParameter("?IsEditable", MySqlDbType.Int32);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = intIsEditable;

            arParams[7]           = new MySqlParameter("?LastModUtc", MySqlDbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = lastModUtc;

            arParams[8]           = new MySqlParameter("?LastModBy", MySqlDbType.VarChar, 36);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = lastModBy.ToString();

            int rowsAffected = MySqlHelper.ExecuteNonQuery(
                ConnectionString.GetWriteConnectionString(),
                sqlCommand.ToString(),
                arParams);

            return(rowsAffected > -1);
        }