Exemplo n.º 1
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (levelNameTxt.Text == "")
            {
                levelErrorLabel.Visible = true;
            }
            else
            {
                levelErrorLabel.Visible = false;
            }
            if (levelErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error");
            }
            else
            {
                if (edit == 0) // code for SAVE operation
                {
                    levels c = new levels();

                    obj.st_insertlevel(levelNameTxt.Text);
                    obj.SubmitChanges();
                    MainClass.ShowMSG(levelNameTxt.Text + " added successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
                else if (edit == 1) // code for UPDATE
                {
                    obj.st_updatelevel(levelID, levelNameTxt.Text);

                    MainClass.ShowMSG(levelNameTxt.Text + " updated successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
            }
        }
        private void levelBtn_Click(object sender, EventArgs e)
        {
            levels lv = new levels();

            MainClass.showWindow(lv, this, MDI.ActiveForm);
        }