public string GetSqlDataTypeDefinition() { string result = BLDataType.GenerateSqlDataTypeDefinition(this); if (IsPrimaryKey) { result += " primary key"; } if (IsIdentity && ParentInterface.GetCoreInterface().Type != Core.CoreInterfaceType.DEF_TABLE) { result += " auto_increment"; } if (IsNotNull || IsPrimaryKey) { result += " not null"; } return(result); }
public virtual void AddElement(Element element) { elementPositions.Add(element.Position); element.Position = Position + new Vector2(UI.BGOffset, (HasTitleBar ? tbSize : 0) + UI.BGOffset) + element.Position; elements.Add(element); element.TransferToInterface(ParentInterface); if (ParentInterface.BEContains(element)) { element.TransferToFront(); } else { element.MoveToFront(); } if (closed) { Close(); } }
public void AddElement(Element element, int x, int y) { elementPositions.Add(new Vector2(x * tileSize.X, y * tileSize.Y)); element.Position = Position + new Vector2(UI.BGOffset, (HasTitleBar ? tbSize : 0) + UI.BGOffset) + elementPositions.Last(); element.Size = tileSize - new Vector2(UI.BGOffset * 2); elements.Add(element); element.TransferToInterface(ParentInterface); if (ParentInterface.BEContains(element)) { element.TransferToFront(); } else { element.MoveToFront(); } if (closed) { Close(); } }
public static void Start() { SortedDictionary <int, List <Load> > Queue = new SortedDictionary <int, List <Load> >(); foreach (int i in Enum.GetValues(typeof(Priority))) { List <Load> list = new List <Load>(); Queue.Add(i, list); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); m_parentInterface = new ParentInterface(); m_logInterface = new LogInterface(); m_logInterface.MdiParent = m_parentInterface; Assembly ourAssembly = Assembly.GetExecutingAssembly(); //This is where we will search for and queue all loading attributes foreach (Type type in ourAssembly.GetTypes()) { //First of all, search the class for a load method if possible Load[] load = (Load[])type.GetCustomAttributes(typeof(Load), false); if (load.Length > 0) { if (load[0].VisibleName == "") { load[0].VisibleName = type.Name; } load[0].Type = type; Queue[(int)load[0].Priority].Add(load[0]); } //Now search for any initialize static methods foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { load = (Load[])method.GetCustomAttributes(typeof(Load), false); foreach (Load loadItem in load) { if (loadItem.VisibleName == "") { loadItem.VisibleName = method.Name; } loadItem.Type = type; loadItem.Initialize = method; Queue[(int)loadItem.Priority].Add(loadItem); } } } //This is where we enumerate the load queue and start activating things in order foreach (List <Load> list in Queue.Values) { foreach (Load load in list) { if (load.IsClass) { try { Log("Loading dynamic content: {0}\n", load.VisibleName); Activator.CreateInstance(load.Type, load.Parameters); } catch (Exception exception) { MessageBox.Show("An error has occured, the program must now close.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Application.Exit(); } } else { Log("Executing static method: {0}\n", load.VisibleName); load.Initialize.Invoke(null, null); } } } }
public virtual void TransferToFront() { ParentInterface.Transfer(this, true); }
public virtual void MoveToFront() { ParentInterface.PushToFront(this); }
public virtual void Dispose() { ParentInterface.Remove(this); }
static void Main(string[] args) { #region Determine if string1 is a Palindrome of string2 //Palindrome PalindromeCheck = new Palindrome(); //PalindromeCheck.IsPalindrome("cat", "tac"); //PalindromeCheck.IsPalindrome("cat", "tca"); //PalindromeCheck.IsPalindrome("cat", "act"); //PalindromeCheck.IsPalindrome("cat", "atc"); #endregion #region Determine if the brackets are properly formed #endregion #region - Reverse a char[] without using a stack char[] str = "GeeksQuiz".ToCharArray(); string test = "Hello"; Console.WriteLine("Before calling the reverse method string is " + String.Join("", str)); ReverseString_NoStack.ReverseArray(str); Console.WriteLine("After calling the reverse method string is " + String.Join("", str)); #endregion #region Modify a string reference Console.WriteLine("Before calling AddTextToString test = " + test); ReverseString_NoStack.AddTextToString(ref test); Console.WriteLine("After calling AddTextToString test = " + test); #endregion #region Reverse a char[] and a string using a stack Console.WriteLine("Before calling the ReverseArray method string is " + String.Join("", str)); ReverseStringUsingStack.ReverseArray(str); Console.WriteLine("After calling the ReverseArray method string is " + String.Join("", str)); string StringToReverse = "GeeksQuiz"; Console.WriteLine("Before calling the ReverseString method string is " + StringToReverse); string ReversedString = ReverseStringUsingStack.ReverseString(StringToReverse); Console.WriteLine("After calling the ReverseString method string is " + ReversedString); Console.WriteLine("Before calling the ReverseTheString method string is " + StringToReverse); ReversedString = Stacks.ReverseString.ReverseTheString(StringToReverse); Console.WriteLine("After calling the ReverseTheString method string is " + ReversedString); #endregion #region Performance Test: String Concatenation vs StringBuilder //StringPerformanceTest.StringVSStringBuilder(10000); #endregion #region - Polymorphism Circle circle = new Circle(); Console.WriteLine("Circle area = " + circle.Area()); Rectangle rectangle = new Rectangle(); Console.WriteLine("Rectangle area = " + rectangle.Area()); Salary Pay = new Salary(); Console.WriteLine("Weekly pay for hourly worker making 15.50/hour for 40 hours = " + Pay.WeeklyPay(40, 15.50m)); Console.WriteLine("Weekly pay for Salary worker making 104k per year = " + Pay.WeeklyPay(104000)); #endregion #region - Implement Interfaces ParentInterface Parent = new ParentInterface(); Parent.ParentInterfaceMethod(); ChildInterface Child = new ChildInterface(); Child.ParentInterfaceMethod(); Child.ChildInterfaceMethod(); #endregion #region - Are brackets well formed BracketTest Brackets = new BracketTest(); string BracketString = "()({})[}[]"; if (Brackets.AreBracketsWellFormed(BracketString)) { Console.WriteLine("PASS: The following string does have well formed brackets: '" + BracketString + "'"); } else { Console.WriteLine("FAIL: The following string does not have well formed brackets: '" + BracketString + "'"); } #endregion #region - Recursion // Factorial Factorial FactorialNumber = new Factorial(); int Number = 5; Console.WriteLine("The factorial of " + Number + " is " + FactorialNumber.GetFactorial(Number)); // Retrieve files from folder and all subfolders string FolderPath = @"C:\Temp\Aspect"; List <string> ListOfFiles = new List <string>(); Files.GetFiles(FolderPath, ref ListOfFiles); #endregion #region - Dictionaries int Year = 2019; Dictionary <string, int> DaysPerMonth = new Dictionary.DictionaryTest().GetDaysPerMonth(Year); foreach (KeyValuePair <string, int> items in DaysPerMonth) { Console.WriteLine("The month of: " + items.Key + " has " + items.Value + " days in the year: " + Year); } Year = 2020; DaysPerMonth = new Dictionary.DictionaryTest().GetDaysPerMonth(Year); foreach (KeyValuePair <string, int> items in DaysPerMonth) { Console.WriteLine("The month of: " + items.Key + " has " + items.Value + " days in the year: " + Year); } DaysPerMonth.TryGetValue("November", out int value); Console.WriteLine("The month of: " + "November" + " has " + value + " days in the year: " + Year); #endregion #region - REST WebRequest Request = new WebRequest(); HttpResponseMessage Response = Request.GetCurrentWeather("03079"); JValue WeatherDetails = Request.GetCurrentWeather2("03079"); Console.WriteLine("The End"); #endregion }