public frmAddEditAttribute(SmartB1tCSClass currCS) { InitializeComponent(); this.currCS = currCS; FillWithCustomTypes(); cbDataType.SelectedIndex = 0; }
private void btnOK_Click(object sender, EventArgs e) { if (txtClassname.Text != "") { if (!ClassExistsByName(txtClassname.Text)) { if (sb_class == null) { //Add class SmartB1tCSClass cs = new SmartB1tCSClass(txtClassname.Text); GlobalData.GlobalProject.Classes.Add(cs); } else { //Update class sb_class.ClassName = txtClassname.Text; } GlobalData.GlobalProject.Classes.Sort(new Comparison <SmartB1tCSClass>(CompareClassesByName)); DialogResult = DialogResult.OK; } else { MessageBox.Show("Already exists a class with such name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Class name cannot be blank.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmAddEditClass(SmartB1tCSClass sb_class) { InitializeComponent(); Text = "Edit class"; this.sb_class = sb_class; txtClassname.Text = sb_class.ClassName; }
private void btnRemove_Click(object sender, EventArgs e) { if (cbClasses.Items.Count > 0) { DialogResult dr = MessageBox.Show($"Do you confirm you wish to remove the class '{(cbClasses.SelectedItem as SmartB1tCSClass).ClassName}'? \r\nAll of its attribute's data will be lost!!!", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { SmartB1tCSClass cs = cbClasses.SelectedItem as SmartB1tCSClass; GlobalData.GlobalProject.Classes.Remove(cs); ReloadClasses(); } } }
private void btnRemoveAttribute_Click(object sender, EventArgs e) { if (cbAttributes.Items.Count > 0) { if (MessageBox.Show("Do you confirm you wish to remove the attribute?", "Remove attribute", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SmartB1tCSClass cs = cbClasses.SelectedItem as SmartB1tCSClass; SmartB1tCSVar csv = cbAttributes.SelectedItem as SmartB1tCSVar; GlobalData.GlobalProject.Classes.Remove(cs); ReloadAttributes(); } } }
public frmAddEditAttribute(SmartB1tCSClass currCS, SmartB1tCSVar currVar) { InitializeComponent(); Text = "Edit attribute"; this.currCS = currCS; editVar = currVar; FillWithCustomTypes(); txtVarname.Text = currVar.VarName; if (currVar.IsCustomType) { cbDataType.SelectedItem = currCS; } else { cbDataType.SelectedItem = currVar.DataType; } }
static void Main(string[] args) { SmartB1tCSProject proj = new SmartB1tCSProject("PersonTest"); SmartB1tCSClass cs = new SmartB1tCSClass("File"); cs.Fields.AddRange( new SmartB1tCSVar[] { new SmartB1tCSVar("string", "filename"), new SmartB1tCSVar("System.DateTime", "creationTime"), new SmartB1tCSVar("long", "filesize"), } ); proj.Classes.Add(cs); proj.Export(AppDomain.CurrentDomain.BaseDirectory); /*MySQLConnector.CurrentConnection.SetConnection("localhost", "root", "", "test"); * List<Person> people = MySQLConnector.CurrentConnection.ExecuteStoredProcedure("SelectPeople").GetList<Person>(); * foreach (var p in people) * Console.WriteLine($"Fullname: {p.FirstName} {p.LastName}, Phonenumber: {p.PhoneNumber}, Added: {p.AddedDate.ToShortDateString()}, Salary: {p.Salary}"); * Console.ReadKey();*/ }
private int CompareClassesByName(SmartB1tCSClass cs1, SmartB1tCSClass cs2) { return(string.CompareOrdinal(cs1.ClassName, cs2.ClassName)); }