|
namespace Cavalia { public abstract class PARMBUILDER { /// <summary> /// Match SectionID and CommunityID /// </summary> public static string WHERE_PARM_1 = " WHERE section_ID = @sectionID and @communityID = section_communityID";
public static ParmInfo2 MATCH_SQL_PARM(string KEY, int Value) { Dictionary<string, PARMTEMP> SQLPARMS = new Dictionary<string, PARMTEMP>();
//SQLPARMS.Add("sectionID","@sectionID", PARM_SECTIONID); SQLPARMS.Add("sectionID", new PARMTEMP("section_sectionID", new SqlParameter("@sectionID", SqlDbType.Int))); SQLPARMS.Add("communityID", new PARMTEMP("section_communityID", new SqlParameter("@communityID", SqlDbType.Int))); //SQLPARMS.Add("sectionID", ParmInfo2("sectionID", new SqlParameter("@sectionID", SqlDbType.Int))); SQLPARMS.Add("contentID", new PARMTEMP("section_contentID", new SqlParameter("@contentID", SqlDbType.Int))); SQLPARMS.Add("pageType", new PARMTEMP("section_pageType", new SqlParameter("@pageType", SqlDbType.Int))); SQLPARMS.Add("webBoxDisplayMode", new PARMTEMP("section_webBoxDisplayMode", new SqlParameter("@webBoxDisplayMode", SqlDbType.Int))); SQLPARMS.Add("webServiceBoxDisplayMode", new PARMTEMP("section_webServiceBoxDisplayMode", new SqlParameter("@webServiceBoxDisplayMode", SqlDbType.Int))); SQLPARMS.Add("parentSectionID", new PARMTEMP("section_parentSectionID", new SqlParameter("@parentSectionID", SqlDbType.Int))); SQLPARMS.Add("recordsPerPage", new PARMTEMP("section_recordsPerPage", new SqlParameter("@recordsPerPage", SqlDbType.Int))); if (SQLPARMS.ContainsKey(KEY)) { PARMTEMP TEMP = (SQLPARMS[KEY]); ParmInfo2 RETVAL = new ParmInfo2(TEMP.SQLCOLUMN, TEMP.SQLPARM, Value); return RETVAL; } else return null; //Content Page Parameters
} public static ParmInfo2 MATCH_SQL_PARM(string KEY, string Value) {
Dictionary<string, PARMTEMP> SQLPARMS = new Dictionary<string, PARMTEMP>(); SQLPARMS.Add("pageSkin", new PARMTEMP("section_pageSkin", new SqlParameter("@pageSkin", SqlDbType.NVarChar, 100))); SQLPARMS.Add("failOverPageSkin", new PARMTEMP("section_failOverPageSkin", new SqlParameter("@failOverPageSkin", SqlDbType.NVarChar, 100))); SQLPARMS.Add("SectionWebServicePassword", new PARMTEMP("section_SectionWebServicePassword", new SqlParameter("@SectionWebServicePassword", SqlDbType.NVarChar, 50))); SQLPARMS.Add("transformations", new PARMTEMP("section_transformations", new SqlParameter("@transformations", SqlDbType.NText))); SQLPARMS.Add("logo", new PARMTEMP("section_logo", new SqlParameter("@logo", SqlDbType.NVarChar, 50))); SQLPARMS.Add("pageHeader", new PARMTEMP("section_pageHeader", new SqlParameter("@pageHeader", SqlDbType.NText))); SQLPARMS.Add("pageFooter", new PARMTEMP("section_pageFooter", new SqlParameter("@pageFooter", SqlDbType.NText))); SQLPARMS.Add("footer", new PARMTEMP("section_footer", new SqlParameter("@footer", SqlDbType.NVarChar, 250))); SQLPARMS.Add("pageMetaKeys", new PARMTEMP("section_pageMetaKeys", new SqlParameter("@pageMetaKeys", SqlDbType.NVarChar, 250))); SQLPARMS.Add("pageMetaDesc", new PARMTEMP("section_pageMetaDesc", new SqlParameter("@pageMetaDesc", SqlDbType.NVarChar, 250))); SQLPARMS.Add("name", new PARMTEMP("section_name", new SqlParameter("@name", SqlDbType.NVarChar, 50))); SQLPARMS.Add("title", new PARMTEMP("section_title", new SqlParameter("@title", SqlDbType.NVarChar, 100))); SQLPARMS.Add("menuTitle", new PARMTEMP("section_menuTitle", new SqlParameter("@menuTitle", SqlDbType.NVarChar, 50))); SQLPARMS.Add("description", new PARMTEMP("section_description", new SqlParameter("@description", SqlDbType.NVarChar, 500))); SQLPARMS.Add("pageStyle", new PARMTEMP("pageStyle", new SqlParameter("@pageStyle", SqlDbType.NVarChar, 100)));
if (SQLPARMS.ContainsKey(KEY)) { PARMTEMP TEMP = (SQLPARMS[KEY]); ParmInfo2 RETVAL = new ParmInfo2(TEMP.SQLCOLUMN, TEMP.SQLPARM, Value); return RETVAL; } else return null;
} public static ParmInfo2 MATCH_SQL_PARM(string KEY, bool Value) { Dictionary<string, PARMTEMP> SQLPARMS = new Dictionary<string, PARMTEMP>(); SQLPARMS.Add("enableTopics", new PARMTEMP("section_enableTopics", new SqlParameter("@enableTopics", SqlDbType.Bit))); SQLPARMS.Add("enableComments", new PARMTEMP("section_enableComments", new SqlParameter("@enableComments", SqlDbType.Bit))); SQLPARMS.Add("enableModeration", new PARMTEMP("section_enableModeration", new SqlParameter("@enableModeration", SqlDbType.Bit))); SQLPARMS.Add("enableRatings", new PARMTEMP("section_enableRatings", new SqlParameter("@enableRatings", SqlDbType.Bit))); SQLPARMS.Add("enableCommentRatings", new PARMTEMP("section_enableCommentRatings", new SqlParameter("@enableCommentRatings", SqlDbType.Bit))); SQLPARMS.Add("enableNotifications", new PARMTEMP("section_enableNotifications", new SqlParameter("@enableNotifications", SqlDbType.Bit))); SQLPARMS.Add("inheritTransformations", new PARMTEMP("section_inheritTransformations", new SqlParameter("@inheritTransformations", SqlDbType.Bit))); SQLPARMS.Add("isWebBoxesInherited", new PARMTEMP("section_isWebBoxesInherited", new SqlParameter("@isWebBoxesInherited", SqlDbType.Bit))); SQLPARMS.Add("isSectionWebService", new PARMTEMP("section_isSectionWebService", new SqlParameter("@isSectionWebService", SqlDbType.Bit))); SQLPARMS.Add("allowHtmlInput", new PARMTEMP("section_allowHtmlInput", new SqlParameter("@allowHtmlInput", SqlDbType.Int))); SQLPARMS.Add("allowCommentHtmlInput", new PARMTEMP("section_allowCommentHtmlInput", new SqlParameter("@allowCommentHtmlInput", SqlDbType.Int))); SQLPARMS.Add("isSystem", new PARMTEMP("section_isSystem", new SqlParameter("@isSystem", SqlDbType.Bit))); SQLPARMS.Add("isWebServiceBoxesInherited", new PARMTEMP("section_isWebServiceBoxesInherited", new SqlParameter("@isWebServiceBoxesInherited", SqlDbType.Bit))); SQLPARMS.Add("isEnabled", new PARMTEMP("section_isEnabled", new SqlParameter("@isEnabled", SqlDbType.Bit))); if (SQLPARMS.ContainsKey(KEY)) { PARMTEMP TEMP = (SQLPARMS[KEY]); ParmInfo2 RETVAL = new ParmInfo2(TEMP.SQLCOLUMN, TEMP.SQLPARM, Value); return RETVAL; } else return null; }
} /// <summary> /// This is used to simply populate the correct SQLCOLUMN and SQLPARAMETER. /// It gets assigned on a Dictionary KEY Match which is then used to generate /// the actual list item that gets passed back. /// </summary> public class PARMTEMP { public string SQLCOLUMN; public SqlParameter SQLPARM;
public PARMTEMP(string _SQLCOLUMN, SqlParameter _SQLPARM) { this.SQLCOLUMN = _SQLCOLUMN; this.SQLPARM = _SQLPARM;
} } public class ParmInfo2 { public string SQLCOLUMN; public SqlParameter SQLPARM;
public ParmInfo2(string _SQLCOLUMN, SqlParameter _SQLPARM, string _VALUE) { this.SQLCOLUMN = _SQLCOLUMN; this.SQLPARM = _SQLPARM; this.SQLPARM.Value = _VALUE;
} public ParmInfo2(string _SQLCOLUMN, SqlParameter _SQLPARM, int _VALUE) { this.SQLCOLUMN = _SQLCOLUMN; this.SQLPARM = _SQLPARM; this.SQLPARM.Value = _VALUE;
} public ParmInfo2(string _SQLCOLUMN, SqlParameter _SQLPARM, bool _VALUE) { this.SQLCOLUMN = _SQLCOLUMN; this.SQLPARM = _SQLPARM; this.SQLPARM.Value = _VALUE;
} }
|