예제 #1
0
//
		static public SQLiteConnection CreateConnection(MyMeta.dbRoot dbRoot)
		{
			SQLiteConnection cn = new SQLiteConnection(dbRoot.ConnectionString);
			cn.Open();
			//cn.ChangeDatabase(database);
			return cn;
		}
 public WcfForeignKeyPropertiesDtos(MyMeta.ITable table, RequestContext context)
 {
     this._context = context;
     this._table = table;
     this._script = context.ScriptSettings;
     this.output = context.Zeus.Output;
 }
예제 #3
0
//
//		static public NpgsqlConnection CreateConnection(MyMeta.dbRoot dbRoot, string database)
//		{
//			string cnstr = dbRoot.ConnectionString + "Database=" + database + ";";
//			NpgsqlConnection cn = new Npgsql.NpgsqlConnection(cnstr);
//			return cn;
//		}

		static public NpgsqlConnection CreateConnection(MyMeta.dbRoot dbRoot, string database)
		{
			NpgsqlConnection cn = new Npgsql.NpgsqlConnection(dbRoot.ConnectionString);
			cn.Open();
			cn.ChangeDatabase(database);
			return cn;
		}
예제 #4
0
 public ScriptSettings(IZeusInput input, MyMeta.dbRoot database, Dnp.Utils.Utils dnp, string version)
 {
     this._input = input;
     this._database = database;
     this._version = version;
     this._dnpUtils = dnp;
 }
예제 #5
0
        public void Interface(MyMeta.ITable table)
        {
            string tableName = table.Name;
            string args = "";
            GenTable genTable = new GenTable(table, _context);
            string str = "";
            str += _util.BuildModelClassWithNameSpace(tableName) + " GetById(";

            for (int i = 0; i < genTable.GetPrimaryKeyNames.Length; i++)
            {
                // type + " " + key name
                args += genTable.GetPrimaryKeyTypes[i] + " ";
                args += StringFormatter.CamelCasing(genTable.GetPrimaryKeyNames[i]) + ", ";
            }
            // trim the trailing ", "

            args = args.Substring(0, (args.Length - 2));

            str += args;
            str += ");";
            _output.tabLevel++;
            _output.tabLevel++;
            _output.autoTabLn(str);
            _output.tabLevel--;
            _output.tabLevel--;

            str = "";
            str += "List<" + _util.BuildModelClassWithNameSpace(tableName) + "> GetAll(string sortExpression, int startRowIndex, int maximumRows);";
            _output.tabLevel++;
            _output.tabLevel++;
            _output.autoTabLn(str);
            _output.tabLevel--;
            _output.tabLevel--;
        }
 public BusinessObjectsPropertiesRenderForeignKeyConstructorForDbContext(MyMeta.ITable table, RequestContext context)
 {
     this._context = context;
     this._table = table;
     this._script = context.ScriptSettings;
     this._output = context.Zeus.Output;
 }
예제 #7
0
파일: Property.cs 프로젝트: kahanu/CondorXE
 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;
 }
 /// <summary>
 /// This renders short properties with DataAnnotations Attributes.
 /// </summary>
 /// <param name="column">The IColumn object</param>
 /// <param name="context">The RequestContext</param>
 /// <param name="omitList">Comma-delimited list of properties to omit</param>
 public BusinessObjectsPropertyRenderDataAnnotationsForDbContext(MyMeta.IColumn column, RequestContext context, string omitList)
     : this(column, context)
 {
     if (!string.IsNullOrEmpty(omitList))
         this._omitList = omitList.ToLower().Split(',');
     else
         this._omitList = new string[0];
 }
예제 #9
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;
 }
