Exemplo n.º 1
0
        private void BuildViewDataClass(MyMeta.ITable table, bool useUIDtos)
        {
            _hdrUtil.WriteClassHeader(_output);

            _output.autoTabLn("using System;");
            _output.autoTabLn("using System.Collections.Generic;");
            _output.autoTabLn("using System.Linq;");
            _output.autoTabLn("using System.Web;");
            _output.autoTabLn("");
            if (useUIDtos)
            {
                _output.autoTabLn("using " + _script.Settings.UI.UINamespace + ".Models;");
            }
            else
            {
                _output.autoTabLn("using " + _script.Settings.BusinessObjects.BusinessObjectsNamespace + ";");
            }
            _output.autoTabLn("");
            _output.autoTabLn("namespace " + _script.Settings.UI.UINamespace + ".ViewData");
            _output.autoTabLn("{");
            _output.tabLevel++;
            _output.autoTabLn("public class " + StringFormatter.CleanUpClassName(table.Name) + "ViewData : BaseViewData");
            _output.autoTabLn("{");
            _output.tabLevel++;
            _output.autoTabLn("public " + StringFormatter.CleanUpClassName(table.Name) + ((useUIDtos) ? "Model" : "") + " " + StringFormatter.CleanUpClassName(table.Name) + " { get; set; }");
            _output.autoTabLn("public List<" + StringFormatter.CleanUpClassName(table.Name) + ((useUIDtos) ? "Model" : "") + "> " + StringFormatter.CleanUpClassName(table.Name) + "List { get; set; }");
            _output.tabLevel--;
            _output.autoTabLn("}");
            _output.tabLevel--;
            _output.autoTabLn("}");

            _context.FileList.Add("    " + StringFormatter.CleanUpClassName(table.Name) + "ViewData.cs");
            SaveOutput(CreateFullPath(_script.Settings.UI.UINamespace + "\\ViewData", StringFormatter.CleanUpClassName(table.Name) + "ViewData.cs"), SaveActions.DontOverwrite);
        }
 public WcfForeignKeyPropertiesDtos(MyMeta.ITable table, RequestContext context)
 {
     this._context = context;
     this._table   = table;
     this._script  = context.ScriptSettings;
     this.output   = context.Zeus.Output;
 }
Exemplo n.º 3
0
        /// <summary>
        /// This should be called before the parameter generating methods in
        /// order to initialize the keyTypes and keyValues.
        /// </summary>
        /// <param name="m_ITable"></param>
        public void GetPrimaryKeys(MyMeta.ITable m_ITable)
        {
            int i = 0;

            foreach (Column c in m_ITable.Columns)
            {
                if (c.IsInPrimaryKey)
                {
                    primaryKeyTypes = new string[i + 1];
                    primaryKeyNames = new string[i + 1];
                    i++;
                }
            }

            i = 0;
            foreach (Column c in m_ITable.Columns)
            {
                if (c.IsInPrimaryKey)
                {
                    primaryKeyTypes[i] = c.LanguageType;
                    primaryKeyNames[i] = c.Alias;
                    i++;
                }
            }
        }
Exemplo n.º 4
0
 public BusinessObjectsPropertiesRenderForeignKeyConstructorForDbContext(MyMeta.ITable table, RequestContext context)
 {
     this._context = context;
     this._table   = table;
     this._script  = context.ScriptSettings;
     this._output  = context.Zeus.Output;
 }
Exemplo n.º 5
0
 public Property(MyMeta.IColumn column, RequestContext context)
 {
     this._context = context;
     this._table   = column.Table;
     this._column  = column;
     this._output  = context.Zeus.Output;
     this._script  = context.ScriptSettings;
 }
Exemplo n.º 6
0
 public Property(MyMeta.IColumn column, RequestContext context)
 {
     this._context = context;
     this._table = column.Table;
     this._column = column;
     this._output = context.Zeus.Output;
     this._script = context.ScriptSettings;
 }
Exemplo n.º 7
0
 //public GenColumn(MyMeta.IColumn column, Zeus.IZeusOutput outputDest, MyMeta.ITable table, Dnp.Utils.Utils dnp)
 public GenColumn(MyMeta.IColumn column, MyMeta.ITable table, RequestContext context)
 {
     m_IColumn  = column;
     script     = ScriptSettings.GetInstance();
     output     = context.Zeus.Output;
     _util      = new CommonUtility();
     _table     = table;
     m_DnpUtils = context.ScriptSettings.DnpUtils;
 }
