protected void Page_Load(object sender, EventArgs e) { Database DB = Database.New(); #region Event DBEvent DBEvent = new DBEvent(DB); Event = DBEvent.Get(new Guid("5F014EA2-3515-4B63-9989-F68A01043E72")); #endregion #region Search DBYoung DBYoung = new DBYoung(DB); SearchOptions = new StringBuilder(); foreach (PMYoung Young in DBYoung.Gets()) SearchOptions.AppendParameterizedFormat(@" <option value='{YoungId}' ChurchId='{ChurchId}' Name='{Name}' Surnames='{Surnames}' Email='{Email}' Facebook='{Facebook}' Birthday='{Birthday}'>{Sector} - {Church} - {CompleteName}</option>", "{YoungId}", Young.YoungId, "{ChurchId}", Young.ChurchId, "{Sector}", Young.Sector, "{Church}", Young.Church, "{CompleteName}", Young.Name + " " + Young.Surnames, "{Name}", Young.Name, "{Surnames}", Young.Surnames, "{Email}", Young.Email, "{Facebook}", Young.Facebook, "{Birthday}", Young.Birthday.FormatDate()); #endregion #region Churchs DBChurch DBChurch = new DBChurch(DB); ChurchsOptions = new StringBuilder(); foreach (PMChurch Church in DBChurch.Gets()) ChurchsOptions.AppendParameterizedFormat(@"<option value='{ChurchId}'>{Municipality} - {Name}</option>", "{ChurchId}", Church.ChurchId, "{Municipality}", Church.Municipality, "{Name}", Church.Name); #endregion SendEmail(); }
public bool MappingTable() { try { if (_tableinfo.Rows.Count > 0) { string ClassName = _filename.Replace(Path.GetExtension(_filename), string.Empty); _modelstring = new StringBuilder(); _modelstring.AppendLine("using System;"); _modelstring.AppendLine("using Ding.Core;"); _modelstring.AppendLine(); _modelstring.AppendParameterizedFormat("namespace {Namespce}", "{Namespce}", _namespace); _modelstring.AppendLine(); _modelstring.AppendLine("{"); _modelstring.Append("\t"); _modelstring.AppendParameterizedFormat(@"public class {ClassName}" , "{ClassName}", ClassName); _modelstring.AppendLine(); _modelstring.Append("\t{"); _modelstring.AppendLine(); #region Content class #region Fields _modelstring.Append("\t\t"); _modelstring.AppendLine("#region Fields"); foreach (DataRow Row in _tableinfo.Rows) { _modelstring.Append("\t\t"); _modelstring.AppendParameterizedFormat(@"private {Type} {VariableName};" , "{Type}", GetDotNetType(Row.S("DATA_TYPE")) , "{VariableName}", GetFieldName(Row.S("COLUMN_NAME"))); _modelstring.AppendLine(); } _modelstring.Append("\t\t"); _modelstring.AppendLine("#endregion"); #endregion #region properties _modelstring.AppendLine(); _modelstring.Append("\t\t"); _modelstring.AppendLine("#region Properties"); foreach (DataRow Row in _tableinfo.Rows) { _modelstring.Append("\t\t"); _modelstring.AppendParameterizedFormat(@"public {Type} {VariableName} { get { return {FieldName}; }}" , "{Type}", GetDotNetType(Row.S("DATA_TYPE")) , "{VariableName}", GetPropertyName(Row.S("COLUMN_NAME")) , "{FieldName}", GetFieldName(Row.S("COLUMN_NAME"))); _modelstring.AppendLine(); } _modelstring.Append("\t\t"); _modelstring.AppendLine("#endregion"); #endregion #region Constructors _modelstring.AppendLine(); _modelstring.Append("\t\t"); _modelstring.AppendParameterizedFormat("public {ClassName}(){}", "{ClassName}", ClassName); _modelstring.AppendLine(); _modelstring.AppendLine(); StringBuilder ConstructorParams = new StringBuilder(); foreach (DataRow Row in _tableinfo.Rows) { ConstructorParams.AppendParameterizedFormat(@"{Type} {ParamName}, " , "{Type}", GetDotNetType(Row.S("DATA_TYPE")) , "{ParamName}", GetParamName(Row.S("COLUMN_NAME"))); } ConstructorParams = ConstructorParams.Remove(ConstructorParams.Length - 2 , 2); _modelstring.Append("\t\t"); _modelstring.AppendParameterizedFormat("public {ClassName}({ConstructorParams})", "{ClassName}", ClassName, "{ConstructorParams}", ConstructorParams.ToString()); _modelstring.AppendLine(); _modelstring.Append("\t\t"); _modelstring.AppendLine("{"); foreach (DataRow Row in _tableinfo.Rows) { _modelstring.Append("\t\t\t"); _modelstring.AppendParameterizedFormat(@"this.{FieldName} = {ParamName};" , "{FieldName}", GetFieldName(Row.S("COLUMN_NAME")) , "{ParamName}", GetParamName(Row.S("COLUMN_NAME"))); _modelstring.AppendLine(); } _modelstring.Append("\t\t}"); #endregion #endregion _modelstring.AppendLine(); _modelstring.Append("\t}"); _modelstring.AppendLine(); _modelstring.Append("}"); } } catch { return false; } return true; }