예제 #10
0
        public SchemaLoader(MyMeta.dbDriver dbDriver, string dbTarget, string language, string connectionString)
        {
            string settingFolder = Path.Combine(Environment.CurrentDirectory, @"Settings");

            if (!System.IO.Directory.Exists(settingFolder))
            {
                System.IO.Directory.CreateDirectory(settingFolder);
            }

            if (!System.IO.File.Exists(this._DbTargetMappingFileName))
            {
                using (Stream input = Assembly.GetAssembly(typeof(IDatabaseInfo)).GetManifestResourceStream("CKGen.Base.Res.DbTargets.xml"))
                using (Stream output = File.Create(this._DbTargetMappingFileName))
                {
                    byte[] buffer = new byte[8192];

                    int bytesRead;
                    while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0)
                    {
                        output.Write(buffer, 0, bytesRead);
                    }
                }
            }

            if (!System.IO.File.Exists(this._LanguageMappingFileName))
            {
                using (Stream input = Assembly.GetAssembly(typeof(IDatabaseInfo)).GetManifestResourceStream("CKGen.Base.Res.Languages.xml"))
                using (Stream output = File.Create(this._LanguageMappingFileName))
                {
                    byte[] buffer = new byte[8192];

                    int bytesRead;
                    while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0)
                    {
                        output.Write(buffer, 0, bytesRead);
                    }
                }
            }

            _DbTarget = dbTarget;
            _Language = language;
            _ConnectionString = connectionString;

            _root = new MyMeta.dbRoot();
            _root.DbTargetMappingFileName = this._DbTargetMappingFileName;
            _root.DbTarget = this._DbTarget;

            _root.LanguageMappingFileName = this._LanguageMappingFileName;
            _root.Language = this._Language;
            

            //_root.ShowSystemData = true;

            _dbDriver = dbDriver;

        }
예제 #11
0
        public MapPropertiesFromDto(MyMeta.IColumn column, RequestContext context, string modelName, string dtoName)
            : this(column, context)
        {
            if (string.IsNullOrEmpty(modelName))
                modelName = "model";

            if (string.IsNullOrEmpty(dtoName))
                dtoName = "dto";

            this._dtoName = dtoName;
            this._modelName = modelName;
        }
예제 #12
0
 public bool Equals(MyMeta.IColumn other)
 {
     throw new NotImplementedException();
 }
		public void Edit(MyMeta.View obj)
        {
            if (this._currentType == obj.GetType()) return;
            BindGrid(obj.GlobalProperties);
            this._currentType = obj.GetType();
		}
 /// <summary>
 /// This renders short properties with DataAnnotations Attributes.
 /// </summary>
 /// <param name="column"></param>
 /// <param name="context"></param>
 /// <example>
 /// [Required(ErrorMessage = "Category Name is required.")]
 /// [StringLength(50, ErrorMessage = "Category Name must be between 1 and 50 characters.")]
 /// [DisplayName("Category Name")]
 /// public string CategoryName { get; set; }
 /// </example>
 public BusinessObjectsPropertyRenderDataAnnotationsForDbContext(MyMeta.IColumn column, RequestContext context)
     : base(column, context)
 {
     this._util = context.Utility;
     this._omitList = new string[0];
 }
예제 #15
0
 public void BuildModelClass(MyMeta.ITable table, bool useWebService)
 {
 }
예제 #16
0
 public RenderDataAnnotationsProperty(MyMeta.IColumn column, RequestContext context)
     : base(column, context)
 {
 }
예제 #17
0
		public void EditSingle(MyMeta.Single obj, string niceName)
		{
			this.single = obj;

			DataSet ds = new DataSet();
			DataTable dt = new DataTable("this");
			dt.Columns.Add("this",  Type.GetType("System.Object"));
			ds.Tables.Add(dt);
			dt.Rows.Add(new object[] { this });

			dt = new DataTable("MyData");
			DataColumn k = dt.Columns.Add("Key", stringType);
			k.AllowDBNull = false;
			DataColumn v = dt.Columns.Add("Value", stringType);
			v.AllowDBNull = false;
			ds.Tables.Add(dt);

			UniqueConstraint pk = new UniqueConstraint(k, false);

			dt.Constraints.Add(pk);
			ds.EnforceConstraints = true;

			this.txtNiceName.Enabled = true;

			this.col_0.HeaderText  = "Key";
			this.col_0.TextBox.Enabled = true;

			this.col_1.HeaderText  = "Value";
			this.col_1.MappingName = "Value";

			this.txtNiceName.Text = niceName;
			this.txtNiceName.Tag = obj;

			IPropertyCollection properties = obj.Properties;
			DataRowCollection rows = dt.Rows;

			foreach(IProperty prop in properties)
			{
				rows.Add(new object[] { prop.Key, prop.Value } );
			}

			dt.AcceptChanges();

			this.Grid.DataSource = dt.DefaultView;
			this.InitializeGrid();

			this.col_0.TextBox.BorderStyle = BorderStyle.None;
			this.col_1.TextBox.BorderStyle = BorderStyle.None;
 
			this.col_0.TextBox.Move += new System.EventHandler(this.ColorTextBox);
			this.col_1.TextBox.Move += new System.EventHandler(this.ColorTextBox);
 
			dt.RowChanged  += new DataRowChangeEventHandler(PropertyGridRowChanged);
			dt.RowDeleting += new DataRowChangeEventHandler(PropertyGridRowDeleting);
			dt.RowDeleted  += new DataRowChangeEventHandler(PropertyGridRowDeleted);
		}
예제 #18
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);
        }
예제 #19
0
 public void GetAll(MyMeta.ITable table)
 {
 }
예제 #20
0
 public void GetAllWithSortingAndPaging(MyMeta.ITable table)
 {
 }
예제 #21
0
 public void GetById(MyMeta.ITable table)
 {
 }
예제 #22
0
		public Hashtable ReadUserMap(string mapFileName, string mapGroupType, MyMeta.dbRoot myMeta)
		{
			Hashtable h = new Hashtable();
			XmlTextReader reader = null;
			string sPath = myMeta.DbTargetMappingFileName;
			sPath = sPath.Substring(0, sPath.LastIndexOf("\\"));
			
			try
			{
				reader = new XmlTextReader(sPath + "\\" + mapFileName);
				reader.WhitespaceHandling = WhitespaceHandling.None;

				while(reader.Read())
				{
					if(reader.GetAttribute("From") == mapGroupType)
					{
						break;
					}
				}
				while(reader.Read())
				{
			      	if(reader.NodeType == XmlNodeType.EndElement)
			      	{
			      		break;
			      	}
			      	else
			      	{
			      		h.Add(reader.GetAttribute("From"), reader.GetAttribute("To"));
			      	}
				}
			}
			finally
			{
				if (reader != null)
				{
					reader.Close();
				}
			}
			
			return h;
		}
예제 #23
0
 public PropertyDecoratorBase(MyMeta.IColumn column, RequestContext context)
     : base(column, context)
 {
 }
예제 #24
0
 public void Delete(MyMeta.ITable table)
 {
 }
예제 #25
0
		private DataTable ProLogForNiceNames(MyMeta.Collection coll)
		{
			this.txtNiceName.Text = "";
			this.txtNiceName.Tag = null;

			DataSet ds = new DataSet();
			DataTable dt = new DataTable("this");
			dt.Columns.Add("this",  Type.GetType("System.Object"));
			ds.Tables.Add(dt);
			dt.Rows.Add(new object[] { this });

			dt = new DataTable("MyData");
			DataColumn k = dt.Columns.Add("Key", stringType);
			k.AllowDBNull = false;
			DataColumn a = dt.Columns.Add("Alias", stringType);
			a.AllowDBNull = false;

			dt.Columns.Add("obj", Type.GetType("System.Object"));
			ds.Tables.Add(dt);

			UniqueConstraint pk = new UniqueConstraint(a, false);

			dt.Constraints.Add(pk);
			ds.EnforceConstraints = true;

			this.txtNiceName.Enabled = false;

			this.col_0.HeaderText  = "Name";
			this.col_1.HeaderText  = "Alias";
			this.col_1.MappingName = "Alias";

			return dt;
		}
예제 #26
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++;
                }
            }
        }
 public BusinessObjectsPropertyRenderFullProperty(MyMeta.IColumn column, RequestContext context)
     : base(column, context)
 {
 }
예제 #28
0
        /// <summary>
        /// Build the parameters for concrete classes that contain primary key values that are placed
        /// inside the parentheses of the method.
        /// Example: public void SampleMethod(int Id) -- 'int Id' is what is injected into the method signature.
        /// This method can create a comma-separated set of parameters and their data types.
        /// </summary>
        /// <param name="m_ITable"></param>
        /// <returns></returns>
        public string RenderConcreteMethodParameters(MyMeta.ITable m_ITable)
        {
            string result = string.Empty;
            GetPrimaryKeys(m_ITable);

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

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

            return result;
        }
 /// <summary>
 /// This renders short properties with DataAnnotations Attributes.
 /// </summary>
 /// <param name="column"></param>
 /// <param name="context"></param>
 /// <example>
 /// [Required(ErrorMessage = "Category Name is required.")]
 /// [StringLength(50, ErrorMessage = "Category Name must be between 1 and 50 characters.")]
 /// [DisplayName("Category Name")]
 /// public string CategoryName { get; set; }
 /// </example>
 public BusinessObjectsPropertyRenderDataAnnotations(MyMeta.IColumn column, RequestContext context)
     : base(column, context)
 {
     this._util = context.Utility;
 }
예제 #30
0
 public void Insert(MyMeta.ITable table)
 {
 }