private void ROLES_Load(object sender, EventArgs e) { LoadRoles(); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); //add,delete,update..... }
public override void view_button_Click(object sender, EventArgs e) { CodingSourceClass.disable_reset(left_panel); LoadRoles(); CodingSourceClass.disable_reset(left_panel); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); }
public override void delete_button_Click(object sender, EventArgs e) { try { if (roles_textBox.Text != "" && roles_textBox.Enabled == false) { Hashtable ht = new Hashtable(); DialogResult dr = MessageBox.Show("Are you sure? ", "Question.....", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { //key , value ht.Add("@id", roleID); if (SQL_TASKS.insert_update_delete("st_deleteROLES", ht) > 0) { MainClass.CodingSourceClass.ShowMsg(roles_textBox.Text + " deleted successfully from the system.", "Success"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); LoadRoles(); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); } else { CodingSourceClass.ShowMsg("Unable to delete.", "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } } } else { CodingSourceClass.ShowMsg("Select a record to delete.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
public override void save_button_Click(object sender, EventArgs e) { if (roles_textBox.Text == "") { CodingSourceClass.ShowMsg("Please enter/select a role.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } else { if (edit == false) //code for save { Hashtable ht = new Hashtable(); ht.Add("@name", roles_textBox.Text); if (SQL_TASKS.insert_update_delete("st_insertROLES", ht) > 0) { CodingSourceClass.ShowMsg(roles_textBox.Text + " added successfully to the system.", "Success"); LoadRoles(); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); SQL_TASKS.TotalRecords("getTOTALROLES", total_roles_label); } else { CodingSourceClass.ShowMsg("Unable to save record.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } else if (edit == true) //code for update { Hashtable ht = new Hashtable(); ht.Add("@name", roles_textBox.Text); ht.Add("@id", roleID); if (SQL_TASKS.insert_update_delete("st_updateROLES", ht) > 0) { CodingSourceClass.ShowMsg(roles_textBox.Text + " updated successfully.", "Success"); LoadRoles(); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } else { CodingSourceClass.ShowMsg("Unable to update record.", "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } } } }