Exemple #1
0
        public override void edit_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (TID_textBox.Text == "") { TID_errorlabel.Visible = true; } else { TID_errorlabel.Visible = false; }
                if (name_textBox.Text == "") { TName_errorlabel.Visible = true; } else { TName_errorlabel.Visible = false; }
                if (GenderDD.SelectedIndex == -1) { GenderDD_errorlabel.Visible = true; } else { GenderDD_errorlabel.Visible = false; }
                if (Phone_textBox.Text == "") { phone_errorlabel.Visible = true; } else { phone_errorlabel.Visible = false; }
                if (ClassDD.SelectedIndex == -1) { class_errorlabel.Visible = true; } else { class_errorlabel.Visible = false; }
                if (Address_textBox.Text == "") { address_errorlabel.Visible = true; } else { address_errorlabel.Visible = false; }

                if (TID_errorlabel.Visible || TName_errorlabel.Visible || GenderDD_errorlabel.Visible || phone_errorlabel.Visible || class_errorlabel.Visible || address_errorlabel.Visible)

                {
                    MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR");
                }
                else
                {
                    TeacherDB teacherDB = new TeacherDB();
                    teacherDB.Edit(TID_textBox, name_textBox, GenderDD, Phone_textBox, ClassDD, Address_textBox);
                    MainClass.reset_disable(panel4);
                    ShowData();
                }
                Disable_errorlabel();
            }
            catch
            {
                MainClass.MSGBox("Oops... Teacher Not Updated", "Error", "Error");
            }

        }
Exemple #2
0
        //Edit Button
        public override void edit_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (classesname_textBox.Text == "")
                {
                    classname_errorlabel.Visible = true;
                }
                else
                {
                    classname_errorlabel.Visible = false;
                }

                if (classname_errorlabel.Visible)
                {
                    MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR");
                }
                else
                {
                    ClassDB classDB = new ClassDB();
                    classDB.edit(classesname_textBox);
                    MainClass.reset_disable(panel4);
                    ShowData();
                }
                Disable_errorlabel();
            }
            catch
            {
                MainClass.MSGBox("Oops... Class Not Updated", "Error", "Error");
            }
        }
Exemple #3
0
        //Add Button
        public override void add_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (classesname_textBox.Text == "")
                {
                    classname_errorlabel.Visible = true;
                }
                else
                {
                    classname_errorlabel.Visible = false;
                }

                if (classname_errorlabel.Visible)
                {
                    MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR");
                }
                else
                {
                    ClassDB classDB = new ClassDB();
                    classDB.add(classesname_textBox);
                    MainClass.reset_disable(panel4);
                    ShowData();
                }
                Disable_errorlabel();
            }
            catch
            {
                MainClass.MSGBox("Something Went Wrong", "ERROR", "ERROR");
            }
        }
Exemple #4
0
 public override void add(TextBox textbox)
 {
     sqlConnection.Open();
     sqlCommand = new SqlCommand("Insert into Classes values( '" + textbox.Text + "')", sqlConnection);
     sqlCommand.ExecuteNonQuery();
     MainClass.MSGBox(textbox.Text + " Inserted Successfully", "Success", "Success");
     sqlConnection.Close();
 }
 public override void Add(TextBox sid, TextBox sname, ComboBox gender, DateTimePicker DOB_Picker, TextBox phone, ComboBox classassigned)
 {
     sqlConnection.Open();
     sqlCommand = new SqlCommand("Insert into Student values( " + sid.Text + ",'" + sname.Text + "','" + gender.SelectedItem.ToString() + "','" + DOB_Picker.Text + "','" + phone.Text + "','" + classassigned.SelectedValue.ToString() + "')", sqlConnection);
     sqlCommand.ExecuteNonQuery();
     MainClass.MSGBox(sname.Text + " Inserted Successfully", "Success", "Success");
     sqlConnection.Close();
 }
Exemple #6
0
 public override void Add(TextBox uid, TextBox uname, TextBox pswd)
 {
     sqlConnection.Open();
     sqlCommand = new SqlCommand("Insert into Users values( " + uid.Text + ",'" + uname.Text + "','" + pswd.Text + "')", sqlConnection);
     sqlCommand.ExecuteNonQuery();
     MainClass.MSGBox(uname.Text + " Inserted Successfully", "Success", "Success");
     sqlConnection.Close();
 }
