Exemplo n.º 1
0
        public override void GenForm()
        {
            Button b = ControlGenerator.CreateButton(10, 10, Settings.formWidth - 40, 50, "Insert");

            ControlGenerator.BindNavButton(b, new FormInsert());
            b = ControlGenerator.CreateButton(10, 70, Settings.formWidth - 40, 50, "Update/Delete");
            ControlGenerator.BindNavButton(b, new FormUpdateDelete());
            b = ControlGenerator.CreateButton(10, 130, Settings.formWidth - 40, 50, "Search");
            ControlGenerator.BindNavButton(b, new FormSearch());
        }
Exemplo n.º 2
0
 private static void CreateFieldLabelsandText(string sql, bool useData = false)
 {
     using (SqlConnection con = new SqlConnection(connectionString))
     {
         con.Open();
         try
         {
             using (SqlCommand command = new SqlCommand(sql, con))
             {
                 using (SqlDataReader reader = command.ExecuteReader())
                 {
                     for (int i = 0; i < reader.FieldCount; i++)
                     {
                         string field = reader.GetName(i);
                         Label  l     = ControlGenerator.CreateLabel(0, 0, field);
                         tableData.Controls.Add(l);
                         if (useData)
                         {
                             TextBox t = ControlGenerator.CreateTextBox(0, 0, Settings.formWidth - 50, 50);
                             t.Name = "textBox" + field;
                             tableData.Controls.Add(t);
                             tableData.SetFlowBreak(t, true);
                         }
                         else
                         {
                             tableData.SetFlowBreak(l, true);
                         }
                     }
                 }
             }
         }
         catch (SqlException e)
         {
             HandleError(e);
         }
         try
         {
             string f = getPKFromTable.Replace("table", currentTableData);
             using (SqlCommand command = new SqlCommand(f, con))
             {
                 using (SqlDataReader reader = command.ExecuteReader())
                 {
                     reader.Read();
                     PKColumnName = reader.GetString(0);
                 }
             }
         }
         catch (SqlException e)
         {
             HandleError(e);
         }
     }
 }
Exemplo n.º 3
0
        public override void GenForm()
        {
            ControlGenerator.CreateLabel(10, 10, "Insert");
            Button b = ControlGenerator.CreateButton(10, 40, 100, 50, "Back");

            ControlGenerator.BindNavButton(b, new FormMain());
            ControlGenerator.CreateLabel(120, 10, "Select table");
            ComboBox c = ControlGenerator.CreateComboBox(120, 40, 100);

            ControlGenerator.SetComboBoxToTableList(c);
            b = ControlGenerator.CreateButton(250, 40, 100, 50, "Insert");
            ControlGenerator.BindInsertButton(b);
            ControlGenerator.BindComboBoxLoadTableInfo(c, 10, 100, false);
        }
Exemplo n.º 4
0
 private static void CreateInitialFlowLayout(int x, int y)
 {
     if (tableData != null)
     {
         foreach (Control c in tableData.Controls)
         {
             ControlGenerator.RemoveControl(c);
         }
         tableData.Controls.Clear();
     }
     ControlGenerator.RemoveControl(tableData);
     tableData          = ControlGenerator.CreateFlowLayoutPanel();
     tableData.Height   = Settings.formHeight - y - 20;
     tableData.Width    = Settings.formWidth - x - 20;
     tableData.Location = new Point(x, y);
 }
Exemplo n.º 5
0
        public override void GenForm()
        {
            ControlGenerator.CreateLabel(10, 10, "Update/Delete");
            Button b = ControlGenerator.CreateButton(10, 40, 100, 50, "Back");

            ControlGenerator.BindNavButton(b, new FormMain());
            ControlGenerator.CreateLabel(120, 10, "Select table");
            ComboBox c = ControlGenerator.CreateComboBox(120, 40, 100);

            ControlGenerator.SetComboBoxToTableList(c);
            ControlGenerator.BindComboBoxLoadTableInfo(c, 10, 100, true);
            b = ControlGenerator.CreateButton(250, 40, 100, 50, "Update");
            ControlGenerator.BindUpdateButton(b);
            b = ControlGenerator.CreateButton(360, 40, 100, 50, "Delete");
            ControlGenerator.BindDeleteButton(b);
            b = ControlGenerator.CreateButton(120, 70, 50, 30, "<");
            ControlGenerator.BindChangeRecord(b, false);
            b = ControlGenerator.CreateButton(190, 70, 50, 30, ">");
            ControlGenerator.BindChangeRecord(b, true);
        }
Exemplo n.º 6
0
        public override void GenForm()
        {
            ControlGenerator.CreateLabel(10, 10, "Search");
            Button b = ControlGenerator.CreateButton(10, 40, 100, 50, "Back");

            ControlGenerator.BindNavButton(b, new FormMain());
            ControlGenerator.CreateLabel(120, 10, "Select table");
            ComboBox c = ControlGenerator.CreateComboBox(120, 40, 100);

            ControlGenerator.SetComboBoxToTableList(c);
            ControlGenerator.CreateLabel(120, 80, "Select Field");
            ComboBox c2 = ControlGenerator.CreateComboBox(120, 110, 100);

            ControlGenerator.SetComboBoxToFillTableFieldsOfComboBox(c, c2);
            ControlGenerator.CreateLabel(120, 160, "Type search parameters");
            TextBox t = ControlGenerator.CreateTextBox(120, 190, 120, 100);

            b = ControlGenerator.CreateButton(260, 40, 100, 100, "Search");
            ControlGenerator.BindSearch(b, 10, 250, c, c2, t);
            b = ControlGenerator.CreateButton(370, 70, 50, 30, "<");
            ControlGenerator.BindChangeRecord(b, false);
            b = ControlGenerator.CreateButton(420, 70, 50, 30, ">");
            ControlGenerator.BindChangeRecord(b, true);
        }