private void btnAddCategory_Click(object sender, EventArgs e) { this._Title = txtTitle.Text.Trim(); if (Validation(_Title) == "true") { if (categoryController.AddCategoryWithValue(MainForm.ID_USER, _Title, now) == true) { success.Message = "Thêm thể loại thành công."; success.ShowDialog(); ClearData(); BindData(); Dis_Enl_Button(false); } else { warning.Message = "Có lỗi, vui lòng thử lại."; warning.ShowDialog(); } } else { warning.Message = Validation(_Title); warning.ShowDialog(); } }
private void CreateNote_Load(object sender, EventArgs e) { if (MainForm.ID_USER == 0) { Application.Exit(); } else { if (MainForm.ID_NOTE == 0) { DataTable dt = categoryController.GetData(MainForm.ID_USER); if (dt.Rows.Count == 0) { success.Message = "Bạn chưa tạo thể loại nào, chúng tôi sẽ tự động tạo thể loại Untitled"; success.ShowDialog(); categoryController.AddCategoryWithValue(MainForm.ID_USER, "Untitled", now); } ResetField(); FillValue(); if (txtBodyNote.Text == "" || txtBodyNote.Text.Length == 0) { btnDone.Enabled = false; } else { btnDone.Enabled = true; } foreach (FontFamily font in FontFamily.Families) { fontPick.Items.Add(font.Name.ToString()); } } else { FillValueWithID(MainForm.ID_NOTE); btnDone.Enabled = false; btnReset.Enabled = false; } } }