Example #1
0
        public int RoleCreate(
            Guid roleGuid,
            Guid siteGuid,
            int siteId,
            string roleName)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_Roles ");
            sqlCommand.Append("(");
            sqlCommand.Append("SiteID, ");
            sqlCommand.Append("RoleName, ");
            sqlCommand.Append("DisplayName, ");
            sqlCommand.Append("SiteGuid, ");
            sqlCommand.Append("RoleGuid ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@SiteID, ");
            sqlCommand.Append("@RoleName, ");
            sqlCommand.Append("@DisplayName, ");
            sqlCommand.Append("@SiteGuid, ");
            sqlCommand.Append("@RoleGuid ");
            sqlCommand.Append(")");

            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[5];

            arParams[0]       = new SqlCeParameter("@SiteID", SqlDbType.Int);
            arParams[0].Value = siteId;

            arParams[1]       = new SqlCeParameter("@RoleName", SqlDbType.NVarChar, 50);
            arParams[1].Value = roleName;

            arParams[2]       = new SqlCeParameter("@DisplayName", SqlDbType.NVarChar, 50);
            arParams[2].Value = roleName;

            arParams[3]       = new SqlCeParameter("@SiteGuid", SqlDbType.UniqueIdentifier);
            arParams[3].Value = siteGuid;

            arParams[4]       = new SqlCeParameter("@RoleGuid", SqlDbType.UniqueIdentifier);
            arParams[4].Value = roleGuid;

            int newId = Convert.ToInt32(AdoHelper.DoInsertGetIdentitiy(
                                            connectionString,
                                            CommandType.Text,
                                            sqlCommand.ToString(),
                                            arParams));

            return(newId);
        }
Example #2
0
        public int Create(
            int siteId,
            string userId,
            string claimType,
            string claimValue)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            SqlCeParameter[] arParams = new SqlCeParameter[4];

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

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

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

            arParams[3]       = new SqlCeParameter("@SiteId", SqlDbType.Int);
            arParams[3].Value = siteId;

            int newId = Convert.ToInt32(AdoHelper.DoInsertGetIdentitiy(
                                            connectionString,
                                            CommandType.Text,
                                            sqlCommand.ToString(),
                                            arParams));

            return(newId);
        }
        /// <summary>
        /// Inserts a row in the mp_SystemLog table. Returns new integer id.
        /// </summary>
        /// <param name="logDate"> logDate </param>
        /// <param name="ipAddress"> ipAddress </param>
        /// <param name="culture"> culture </param>
        /// <param name="url"> url </param>
        /// <param name="shortUrl"> shortUrl </param>
        /// <param name="thread"> thread </param>
        /// <param name="logLevel"> logLevel </param>
        /// <param name="logger"> logger </param>
        /// <param name="message"> message </param>
        /// <returns>int</returns>
        public int Create(
            DateTime logDate,
            string ipAddress,
            string culture,
            string url,
            string shortUrl,
            string thread,
            string logLevel,
            string logger,
            string message)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_SystemLog ");
            sqlCommand.Append("(");
            sqlCommand.Append("LogDate, ");
            sqlCommand.Append("IpAddress, ");
            sqlCommand.Append("Culture, ");
            sqlCommand.Append("Url, ");
            sqlCommand.Append("ShortUrl, ");
            sqlCommand.Append("Thread, ");
            sqlCommand.Append("LogLevel, ");
            sqlCommand.Append("Logger, ");
            sqlCommand.Append("Message ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@LogDate, ");
            sqlCommand.Append("@IpAddress, ");
            sqlCommand.Append("@Culture, ");
            sqlCommand.Append("@Url, ");
            sqlCommand.Append("@ShortUrl, ");
            sqlCommand.Append("@Thread, ");
            sqlCommand.Append("@LogLevel, ");
            sqlCommand.Append("@Logger, ");
            sqlCommand.Append("@Message ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[9];

            arParams[0]       = new SqlCeParameter("@LogDate", SqlDbType.DateTime);
            arParams[0].Value = logDate;

            arParams[1]       = new SqlCeParameter("@IpAddress", SqlDbType.NVarChar, 50);
            arParams[1].Value = ipAddress;

            arParams[2]       = new SqlCeParameter("@Culture", SqlDbType.NVarChar, 10);
            arParams[2].Value = culture;

            arParams[3]       = new SqlCeParameter("@Url", SqlDbType.NText);
            arParams[3].Value = url;

            arParams[4]       = new SqlCeParameter("@ShortUrl", SqlDbType.NVarChar, 255);
            arParams[4].Value = shortUrl;

            arParams[5]       = new SqlCeParameter("@Thread", SqlDbType.NVarChar, 255);
            arParams[5].Value = thread;

            arParams[6]       = new SqlCeParameter("@LogLevel", SqlDbType.NVarChar, 20);
            arParams[6].Value = logLevel;

            arParams[7]       = new SqlCeParameter("@Logger", SqlDbType.NVarChar, 255);
            arParams[7].Value = logger;

            arParams[8]       = new SqlCeParameter("@Message", SqlDbType.NText);
            arParams[8].Value = message;

            int newId = Convert.ToInt32(AdoHelper.DoInsertGetIdentitiy(
                                            connectionString,
                                            CommandType.Text,
                                            sqlCommand.ToString(),
                                            arParams));

            return(newId);
        }