예제 #1
0
        public static int AddHtmlContent(
            Guid itemGuid,
            Guid moduleGuid,
            int moduleId,
            string title,
            string excerpt,
            string body,
            string moreLink,
            int sortOrder,
            DateTime beginDate,
            DateTime endDate,
            DateTime createdDate,
            int userId,
            Guid userGuid,
            bool excludeFromRecentContent)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[16];

            arParams[0]           = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            arParams[1]           = new SqlCeParameter("@Title", SqlDbType.NVarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = title;

            arParams[2]           = new SqlCeParameter("@Excerpt", SqlDbType.NText);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = excerpt;

            arParams[3]           = new SqlCeParameter("@Body", SqlDbType.NText);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = body;

            arParams[4]           = new SqlCeParameter("@MoreLink", SqlDbType.NVarChar, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = moreLink;

            arParams[5]           = new SqlCeParameter("@SortOrder", SqlDbType.Int);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = sortOrder;

            arParams[6]           = new SqlCeParameter("@BeginDate", SqlDbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = beginDate;

            arParams[7]           = new SqlCeParameter("@EndDate", SqlDbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = endDate;

            arParams[8]           = new SqlCeParameter("@CreatedDate", SqlDbType.DateTime);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = createdDate;

            arParams[9]           = new SqlCeParameter("@UserID", SqlDbType.Int);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = userId;

            arParams[10]           = new SqlCeParameter("@ItemGuid", SqlDbType.UniqueIdentifier);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = itemGuid;

            arParams[11]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = moduleGuid;

            arParams[12]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = userGuid;

            arParams[13]           = new SqlCeParameter("@LastModUserGuid", SqlDbType.UniqueIdentifier);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = userGuid;

            arParams[14]           = new SqlCeParameter("@LastModUtc", SqlDbType.DateTime);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = createdDate;

            arParams[15]           = new SqlCeParameter("@ExcludeFromRecentContent", SqlDbType.Bit);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = excludeFromRecentContent;


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

            return(newId);
        }
예제 #2
0
        /// <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 static 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].Direction = ParameterDirection.Input;
            arParams[0].Value     = logDate;

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

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

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

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

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

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

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

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


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

            return(newId);
        }
예제 #3
0
        /// <summary>
        /// Inserts a row in the mp_FriendlyUrls table. Returns new integer id.
        /// </summary>
        /// <param name="itemGuid"> itemGuid </param>
        /// <param name="siteGuid"> siteGuid </param>
        /// <param name="pageGuid"> pageGuid </param>
        /// <param name="siteID"> siteID </param>
        /// <param name="friendlyUrl"> friendlyUrl </param>
        /// <param name="realUrl"> realUrl </param>
        /// <param name="isPattern"> isPattern </param>
        /// <returns>int</returns>
        public static int AddFriendlyUrl(
            Guid itemGuid,
            Guid siteGuid,
            Guid pageGuid,
            int siteId,
            string friendlyUrl,
            string realUrl,
            bool isPattern)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[7];

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

            arParams[1]           = new SqlCeParameter("@FriendlyUrl", SqlDbType.NVarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = friendlyUrl;

            arParams[2]           = new SqlCeParameter("@RealUrl", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = realUrl;

            arParams[3]           = new SqlCeParameter("@IsPattern", SqlDbType.Bit);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = isPattern;

            arParams[4]           = new SqlCeParameter("@PageGuid", SqlDbType.UniqueIdentifier);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = pageGuid;

            arParams[5]           = new SqlCeParameter("@SiteGuid", SqlDbType.UniqueIdentifier);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = siteGuid;

            arParams[6]           = new SqlCeParameter("@ItemGuid", SqlDbType.UniqueIdentifier);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = itemGuid;


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

            return(newId);
        }
예제 #4
0
        private static bool CreateModuleDefinitionSetting(
            int moduleDefID,
            string groupName,
            string settingName,
            string settingValue,
            string controlType,
            string regexValidationExpression,
            Guid featureGuid,
            string resourceFile,
            string controlSrc,
            int sortOrder,
            string helpKey)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_ModuleDefinitionSettings ");
            sqlCommand.Append("(");
            sqlCommand.Append("ModuleDefID, ");
            sqlCommand.Append("SettingName, ");
            sqlCommand.Append("SettingValue, ");
            sqlCommand.Append("ControlType, ");
            sqlCommand.Append("RegexValidationExpression, ");
            sqlCommand.Append("FeatureGuid, ");
            sqlCommand.Append("ResourceFile, ");
            sqlCommand.Append("ControlSrc, ");
            sqlCommand.Append("SortOrder, ");
            sqlCommand.Append("GroupName, ");
            sqlCommand.Append("HelpKey ");
            sqlCommand.Append(")");

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

            SqlCeParameter[] arParams = new SqlCeParameter[11];

            arParams[0]           = new SqlCeParameter("@ModuleDefID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleDefID;

            arParams[1]           = new SqlCeParameter("@SettingName", SqlDbType.NVarChar, 50);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = settingName;

            arParams[2]           = new SqlCeParameter("@SettingValue", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = settingValue;

            arParams[3]           = new SqlCeParameter("@ControlType", SqlDbType.NVarChar, 50);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = controlType;

            arParams[4]           = new SqlCeParameter("@RegexValidationExpression", SqlDbType.NText);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = regexValidationExpression;

            arParams[5]           = new SqlCeParameter("@FeatureGuid", SqlDbType.UniqueIdentifier);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = featureGuid;

            arParams[6]           = new SqlCeParameter("@ResourceFile", SqlDbType.NVarChar, 255);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = resourceFile;

            arParams[7]           = new SqlCeParameter("@ControlSrc", SqlDbType.NVarChar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = controlSrc;

            arParams[8]           = new SqlCeParameter("@SortOrder", SqlDbType.Int);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = sortOrder;

            arParams[9]           = new SqlCeParameter("@HelpKey", SqlDbType.NVarChar, 255);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = helpKey;

            arParams[10]           = new SqlCeParameter("@GroupName", SqlDbType.NVarChar, 255);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = groupName;


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

            return(newId > -1);
        }
예제 #5
0
        public static int AddLink(
            Guid itemGuid,
            Guid moduleGuid,
            int moduleId,
            string title,
            string url,
            int viewOrder,
            string description,
            DateTime createdDate,
            int createdBy,
            string target,
            Guid userGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_Links ");
            sqlCommand.Append("(");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("Title, ");
            sqlCommand.Append("Url, ");
            sqlCommand.Append("Target, ");
            sqlCommand.Append("ViewOrder, ");
            sqlCommand.Append("Description, ");
            sqlCommand.Append("CreatedDate, ");
            sqlCommand.Append("CreatedBy, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("UserGuid ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@ModuleID, ");
            sqlCommand.Append("@Title, ");
            sqlCommand.Append("@Url, ");
            sqlCommand.Append("@Target, ");
            sqlCommand.Append("@ViewOrder, ");
            sqlCommand.Append("@Description, ");
            sqlCommand.Append("@CreatedDate, ");
            sqlCommand.Append("@CreatedBy, ");
            sqlCommand.Append("@ItemGuid, ");
            sqlCommand.Append("@ModuleGuid, ");
            sqlCommand.Append("@UserGuid ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[11];

            arParams[0]           = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            arParams[1]           = new SqlCeParameter("@Title", SqlDbType.NVarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = title;

            arParams[2]           = new SqlCeParameter("@Url", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = url;

            arParams[3]           = new SqlCeParameter("@Target", SqlDbType.NVarChar, 20);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = target;

            arParams[4]           = new SqlCeParameter("@ViewOrder", SqlDbType.Int);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = viewOrder;

            arParams[5]           = new SqlCeParameter("@Description", SqlDbType.NText);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = description;

            arParams[6]           = new SqlCeParameter("@CreatedDate", SqlDbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = createdDate;

            arParams[7]           = new SqlCeParameter("@CreatedBy", SqlDbType.Int);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = createdBy;

            arParams[8]           = new SqlCeParameter("@ItemGuid", SqlDbType.UniqueIdentifier);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = itemGuid;

            arParams[9]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = moduleGuid;

            arParams[10]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = userGuid;


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

            return(newId);
        }
예제 #6
0
        public static int AddGalleryImage(
            Guid itemGuid,
            Guid moduleGuid,
            int moduleId,
            int displayOrder,
            string caption,
            string description,
            string metaDataXml,
            string imageFile,
            string webImageFile,
            string thumbnailFile,
            DateTime uploadDate,
            string uploadUser,
            Guid userGuid)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            SqlCeParameter[] arParams = new SqlCeParameter[13];

            arParams[0]           = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            arParams[1]           = new SqlCeParameter("@DisplayOrder", SqlDbType.Int);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = displayOrder;

            arParams[2]           = new SqlCeParameter("@Caption", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = caption;

            arParams[3]           = new SqlCeParameter("@Description", SqlDbType.NText);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = description;

            arParams[4]           = new SqlCeParameter("@MetaDataXml", SqlDbType.NText);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = metaDataXml;

            arParams[5]           = new SqlCeParameter("@ImageFile", SqlDbType.NVarChar, 100);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = imageFile;

            arParams[6]           = new SqlCeParameter("@WebImageFile", SqlDbType.NVarChar, 100);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = webImageFile;

            arParams[7]           = new SqlCeParameter("@ThumbnailFile", SqlDbType.NVarChar, 100);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = thumbnailFile;

            arParams[8]           = new SqlCeParameter("@UploadDate", SqlDbType.DateTime);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = uploadDate;

            arParams[9]           = new SqlCeParameter("@UploadUser", SqlDbType.NVarChar, 100);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = uploadUser;

            arParams[10]           = new SqlCeParameter("@ItemGuid", SqlDbType.UniqueIdentifier);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = itemGuid;

            arParams[11]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = moduleGuid;

            arParams[12]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = userGuid;


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

            return(newId);
        }
예제 #7
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)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            SqlCeParameter[] arParams = new SqlCeParameter[14];

            arParams[0]           = new SqlCeParameter("@FeatureName", SqlDbType.NVarChar, 255);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = featureName;

            arParams[1]           = new SqlCeParameter("@ControlSrc", SqlDbType.NVarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = controlSrc;

            arParams[2]           = new SqlCeParameter("@SortOrder", SqlDbType.Int);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = sortOrder;

            arParams[3]           = new SqlCeParameter("@IsAdmin", SqlDbType.Bit);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = isAdmin;

            arParams[4]           = new SqlCeParameter("@Icon", SqlDbType.NVarChar, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = icon;

            arParams[5]           = new SqlCeParameter("@DefaultCacheTime", SqlDbType.Int);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = defaultCacheTime;

            arParams[6]           = new SqlCeParameter("@Guid", SqlDbType.UniqueIdentifier);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = featureGuid;

            arParams[7]           = new SqlCeParameter("@ResourceFile", SqlDbType.NVarChar, 255);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = resourceFile;

            arParams[8]           = new SqlCeParameter("@IsCacheable", SqlDbType.Bit);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = isCacheable;

            arParams[9]           = new SqlCeParameter("@IsSearchable", SqlDbType.Bit);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = isSearchable;

            arParams[10]           = new SqlCeParameter("@SearchListName", SqlDbType.NVarChar, 255);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = searchListName;

            arParams[11]           = new SqlCeParameter("@SupportsPageReuse", SqlDbType.Bit);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = supportsPageReuse;

            arParams[12]           = new SqlCeParameter("@DeleteProvider", SqlDbType.NVarChar, 255);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = deleteProvider;

            arParams[13]           = new SqlCeParameter("@PartialView", SqlDbType.NVarChar, 255);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = partialView;


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

            EnsureInstallationInAdminSites();

            return(newId);
        }
예제 #8
0
        public static int AddRssFeed(
            Guid itemGuid,
            Guid moduleGuid,
            Guid userGuid,
            int moduleId,
            int userId,
            string author,
            string url,
            string rssUrl,
            DateTime createdUtc,
            string imageUrl,
            string feedType,
            bool publishByDefault,
            int sortRank)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            SqlCeParameter[] arParams = new SqlCeParameter[15];

            arParams[0]           = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            arParams[1]           = new SqlCeParameter("@CreatedDate", SqlDbType.DateTime);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = createdUtc;

            arParams[2]           = new SqlCeParameter("@UserID", SqlDbType.Int);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = userId;

            arParams[3]           = new SqlCeParameter("@Author", SqlDbType.NVarChar, 100);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = author;

            arParams[4]           = new SqlCeParameter("@Url", SqlDbType.NVarChar, 255);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = url;

            arParams[5]           = new SqlCeParameter("@RssUrl", SqlDbType.NVarChar, 255);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = rssUrl;

            arParams[6]           = new SqlCeParameter("@ItemGuid", SqlDbType.UniqueIdentifier);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = itemGuid;

            arParams[7]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = moduleGuid;

            arParams[8]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = userGuid;

            arParams[9]           = new SqlCeParameter("@LastModUserGuid", SqlDbType.UniqueIdentifier);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = userGuid;

            arParams[10]           = new SqlCeParameter("@LastModUtc", SqlDbType.DateTime);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = createdUtc;

            arParams[11]           = new SqlCeParameter("@ImageUrl", SqlDbType.NVarChar, 255);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = imageUrl;

            arParams[12]           = new SqlCeParameter("@FeedType", SqlDbType.NVarChar, 20);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = feedType;

            arParams[13]           = new SqlCeParameter("@PublishByDefault", SqlDbType.Bit);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = publishByDefault;

            arParams[14]           = new SqlCeParameter("@SortRank", SqlDbType.Int);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = sortRank;


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

            return(newId);
        }
예제 #9
0
        /// <summary>
        /// Inserts a row in the mp_CalendarEvents table. Returns new integer id.
        /// </summary>
        /// <param name="itemGuid"> itemGuid </param>
        /// <param name="moduleGuid"> moduleGuid </param>
        /// <param name="moduleID"> moduleID </param>
        /// <param name="title"> title </param>
        /// <param name="description"> description </param>
        /// <param name="imageName"> imageName </param>
        /// <param name="eventDate"> eventDate </param>
        /// <param name="startTime"> startTime </param>
        /// <param name="endTime"> endTime </param>
        /// <param name="userID"> userID </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="location"> location </param>
        /// <param name="requiresTicket"> requiresTicket </param>
        /// <param name="ticketPrice"> ticketPrice </param>
        /// <param name="createdDate"> createdDate </param>
        /// <returns>int</returns>
        public static int AddCalendarEvent(
            Guid itemGuid,
            Guid moduleGuid,
            int moduleId,
            string title,
            string description,
            string imageName,
            DateTime eventDate,
            DateTime startTime,
            DateTime endTime,
            int userId,
            Guid userGuid,
            string location,
            bool requiresTicket,
            decimal ticketPrice,
            DateTime createdDate)
        {
            StringBuilder sqlCommand = new StringBuilder();

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

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

            SqlCeParameter[] arParams = new SqlCeParameter[17];

            arParams[0]           = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            arParams[1]           = new SqlCeParameter("@Title", SqlDbType.NVarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = title;

            arParams[2]           = new SqlCeParameter("@Description", SqlDbType.NText);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = description;

            arParams[3]           = new SqlCeParameter("@ImageName", SqlDbType.NVarChar, 100);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = imageName;

            arParams[4]           = new SqlCeParameter("@EventDate", SqlDbType.DateTime);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = eventDate;

            arParams[5]           = new SqlCeParameter("@StartTime", SqlDbType.DateTime);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = startTime;

            arParams[6]           = new SqlCeParameter("@EndTime", SqlDbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = endTime;

            arParams[7]           = new SqlCeParameter("@CreatedDate", SqlDbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = createdDate;

            arParams[8]           = new SqlCeParameter("@UserID", SqlDbType.Int);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = userId;

            arParams[9]           = new SqlCeParameter("@ItemGuid", SqlDbType.UniqueIdentifier);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = itemGuid;

            arParams[10]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = moduleGuid;

            arParams[11]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = userGuid;

            arParams[12]           = new SqlCeParameter("@Location", SqlDbType.NText);
            arParams[12].Direction = ParameterDirection.Input;
            arParams[12].Value     = location;

            arParams[13]           = new SqlCeParameter("@LastModUserGuid", SqlDbType.UniqueIdentifier);
            arParams[13].Direction = ParameterDirection.Input;
            arParams[13].Value     = userGuid;

            arParams[14]           = new SqlCeParameter("@LastModUtc", SqlDbType.DateTime);
            arParams[14].Direction = ParameterDirection.Input;
            arParams[14].Value     = createdDate;

            arParams[15]           = new SqlCeParameter("@TicketPrice", SqlDbType.Decimal);
            arParams[15].Direction = ParameterDirection.Input;
            arParams[15].Value     = ticketPrice;

            arParams[16]           = new SqlCeParameter("@RequiresTicket", SqlDbType.Bit);
            arParams[16].Direction = ParameterDirection.Input;
            arParams[16].Value     = requiresTicket;


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

            return(newId);
        }
예제 #10
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)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_SharedFilesHistory ");
            sqlCommand.Append("(");
            sqlCommand.Append("ItemID, ");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("FriendlyName, ");
            sqlCommand.Append("OriginalFileName, ");
            sqlCommand.Append("ServerFileName, ");
            sqlCommand.Append("SizeInKB, ");
            sqlCommand.Append("UploadDate, ");
            sqlCommand.Append("ArchiveDate, ");
            sqlCommand.Append("UploadUserID, ");
            sqlCommand.Append("ItemGuid, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("UserGuid ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@ItemID, ");
            sqlCommand.Append("@ModuleID, ");
            sqlCommand.Append("@FriendlyName, ");
            sqlCommand.Append("@OriginalFileName, ");
            sqlCommand.Append("@ServerFileName, ");
            sqlCommand.Append("@SizeInKB, ");
            sqlCommand.Append("@UploadDate, ");
            sqlCommand.Append("@ArchiveDate, ");
            sqlCommand.Append("@UploadUserID, ");
            sqlCommand.Append("@ItemGuid, ");
            sqlCommand.Append("@ModuleGuid, ");
            sqlCommand.Append("@UserGuid ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[12];

            arParams[0]           = new SqlCeParameter("@ItemID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = itemId;

            arParams[1]           = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = moduleId;

            arParams[2]           = new SqlCeParameter("@FriendlyName", SqlDbType.NVarChar, 255);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = friendlyName;

            arParams[3]           = new SqlCeParameter("@OriginalFileName", SqlDbType.NVarChar, 255);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = originalFileName;

            arParams[4]           = new SqlCeParameter("@ServerFileName", SqlDbType.NVarChar, 50);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = serverFileName;

            arParams[5]           = new SqlCeParameter("@SizeInKB", SqlDbType.Int);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = sizeInKB;

            arParams[6]           = new SqlCeParameter("@UploadDate", SqlDbType.DateTime);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = uploadDate;

            arParams[7]           = new SqlCeParameter("@ArchiveDate", SqlDbType.DateTime);
            arParams[7].Direction = ParameterDirection.Input;
            arParams[7].Value     = archiveDate;

            arParams[8]           = new SqlCeParameter("@UploadUserID", SqlDbType.Int);
            arParams[8].Direction = ParameterDirection.Input;
            arParams[8].Value     = uploadUserId;

            arParams[9]           = new SqlCeParameter("@ItemGuid", SqlDbType.UniqueIdentifier);
            arParams[9].Direction = ParameterDirection.Input;
            arParams[9].Value     = itemGuid;

            arParams[10]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[10].Direction = ParameterDirection.Input;
            arParams[10].Value     = moduleGuid;

            arParams[11]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[11].Direction = ParameterDirection.Input;
            arParams[11].Value     = userGuid;


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

            return(newId > -1);
        }
예제 #11
0
        public static int AddSharedFileFolder(
            Guid folderGuid,
            Guid moduleGuid,
            Guid parentGuid,
            int moduleId,
            string folderName,
            int parentId)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_SharedFileFolders ");
            sqlCommand.Append("(");
            sqlCommand.Append("ModuleID, ");
            sqlCommand.Append("FolderName, ");
            sqlCommand.Append("ParentID, ");
            sqlCommand.Append("ModuleGuid, ");
            sqlCommand.Append("FolderGuid, ");
            sqlCommand.Append("ParentGuid ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@ModuleID, ");
            sqlCommand.Append("@FolderName, ");
            sqlCommand.Append("@ParentID, ");
            sqlCommand.Append("@ModuleGuid, ");
            sqlCommand.Append("@FolderGuid, ");
            sqlCommand.Append("@ParentGuid ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[6];

            arParams[0]           = new SqlCeParameter("@ModuleID", SqlDbType.Int);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = moduleId;

            arParams[1]           = new SqlCeParameter("@FolderName", SqlDbType.NVarChar, 255);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = folderName;

            arParams[2]           = new SqlCeParameter("@ParentID", SqlDbType.Int);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = parentId;

            arParams[3]           = new SqlCeParameter("@ModuleGuid", SqlDbType.UniqueIdentifier);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = moduleGuid;

            arParams[4]           = new SqlCeParameter("@FolderGuid", SqlDbType.UniqueIdentifier);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = folderGuid;

            arParams[5]           = new SqlCeParameter("@ParentGuid", SqlDbType.UniqueIdentifier);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = parentGuid;


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

            return(newId);
        }
예제 #12
0
        /// <summary>
        /// Inserts a row in the mp_LetterSendLog table. Returns new integer id.
        /// </summary>
        /// <param name="letterGuid"> letterGuid </param>
        /// <param name="userGuid"> userGuid </param>
        /// <param name="emailAddress"> emailAddress </param>
        /// <param name="uTC"> uTC </param>
        /// <param name="errorOccurred"> errorOccurred </param>
        /// <param name="errorMessage"> errorMessage </param>
        /// <returns>int</returns>
        public static int Create(
            Guid letterGuid,
            Guid userGuid,
            Guid subscribeGuid,
            string emailAddress,
            DateTime uTC,
            bool errorOccurred,
            string errorMessage)
        {
            StringBuilder sqlCommand = new StringBuilder();

            sqlCommand.Append("INSERT INTO mp_LetterSendLog ");
            sqlCommand.Append("(");
            sqlCommand.Append("LetterGuid, ");
            sqlCommand.Append("UserGuid, ");
            sqlCommand.Append("EmailAddress, ");
            sqlCommand.Append("UTC, ");
            sqlCommand.Append("ErrorOccurred, ");
            sqlCommand.Append("ErrorMessage, ");
            sqlCommand.Append("SubscribeGuid ");
            sqlCommand.Append(")");

            sqlCommand.Append(" VALUES ");
            sqlCommand.Append("(");
            sqlCommand.Append("@LetterGuid, ");
            sqlCommand.Append("@UserGuid, ");
            sqlCommand.Append("@EmailAddress, ");
            sqlCommand.Append("@UTC, ");
            sqlCommand.Append("@ErrorOccurred, ");
            sqlCommand.Append("@ErrorMessage, ");
            sqlCommand.Append("@SubscribeGuid ");
            sqlCommand.Append(")");
            sqlCommand.Append(";");

            SqlCeParameter[] arParams = new SqlCeParameter[7];

            arParams[0]           = new SqlCeParameter("@LetterGuid", SqlDbType.UniqueIdentifier);
            arParams[0].Direction = ParameterDirection.Input;
            arParams[0].Value     = letterGuid;

            arParams[1]           = new SqlCeParameter("@UserGuid", SqlDbType.UniqueIdentifier);
            arParams[1].Direction = ParameterDirection.Input;
            arParams[1].Value     = userGuid;

            arParams[2]           = new SqlCeParameter("@EmailAddress", SqlDbType.NVarChar, 100);
            arParams[2].Direction = ParameterDirection.Input;
            arParams[2].Value     = emailAddress;

            arParams[3]           = new SqlCeParameter("@UTC", SqlDbType.DateTime);
            arParams[3].Direction = ParameterDirection.Input;
            arParams[3].Value     = uTC;

            arParams[4]           = new SqlCeParameter("@ErrorOccurred", SqlDbType.Bit);
            arParams[4].Direction = ParameterDirection.Input;
            arParams[4].Value     = errorOccurred;

            arParams[5]           = new SqlCeParameter("@ErrorMessage", SqlDbType.NText);
            arParams[5].Direction = ParameterDirection.Input;
            arParams[5].Value     = errorMessage;

            arParams[6]           = new SqlCeParameter("@SubscribeGuid", SqlDbType.UniqueIdentifier);
            arParams[6].Direction = ParameterDirection.Input;
            arParams[6].Value     = subscribeGuid;


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

            return(newId);
        }