Exemplo n.º 8
0
 //public GenColumn(MyMeta.IColumn column, Zeus.IZeusOutput outputDest, MyMeta.ITable table, Dnp.Utils.Utils dnp)
 public GenColumn(MyMeta.IColumn column, MyMeta.ITable table, RequestContext context)
 {
     m_IColumn = column;
     script = ScriptSettings.GetInstance();
     output = context.Zeus.Output;
     _util = new CommonUtility();
     _table = table;
     m_DnpUtils = context.ScriptSettings.DnpUtils;
 }
Exemplo n.º 9
0
        private void RenderProperties(MyMeta.ITable table)
        {
            BusinessObjectsPropertyRenderShortProperty property = null;

            foreach (IColumn c in table.Columns)
            {
                property = new BusinessObjectsPropertyRenderShortProperty(c, _context);
                property.Render();
            }

            BusinessObjectsPropertiesRenderForeignKey prop = new BusinessObjectsPropertiesRenderForeignKey(table, _context);

            prop.Render();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Builds the parameters for a calling method that contain only the variable, and not the data type.
        /// Example: someClassInstance.MyMethod(injectedParameter) -- 'injectedParameter' is the value created.
        /// </summary>
        /// <param name="m_ITable"></param>
        /// <returns></returns>
        public string RenderCallingMethodParameters(MyMeta.ITable m_ITable)
        {
            string result = string.Empty;

            GetPrimaryKeys(m_ITable);

            for (int i = 0; i < primaryKeyTypes.Length; i++)
            {
                result += primaryKeyNames[i] + ", ";
            }

            // Trim the trailing comma.
            result = result.Substring(0, result.Length - 2);

            return(result);
        }
Exemplo n.º 11
0
        public void Render()
        {
            _dialog.InitDialog();
            _context.FileList.Add("");
            _context.FileList.Add("Generated UI MVC ViewData classes:");

            bool useUIDtos = false;

            if (_autoMapperFramework != null)
            {
                useUIDtos = true;
            }

            foreach (string tableName in _script.Tables)
            {
                MyMeta.ITable table = _database.Tables[tableName];
                BuildViewDataClass(table, useUIDtos);
            }

            _dialog.InitDialog(3);
            _dialog.Display("Processing UI MVC BaseViewData class.");
            BuildBaseViewDataClass();

            _dialog.Display("Processing UI MVC BaseViewDataBuilder class.");
            BuildBaseViewDataBuilderClass();

            _dialog.Display("Processing UI MVC ViewDataFactory class.");
            BuildViewDataFactory();

            CreateCommonClass();

            CreateConfigSettingsClass();

            CreateJsonResponseClass();

            BuildControllerCodeTemplate();

            BuildBaseController();

            BuildAutoMapperFramework();
        }
Exemplo n.º 12
0
        private void cbxtoolStripSelectObejct_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.dataGridViewField.AutoGenerateColumns = false;
            MyMeta.ITable tb = this.cbxtoolStripSelectObejct.ComboBox.SelectedValue as MyMeta.ITable;

            List <TableUIGenerationParams> tableUIGenerationParamsList = new List <TableUIGenerationParams>();

            foreach (IColumn column in tb.Columns)
            {
                TableUIGenerationParams tableUIGenerationParams = new TableUIGenerationParams();

                tableUIGenerationParams.IsSelect  = true;
                tableUIGenerationParams.FieldName = column.Name.Trim().Replace("_", "");

                tableUIGenerationParams.FieldNameCn =
                    TableGenerationHelper.GetNameFromDescription(column.Description.Trim(), column.Name.Trim().Replace("_", "").Trim());

                tableUIGenerationParams.LanguageType = column.LanguageType;
                tableUIGenerationParams.Size         = column.CharacterMaxLength;
                tableUIGenerationParams.IsAutoKey    = column.IsAutoKey;
                if (column.LanguageType == "bool")
                {
                    tableUIGenerationParams.InputType = "CheckBox";
                }
                else
                {
                    tableUIGenerationParams.InputType = "TextBox";
                }
                tableUIGenerationParams.IsReqiured   = !column.IsNullable;
                tableUIGenerationParams.DefaultValue = column.Default;
                tableUIGenerationParams.DbColumnName = column.Name;
                tableUIGenerationParamsList.Add(tableUIGenerationParams);
            }

            TableUIGenerationParams[] tableUIGenerationParamsListArray = new TableUIGenerationParams[tableUIGenerationParamsList.Count];

            tableUIGenerationParamsList.CopyTo(tableUIGenerationParamsListArray);

            this.dataGridViewField.DataSource = tableUIGenerationParamsListArray;
        }
Exemplo n.º 13
0
 public bool Equals(MyMeta.ITable other)
 {
     throw new NotImplementedException();
 }