Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Admin_option nw = new Admin_option();

            nw.Show();
            this.Hide();
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Admin_option ado = new Admin_option();

            ado.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Fill up all the fields for login ");
                return;
            }

            try
            {
                Connection CN = new Connection();
                CN.thisConnection.Open();
                OracleCommand thiscommand = new OracleCommand();
                thiscommand.Connection  = CN.thisConnection;
                thiscommand.CommandText = "Select * From admin where username ='******' AND password='******'";
                OracleDataReader thisReader = thiscommand.ExecuteReader();

                if (thisReader.Read())
                {
                    Admin_option adop = new Admin_option();
                    adop.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Username or Password incorrect");
                }

                CN.thisConnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            Connection sv = new Connection();

            sv.thisConnection.Open();
            OracleCommand thiscommand = sv.thisConnection.CreateCommand();

            thiscommand.CommandText = "update admin set username = '******',password = '******' where password = '******'";

            thiscommand.Connection  = sv.thisConnection;
            thiscommand.CommandType = CommandType.Text;

            try
            {
                int a = thiscommand.ExecuteNonQuery();
                if (a == 1)
                {
                    MessageBox.Show("Updated Successfully");
                }

                else
                {
                    MessageBox.Show("Not Updated... Insert your old password Perfectly");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Not Uddated");
            }

            sv.thisConnection.Close();
            this.Close();

            Admin_option ob = new Admin_option();

            ob.Show();
            this.Hide();
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Connection sv = new Connection();

            sv.thisConnection.Open();

            OracleCommand thisCommand = sv.thisConnection.CreateCommand();

            thisCommand.CommandText = "select RoomNumber from New_User_add where RoomNumber = '" + textBox5.Text + "'";

            thisCommand.Connection  = sv.thisConnection;
            thisCommand.CommandType = CommandType.Text;

            try
            {
                OracleDataReader thisReader = thisCommand.ExecuteReader();
                while (thisReader.Read())
                {
                    string sp = thisReader["RoomNumber"].ToString();

                    try
                    {
                        if (sp != "")
                        {
                            MessageBox.Show("This Room has Already Booked!!!");
                            sv.thisConnection.Close();
                            return;
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Failure");
                    }
                }
                thisReader.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return;
            }
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || comboBox1.Text == "" || comboBox2.Text == "")
            {
                MessageBox.Show("Fill up fields then press ok");
                return;
            }

            OracleDataAdapter    thisAdaptor = new OracleDataAdapter("select * from New_User_add", sv.thisConnection);
            OracleCommandBuilder thisBuilder = new OracleCommandBuilder(thisAdaptor);

            DataSet thisDataSet = new DataSet();

            thisAdaptor.Fill(thisDataSet, "New_user_add");

            DataRow thisRow = thisDataSet.Tables["New_User_add"].NewRow();

            try
            {
                thisRow["Name"]        = textBox1.Text;
                thisRow["PhoneNumber"] = textBox2.Text;
                thisRow["Email"]       = textBox3.Text;
                thisRow["Address"]     = textBox4.Text;
                thisRow["Profession"]  = comboBox1.Text;
                thisRow["Gender"]      = comboBox2.Text;
                thisRow["entryDate"]   = dateTimePicker1.Value.Date.ToString();
                thisRow["exitDate"]    = dateTimePicker2.Value.Date.ToString();
                thisRow["RoomNumber"]  = textBox5.Text;

                thisDataSet.Tables["New_User_add"].Rows.Add(thisRow);

                thisAdaptor.Update(thisDataSet, "New_User_add");

                MessageBox.Show("Add");

                Admin_option ad = new Admin_option();
                ad.Show();
                this.Hide();
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("Fill up all fiels.Exceptation Occour !!!");
            }
            sv.thisConnection.Close();
        }