示例#1
0
文件: Program.cs 项目: hlphap/HOME132
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            // Form Sign_In = new Sign_in();
            // Sign_In.Show();
            FormChinh cs = new FormChinh();

            Application.Run(cs);
        }
示例#2
0
 private void Button_Signin_Click(object sender, EventArgs e)
 {
     ChucVu = GetID(Textbox_Username.Text, Textbox_Password.Text);
     if (ChucVu != "")
     {
         Form NewForm = new FormChinh();
         NewForm.Show();
         this.Hide();
     }
     else
     {
         MessageBox.Show("Tài khoảng và mật khẩu không đúng !");
     }
 }
示例#3
0
        private void Them_Click(object sender, EventArgs e)
        {
            {
                if (tenkhach.Text == "")
                {
                    MessageBox.Show("khong duoc de ten khach trong");
                }
                else if (scmnt.Text == "")
                {
                    MessageBox.Show("khong duoc de cmnd trong");
                }
                else if (didong.Text == "")
                {
                    MessageBox.Show("khong duoc de sdt trong");
                }
                else if (email.Text == "")
                {
                    MessageBox.Show("khong duoc de email trong");
                }
                else if (diachi.Text == "")
                {
                    MessageBox.Show("khong duoc de dia chi trong");
                }
                else
                {
                    try
                    {
                        string     sql = "INSERT INTO KHACHHANG(MAKH,HOTENKH,NGAYSINH,GIOITINH,CMND,SDT,QUOCTICH) VALUES(N'" + bunifuTextBox2.Text.Trim() + "',N'" + tenkhach.Text + "','" + bunifuDatepicker1.Value.ToString("yyyy/MM/dd") + "',N'" + gioitinhcombobox.Text + "',N'" + scmnt.Text + "',N'" + didong.Text + "',N'" + comboBox5.Text + "')";
                        SqlCommand cmd = new SqlCommand(sql, conn);
                        cmd.ExecuteNonQuery();
                        string     st   = comboBox3.Text;
                        string     sql2 = "INSERT INTO PHONGTHUE(MAKH,MADK,SOPHONG,NGAYDEN,NGAYDI,NGAYDK) VALUES(N'" + bunifuTextBox2.Text.Trim() + "',N'" + bunifuTextBox2.Text.Trim() + "',N'" + comboBox3.Text + "','" + bunifuDatepicker2.Value.ToString("yyyy/MM/dd") + "','" + bunifuDatepicker3.Value.ToString("yyyy/MM/dd") + "','" + DateTime.Now.ToString("yyyy/MM/dd") + "')";
                        SqlCommand cmd2 = new SqlCommand(sql2, conn);
                        cmd2.ExecuteNonQuery();

                        MessageBox.Show("Them thanh cong");
                        ktload = "1";
                    }
                    catch
                    {
                        MessageBox.Show("Xay ra loi");
                    }
                }
            }
            FormChinh.LoadTrangThai();
        }
示例#4
0
文件: Sign_in.cs 项目: hlphap/HOME132
        private void Button_Signin_DragEnter(object sender, DragEventArgs e)
        {
            Form          NewForm = new FormChinh();
            SqlConnection conn    = new SqlConnection(@"Data Source = SE140697\SQLEXPRESS; Initial Catalog = HomeStay; Integrated Security = True");

            conn.Open();
            string        Taikhoan = Textbox_Username.Text;
            string        MatKhau  = Textbox_Password.Text;
            string        sql      = "SELECT TaiKhoan, MatKhau FROM Sign_in WHERE TaiKhoan = '" + Taikhoan + "' AND MatKhau = '" + MatKhau + "'";
            SqlCommand    cmd      = new SqlCommand(sql, conn);
            SqlDataReader dta      = cmd.ExecuteReader();

            if (dta.Read() == true)
            {
                this.Hide();
                NewForm.ShowDialog();
            }
            else
            {
                MessageBox.Show("Sai Mat Khau! Nhap Lai? ", "Loi", MessageBoxButtons.OK);
            }
        }