コード例 #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ManagerAccess mn = new ManagerAccess();

            mn.Show();
            this.Close();
        }
コード例 #2
0
        private void btn_submit_click(object sender, RoutedEventArgs e)
        {
            string username, password;

            username = "******";
            password = "******";

            if (username == txt_user.Text && password == txt_pass.Password)
            {
                ManagerAccess mn = new ManagerAccess();
                mn.Show();
                this.Close();
            }
            else if (username == txt_user.Text && password != txt_pass.Password)
            {
                MessageBox.Show("Password Not Matched");
                txt_pass.Password = "";
                txt_pass.Focus();
            }
            else if (username != txt_user.Text && password == txt_pass.Password)
            {
                MessageBox.Show("Username Not Matched");
                txt_user.Text = "";
                txt_user.Focus();
            }
            else
            {
                MessageBox.Show("Username and Password Not matched");
                txt_user.Text     = "";
                txt_pass.Password = "";
                txt_user.Focus();
            }
        }
コード例 #3
0
        private void btn_employee_submit_click(object sender, RoutedEventArgs e)
        {
            try
            {
                con = new SqlConnection(@"Data Source=DESKTOP-2CGPE2S\MSSQLSERVER3;Initial Catalog=HotelManagement;Integrated Security=True");
                con.Open();
                cmd = new SqlCommand("INSERT INTO employee (name,address,phone,age,religion,salary,date) VALUES (@name,@address,@phone,@age,@religion,@salary,@date)", con);
                cmd.Parameters.AddWithValue("@name", txt_name.Text);
                cmd.Parameters.AddWithValue("@address", txt_address.Text);
                cmd.Parameters.AddWithValue("@phone", txt_phone.Text);
                cmd.Parameters.AddWithValue("@age", txt_age.Text);
                cmd.Parameters.AddWithValue("@religion", txt_religion.Text);
                cmd.Parameters.AddWithValue("@salary", txt_salary.Text);
                cmd.Parameters.AddWithValue("@date", txt_date.Text);


                cmd.ExecuteNonQuery();
                MessageBox.Show("Successful");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed");
            }
            finally
            {
                ManagerAccess hm = new ManagerAccess();
                hm.Show();
                this.Close();
            }
        }
コード例 #4
0
        private void btn_update_click(object sender, RoutedEventArgs e)
        {
            try
            {
                con = new SqlConnection(@"Data Source=DESKTOP-2CGPE2S\MSSQLSERVER3;Initial Catalog=HotelManagement;Integrated Security=True");
                con.Open();
                cmd = new SqlCommand("UPDATE employee SET name=@name, address=@address, phone=@phone,age=@age,religion=@religion,salary=@salary,date=@date WHERE phone='" + txt_phone.Text + "' ", con);
                cmd.Parameters.AddWithValue("@name", txt_name.Text);
                cmd.Parameters.AddWithValue("@address", txt_address.Text);
                cmd.Parameters.AddWithValue("@phone", txt_phone.Text);
                cmd.Parameters.AddWithValue("@age", txt_age.Text);
                cmd.Parameters.AddWithValue("@religion", txt_religion.Text);
                cmd.Parameters.AddWithValue("@salary", txt_salary.Text);
                cmd.Parameters.AddWithValue("@date", txt_date.Text);

                cmd.ExecuteNonQuery();
                MessageBox.Show("Successful");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Phone Number not found");
            }
            finally
            {
                ManagerAccess mn = new ManagerAccess();
                mn.Show();
                this.Close();
            }
        }
コード例 #5
0
        private void btn_delete_click(object sender, RoutedEventArgs e)
        {
            try
            {
                con = new SqlConnection(@"Data Source=DESKTOP-2CGPE2S\MSSQLSERVER3;Initial Catalog=HotelManagement;Integrated Security=True");
                con.Open();
                cmd = new SqlCommand("DELETE FROM employee WHERE phone='" + txt_phone.Text + "' ", con);
                cmd.ExecuteNonQuery();

                MessageBox.Show("Successful");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Phone Number not found");
            }
            finally
            {
                ManagerAccess mn = new ManagerAccess();
                mn.Show();
                this.Close();
            }
        }
コード例 #6
0
 private void btn_publish_click(object sender, RoutedEventArgs e)
 {
     try
     {
         con = new SqlConnection(@"Data Source=DESKTOP-2CGPE2S\MSSQLSERVER3;Initial Catalog=HotelManagement;Integrated Security=True");
         con.Open();
         cmd = new SqlCommand("INSERT INTO dashboard (no,sms) VALUES (@no,@sms)", con);
         cmd.Parameters.AddWithValue("@no", txt_no.Text);
         cmd.Parameters.AddWithValue("@sms", txt_dash.Text);
         cmd.ExecuteNonQuery();
         MessageBox.Show("Successful");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed");
     }
     finally
     {
         ManagerAccess hm = new ManagerAccess();
         hm.Show();
         this.Close();
     }
 }
コード例 #7
0
 private void btn_expance_submit_click(object sender, RoutedEventArgs e)
 {
     try
     {
         con = new SqlConnection(@"Data Source=DESKTOP-2CGPE2S\MSSQLSERVER3;Initial Catalog=HotelManagement;Integrated Security=True");
         con.Open();
         cmd = new SqlCommand("INSERT INTO expance (type,amount,date) VALUES (@type,@amount,@date)", con);
         cmd.Parameters.AddWithValue("@type", txt_type.Text);
         cmd.Parameters.AddWithValue("@amount", txt_amount.Text);
         cmd.Parameters.AddWithValue("@date", txt_date.Text);
         cmd.ExecuteNonQuery();
         MessageBox.Show("Successful");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed");
     }
     finally
     {
         ManagerAccess hm = new ManagerAccess();
         hm.Show();
         this.Close();
     }
 }