Exemple #7
0
 public override void Add(TextBox feenum, ComboBox sid, TextBox sname, DateTimePicker period, TextBox amount)
 {
     sqlConnection.Open();
     sqlCommand = new SqlCommand("Insert into Fees values( " + feenum.Text + ",'" + sid.SelectedValue.ToString() + "','" + sname.Text + "','" + period.Text + "','" + amount.Text + "')", sqlConnection);
     sqlCommand.ExecuteNonQuery();
     MainClass.MSGBox("Fee Inserted Successfully", "Success", "Success");
     sqlConnection.Close();
 }
Exemple #8
0
 public override void Add(TextBox tid, TextBox tname, ComboBox gender, TextBox phone, ComboBox classassigned, TextBox address)
 {
     sqlConnection.Open();
     sqlCommand = new SqlCommand("Insert into Teacher values( " + tid.Text + ",'" + tname.Text + "','" + gender.SelectedItem.ToString() + "','" + phone.Text + "','" + classassigned.SelectedValue.ToString() + "','" + address.Text + "')", sqlConnection);
     sqlCommand.ExecuteNonQuery();
     MainClass.MSGBox(tname.Text + " Inserted Successfully", "Success", "Success");
     sqlConnection.Close();
 }
Exemple #9
0
        public override void Delete(TextBox uid, TextBox uname, TextBox pswd)
        {
            sqlConnection.Open();
            string query = "Delete from Users where user_ID=" + uid.Text + ";";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(uname.Text + " Deleted Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #10
0
        public override void Delete(TextBox tid, TextBox tname, ComboBox gender, TextBox phone, ComboBox classassigned, TextBox address)
        {
            sqlConnection.Open();
            string query = "Delete from Teacher where [Teacher ID]=" + tid.Text + ";";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(tname.Text + " Deleted Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #11
0
        public override void Delete(TextBox feenum, ComboBox sid, TextBox sname, DateTimePicker period, TextBox amount)
        {
            sqlConnection.Open();
            string query = "Delete from Fees where [Fee Num]=" + feenum.Text + ";";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox("Fee Deleted Successfully", "Success", "Success");
            sqlConnection.Close();
        }
        public override void Delete(TextBox sid, TextBox sname, ComboBox gender, DateTimePicker DOB_Picker, TextBox phone, ComboBox classassigned)
        {
            sqlConnection.Open();
            string query = "Delete from Student where [Student ID]=" + sid.Text + ";";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(sname.Text + " Deleted Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #13
0
        public override void delete(TextBox textbox)
        {
            sqlConnection.Open();
            string query = "Delete from Classes where [Class Name]= @classname;";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.Parameters.AddWithValue("@classname", textbox.Text);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(textbox.Text + " Deleted Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #14
0
        public override void edit(TextBox name)
        {
            sqlConnection.Open();
            string query = "Update Classes set [Class Name] = @classname where [Class ID] = @classid";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.Parameters.AddWithValue("@classid", classid);
            sqlCommand.Parameters.AddWithValue("@classname", name.Text);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(name.Text + " Updated Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #15
0
        public override void Edit(TextBox uid, TextBox uname, TextBox pswd)
        {
            sqlConnection.Open();
            string query = "Update Users set user_Name = @uname , " + "user_Password = @pswd where user_ID = @id";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.Parameters.AddWithValue("@id", uid.Text);
            sqlCommand.Parameters.AddWithValue("@uname", uname.Text);
            sqlCommand.Parameters.AddWithValue("@pswd", pswd.Text);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(uname.Text + " Updated Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #16
0
        private void login_Btn_Click(object sender, EventArgs e)
        {
            //Encapsulation Set the textbox in private variable of login
            user_login lg = new user_login();

            lg.UNAME = usernameTxt.Text;
            lg.PSWD  = pswdTxt.Text;
            if (usernameTxt.Text == "")
            {
                username_errorlabel.Visible = true;
            }
            else
            {
                username_errorlabel.Visible = false;
            }
            if (pswdTxt.Text == "")
            {
                pswd_errorlabel.Visible = true;
            }
            else
            {
                pswd_errorlabel.Visible = false;
            }

            if (username_errorlabel.Visible || pswd_errorlabel.Visible)
            {
                MainClass.MSGBox("Field with * are mandatory.", "Error", "Error");
            }
            else
            {
                conn.Open();
                string         query = "SELECT * FROM Users WHERE [user_Name] ='" + lg.UNAME + "' AND [user_Password] ='" + lg.PSWD + "'";;
                SqlCommand     cmd   = new SqlCommand(query, conn);
                SqlDataAdapter da    = new SqlDataAdapter(cmd);
                DataTable      dt    = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    MainClass.MSGBox("Login SucessFully", "Congrats", "Success");
                    Dashboard dashboard = new Dashboard();
                    dashboard.Show();
                    this.Hide();
                }
                else
                {
                    MainClass.MSGBox("Invalid Details", "ERROR", "Error");
                }
                conn.Close();
            }
        }
Exemple #17
0
        public override void Edit(TextBox feenum, ComboBox sid, TextBox sname, DateTimePicker period, TextBox amount)
        {
            sqlConnection.Open();
            string query = @"Update Fees set [Fee Num] = @num,
                                                     [Std ID] = @sid, 
                                                     [Std Name] = @sname ,
                                                     [Fee Period] = @period,
                                                     [Fee Amount] = @fee where [Fee Num] = @num";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.Parameters.AddWithValue("@num", feenum.Text);
            sqlCommand.Parameters.AddWithValue("@sid", sid.SelectedValue.ToString());
            sqlCommand.Parameters.AddWithValue("@sname", sname.Text);
            sqlCommand.Parameters.AddWithValue("@period", period.Text);
            sqlCommand.Parameters.AddWithValue("@fee", amount.Text);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(sname.Text + " Updated Successfully", "Success", "Success");
            sqlConnection.Close();
        }
        public override void Edit(TextBox sid, TextBox sname, ComboBox gender, DateTimePicker DOB_Picker, TextBox phone, ComboBox classassigned)
        {
            sqlConnection.Open();
            string query = @"Update Student set [Student ID] = @id, 
                                                        [Student Name] = @sname ,
                                                        [Gender] = @sgender, [Date Of Birth] = @dob,
                                                        [Phone] = @phone,
                                                        [Class Assigned] = @class where [Student ID] = @id";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.Parameters.AddWithValue("@id", sid.Text);
            sqlCommand.Parameters.AddWithValue("@sname", sname.Text);
            sqlCommand.Parameters.AddWithValue("@sgender", gender.SelectedItem.ToString());
            sqlCommand.Parameters.AddWithValue("@dob", DOB_Picker.Text);
            sqlCommand.Parameters.AddWithValue("@phone", phone.Text);
            sqlCommand.Parameters.AddWithValue("@class", classassigned.SelectedValue.ToString());
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(sname.Text + " Updated Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #19
0
        public override void Edit(TextBox tid, TextBox tname, ComboBox gender, TextBox phone, ComboBox classassigned, TextBox address)
        {
            sqlConnection.Open();
            string query = @"Update Teacher set [Teacher ID] = @id, 
                                                        [Teacher Name] = @tname ,
                                                        [Teacher Gender] = @tgender,
                                                        [Teacher Phone] = @phone,
                                                        [Teacher Class Assigned] = @class,
                                                        [Teacher Address] = @address where [Teacher ID] = @id";

            sqlCommand = new SqlCommand(query, sqlConnection);
            sqlCommand.Parameters.AddWithValue("@id", tid.Text);
            sqlCommand.Parameters.AddWithValue("@tname", tname.Text);
            sqlCommand.Parameters.AddWithValue("@tgender", gender.SelectedItem.ToString());
            sqlCommand.Parameters.AddWithValue("@phone", phone.Text);
            sqlCommand.Parameters.AddWithValue("@class", classassigned.SelectedValue.ToString());
            sqlCommand.Parameters.AddWithValue("@address", address.Text);
            sqlCommand.ExecuteNonQuery();
            MainClass.MSGBox(tname.Text + " Updated Successfully", "Success", "Success");
            sqlConnection.Close();
        }
Exemple #20
0
 public override void delete_Btn_Click(object sender, EventArgs e)
 {
     try
     {
         if (Num_textBox.Text == "")
         {
             MainClass.MSGBox("Enter Fee Id", "Error", "Error");
         }
         else
         {
             FeeDB feeDB = new FeeDB();
             feeDB.Delete(Num_textBox, StdID_DD, name_textBox, Period_picker, amount_textBox);
             MainClass.Disable(panel4);
             ShowData();
         }
     }
     catch
     {
         MainClass.MSGBox("Oopss... Student Not Deleted!!", "Error", "Error");
     }
     Disable_errorlabel();
 }
Exemple #21
0
 public override void delete_Btn_Click(object sender, EventArgs e)
 {
     try
     {
         if (SID_textBox.Text == "")
         {
             MainClass.MSGBox("Enter Student Id", "Error", "Error");
         }
         else
         {
             StudentDB studentDB = new StudentDB();
             studentDB.Delete(SID_textBox, name_textBox, GenderDD, DOB_Picker, Phone_textBox, ClassDD);
             MainClass.Disable(panel4);
             ShowData();
         }
     }
     catch
     {
         MainClass.MSGBox("Oopss... Student Not Deleted!!", "Error", "Error");
     }
     Disable_errorlabel();
 }
Exemple #22
0
 public override void delete_Btn_Click(object sender, EventArgs e)
 {
     try
     {
         if (TID_textBox.Text == "")
         {
             MainClass.MSGBox("Enter Teacher Id", "Error", "Error");
         }
         else
         {
             TeacherDB teacherDB = new TeacherDB();
             teacherDB.Delete(TID_textBox, name_textBox, GenderDD, Phone_textBox, ClassDD, Address_textBox);
             MainClass.Disable(panel4);
             ShowData();
         }
     }
     catch
     {
         MainClass.MSGBox("Oopss... Teacher Not Deleted!!", "Error", "Error");
     }
     Disable_errorlabel();
 }
Exemple #23
0
 //Delete Button
 public override void delete_Btn_Click(object sender, EventArgs e)
 {
     try
     {
         if (classesname_textBox.Text == "")
         {
             MainClass.MSGBox("Enter Class Name", "Error", "Error");
         }
         else
         {
             ClassDB classDB = new ClassDB();
             classDB.delete(classesname_textBox);
             MainClass.Disable(panel4);
             ShowData();
         }
     }
     catch
     {
         MainClass.MSGBox("Oopss... Class Not Deleted!!", "Error", "Error");
     }
     Disable_errorlabel();
 }
Exemple #24
0
 //Delete Button
 public override void delete_Btn_Click(object sender, EventArgs e)
 {
     try
     {
         if (UserID_textBox.Text == "")
         {
             MainClass.MSGBox("Enter User ID", "Error", "Error");
         }
         else
         {
             UsersDB usersDB = new UsersDB();
             usersDB.Delete(UserID_textBox, username_textBox, userpswd_textBox);
             MainClass.Disable(panel4);
             ShowData();
         }
     }
     catch
     {
         MainClass.MSGBox("Oopss... User Not Deleted!!", "Error", "Error");
     }
     Disable_errorlabel();
 }
Exemple #25
0
        public override void add_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (UserID_textBox.Text == "")
                {
                    UID_errorlabel.Visible = true;
                }
                else
                {
                    UID_errorlabel.Visible = false;
                }
                if (username_textBox.Text == "")
                {
                    UName_errorlabel.Visible = true;
                }
                else
                {
                    UName_errorlabel.Visible = false;
                }
                if (userpswd_textBox.Text == "")
                {
                    UPswd_errorlabel.Visible = true;
                }
                else
                {
                    UPswd_errorlabel.Visible = false;
                }
                if (upswdrtype_textBox.Text == "")
                {
                    uretypepswd_errorlabel.Visible = true;
                }
                else
                {
                    uretypepswd_errorlabel.Visible = false;
                }
                if (upswdrtype_textBox.Text != userpswd_textBox.Text)
                {
                    mismatched_label.Visible = true;
                }
                else
                {
                    mismatched_label.Visible = false;
                }

                if (UID_errorlabel.Visible || UName_errorlabel.Visible || UPswd_errorlabel.Visible || uretypepswd_errorlabel.Visible || mismatched_label.Visible)
                {
                    MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR");
                }
                else
                {
                    UsersDB usersDB = new UsersDB();
                    usersDB.Add(UserID_textBox, username_textBox, userpswd_textBox);
                    MainClass.reset_disable(panel4);
                    ShowData();
                }
                Disable_errorlabel();
            }
            catch
            {
                MainClass.MSGBox("Something Went Wrong", "ERROR", "ERROR");
            }
        }
Exemple #26
0
        public override void add_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (SID_textBox.Text == "")
                {
                    SID_errorlabel.Visible = true;
                }
                else
                {
                    SID_errorlabel.Visible = false;
                }
                if (name_textBox.Text == "")
                {
                    SName_errorlabel.Visible = true;
                }
                else
                {
                    SName_errorlabel.Visible = false;
                }
                if (GenderDD.SelectedIndex == -1)
                {
                    GenderDD_errorlabel.Visible = true;
                }
                else
                {
                    GenderDD_errorlabel.Visible = false;
                }
                if (DOB_Picker.Text == "")
                {
                    DOB_errorlabel.Visible = true;
                }
                else
                {
                    DOB_errorlabel.Visible = false;
                }
                if (Phone_textBox.Text == "")
                {
                    phone_errorlabel.Visible = true;
                }
                else
                {
                    phone_errorlabel.Visible = false;
                }
                if (ClassDD.SelectedIndex == -1)
                {
                    class_errorlabel.Visible = true;
                }
                else
                {
                    class_errorlabel.Visible = false;
                }

                if (SID_errorlabel.Visible || SName_errorlabel.Visible || GenderDD_errorlabel.Visible || DOB_errorlabel.Visible || phone_errorlabel.Visible || class_errorlabel.Visible)
                {
                    MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR");
                }
                else
                {
                    StudentDB studentDB = new StudentDB();
                    studentDB.Add(SID_textBox, name_textBox, GenderDD, DOB_Picker, Phone_textBox, ClassDD);
                    MainClass.reset_disable(panel4);
                    ShowData();
                }
                Disable_errorlabel();
            }
            catch (Exception ex)
            {
                MainClass.MSGBox(ex.Message, "ERROR", "ERROR");
            }
        }
Exemple #27
0
        public override void edit_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (Num_textBox.Text == "")
                {
                    num_errorlabel.Visible = true;
                }
                else
                {
                    num_errorlabel.Visible = false;
                }
                if (StdID_DD.SelectedIndex == -1)
                {
                    SID_errorlabel.Visible = true;
                }
                else
                {
                    SID_errorlabel.Visible = false;
                }
                if (name_textBox.Text == "")
                {
                    name_errorlabel.Visible = true;
                }
                else
                {
                    name_errorlabel.Visible = false;
                }
                if (Period_picker.Text == "")
                {
                    period_errorlabel.Visible = true;
                }
                else
                {
                    period_errorlabel.Visible = false;
                }
                if (amount_textBox.Text == "")
                {
                    amount_errorlabel.Visible = true;
                }
                else
                {
                    amount_errorlabel.Visible = false;
                }

                if (num_errorlabel.Visible || SID_errorlabel.Visible || name_errorlabel.Visible || period_errorlabel.Visible || amount_errorlabel.Visible)

                {
                    MainClass.MSGBox("Fields * are Mandatory", "Fill all Fields", "ERROR");
                }
                else
                {
                    FeeDB feeDB = new FeeDB();
                    feeDB.Edit(Num_textBox, StdID_DD, name_textBox, Period_picker, amount_textBox);
                    MainClass.reset_disable(panel4);
                    ShowData();
                }
                Disable_errorlabel();
            }
            catch (Exception m)
            {
                MainClass.MSGBox(m.Message, "Error", "Error");
            }
        }