Exemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DentalClinicDataContext dataContext = new DentalClinicDataContext();
            Staff staff = new Staff();

            staff.StaffId     = txtMaNVBS.Text;
            staff.fullName    = txtTenNVBS.Text;
            staff.dateOfBirth = dtpkNgaySinh.Value;
            staff.PositionId  = int.Parse(cbViTri.SelectedValue.ToString());
            if (radioButton_Nam.Checked)
            {
                staff.gender = true;
            }
            if (radioButton_Nu.Checked)
            {
                staff.gender = true;
            }
            staff.address        = txtDiaChi.Text;
            staff.phone          = txtSoDienThoai.Text;
            staff.identityNumber = txtCMT.Text;
            staff.experience     = txtKinhNghiem.Text;
            staff.email          = txtEmail.Text;
            staff.certificateId  = txtBangCap.Text;
            staff.note           = txtGhiChu.Text;
            dataContext.Staffs.InsertOnSubmit(staff);
            dataContext.SubmitChanges();
            click_CloseForm(sender, e);
            this.Close();
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Medicine medicine = new Medicine();

            medicine = dentalClinic.Medicines.Where(s => s.MedicineId == Cons.temp).Single();
            dentalClinic.Medicines.DeleteOnSubmit(medicine);
            dentalClinic.SubmitChanges();
            UserControl_QuanLyThuoc_Load(sender, e);
        }
Exemplo n.º 3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Service service = new Service();

            service = dentalClinic.Services.Where(ma => ma.ServiceId == Cons.temp).Single();
            dentalClinic.Services.DeleteOnSubmit(service);
            dentalClinic.SubmitChanges();
            UserControl_QuanLyDichVu_Load(sender, e);
        }
Exemplo n.º 4
0
        private void bnt_OkThemLichHen_Click(object sender, EventArgs e)
        {
            Appointment appointment = new Appointment();

            appointment = dataContext.Appointments.Where(a => a.AppointmentId == Cons.temp).Single();
            dataContext.Appointments.DeleteOnSubmit(appointment);
            dataContext.SubmitChanges();
            click_CloseForm(sender, e);
            this.Close();
        }
Exemplo n.º 5
0
        private void btn_DangXuat_Click(object sender, EventArgs e)
        {
            WorkingStatus workingStatus = new WorkingStatus();

            workingStatus         = DataContext.WorkingStatus.Where(a => a.WorkingStatusId == Cons.WorkingStatusId).Single();
            workingStatus.timeEnd = DateTime.Now;
            DataContext.SubmitChanges();


            this.Hide();
            this.Close();
        }
Exemplo n.º 6
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         Service service = new Service();
         service             = dentalClinic.Services.Where(ma => ma.ServiceId == Cons.temp).Single();
         service.nameService = txtTenDichVu.Text;
         service.price       = decimal.Parse(txtGiaTien.Text);
         service.note        = txtMoTa.Text;
         dentalClinic.SubmitChanges();
         click_CloseForm(sender, e);
         this.Close();
     }
     catch
     {
         MessageBox.Show("Lỗi dữ liệu mời bạn kiểm tra lại", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 7
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         DentalClinicDataContext dentalClinic = new DentalClinicDataContext();
         Service service = new Service();
         service.ServiceId   = txtDichVu.Text;
         service.nameService = txtTenDichVu.Text;
         service.price       = decimal.Parse(txtGiaTien.Text);
         service.note        = txtMoTa.Text;
         dentalClinic.Services.InsertOnSubmit(service);
         dentalClinic.SubmitChanges();
         click_CloseForm(sender, e);
         this.Close();
     }
     catch (Exception)
     {
         MessageBox.Show("Yêu cầu nhập đúng định dạng và không trùng !");
     }
 }
Exemplo n.º 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Medicine medicine = new Medicine();
         medicine                = dental.Medicines.Where(ma => ma.MedicineId == Cons.temp).Single();
         medicine.MedicineId     = txtMaThuoc.Text;
         medicine.nameMedicine   = txtTenThuoc.Text;
         medicine.quantity       = int.Parse(txtSoLuong.Text);
         medicine.expirationDate = dtpkHanSuDung.Value;
         medicine.unit           = txtDonViTinh.Text;
         medicine.price          = decimal.Parse(txtDonGia.Text);
         medicine.TypeMedicineId = cbLoaiThuoc.SelectedValue.ToString();
         dental.SubmitChanges();
         click_CloseForm(sender, e);
         this.Close();
     }
     catch
     {
         MessageBox.Show("Lỗi dữ liệu mời bạn kiểm tra lại", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 9
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     try
     {
         DentalClinicDataContext dental = new DentalClinicDataContext();
         Medicine medicine = new Medicine();
         medicine.MedicineId     = txtMaThuoc.Text;
         medicine.nameMedicine   = txtTenThuoc.Text;
         medicine.quantity       = int.Parse(txtSoLuong.Text);
         medicine.expirationDate = dtpkHanSuDung.Value;
         medicine.unit           = txtDonViTinh.Text;
         medicine.TypeMedicineId = cbLoaiThuoc.SelectedValue.ToString();
         medicine.price          = decimal.Parse(txtDonGia.Text);
         dental.Medicines.InsertOnSubmit(medicine);
         dental.SubmitChanges();
         click_CloseForm(sender, e);
         this.Close();
     }
     catch (Exception)
     {
         MessageBox.Show("Yêu cầu nhập dúng định dạng!");
     }
 }
Exemplo n.º 10
0
        private void bnt_OkThemLichHen_Click(object sender, EventArgs e)
        {
            try
            {
                Appointment appointment = new Appointment();
                appointment = dataContext.Appointments.Where(a => a.AppointmentId == Cons.temp).Single();

                appointment.nameAppointment = txt_TenLichHen.Text;
                appointment.scheduleDate    = dtp_NgayHen.Value;
                appointment.timeBegin       = new TimeSpan(int.Parse(nud_GioBatDau.Value.ToString()), int.Parse(nud_PhutBatDau.Value.ToString()), 0);
                appointment.timeEnd         = new TimeSpan(int.Parse(nud_GioKetThuc.Value.ToString()), int.Parse(nud_GioKetThuc.Value.ToString()), 0);
                appointment.note            = txtNote.Text;
                appointment.PatientId       = cmbMaBenhNhan.SelectedValue.ToString();

                dataContext.SubmitChanges();
                click_CloseForm(sender, e);
                this.Close();
            }
            catch
            {
                MessageBox.Show("Lỗi yêu cầu nhập đúng !");
            }
        }
Exemplo n.º 11
0
        private void bnt_OkThemLichHen_Click(object sender, EventArgs e)
        {
            try
            {
                Appointment appointment = new Appointment();
                appointment.AppointmentId   = ranDomId();
                appointment.nameAppointment = txt_TenLichHen.Text;
                appointment.scheduleDate    = dtp_NgayHen.Value;
                appointment.timeBegin       = new TimeSpan(dtp_GioHen.Value.Hour, dtp_GioHen.Value.Minute, dtp_GioHen.Value.Second);
                appointment.timeEnd         = new TimeSpan(dtp_GioHen.Value.Hour, dtp_GioHen.Value.Minute, dtp_GioHen.Value.Second);
                appointment.note            = txt_Note.Text;
                appointment.PatientId       = cmbMaBenhNhan.SelectedValue.ToString();
                dataContext.Appointments.InsertOnSubmit(appointment);
                dataContext.SubmitChanges();

                Cons.temp = "";
                click_CloseForm(sender, e);
                this.Close();
            }
            catch
            {
                MessageBox.Show("Lỗi yêu cầu nhập đúng !");
            }
        }
Exemplo n.º 12
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            DentalClinicDataContext dataContext = new DentalClinicDataContext();


            var query = from a in dataContext.Accounts
                        join s in dataContext.Staffs on a.StaffId equals s.StaffId
                        join p in dataContext.Positions on s.PositionId equals p.PositionId

                        select new
            {
                a.AccountId,
                a.userName,
                a.passWord,
                p.PositionId
            };

            string username = txtUsername.Text;
            string password = txtPassword.Text;

            /*if (Login(username, password))
             * {*/
            if (txtUsername.Text != "" && txtPassword.Text != "")
            {
                foreach (var item in query.ToList())
                {
                    if (item.userName == txtUsername.Text && item.passWord == txtPassword.Text)
                    {
                        Cons.permission = item.PositionId;      //gắn quyền.

                        if (item.PositionId == 1)
                        {
                            // Chèn dữ liệu login
                            Cons.AccountID = item.AccountId;
                            WorkingStatus workingStatus = new WorkingStatus();
                            workingStatus.WorkingStatusId = Cons.ranDomId();
                            workingStatus.AccountId       = item.AccountId;
                            workingStatus.timeBegin       = DateTime.Now;

                            Cons.WorkingStatusId = workingStatus.WorkingStatusId;       // luư lại.

                            dataContext.WorkingStatus.InsertOnSubmit(workingStatus);
                            dataContext.SubmitChanges();


                            CreateFormMain_Staff();
                        }
                        if (item.PositionId == 2)
                        {
                            // Chèn dữ liệu login
                            Cons.AccountID = item.AccountId;
                            WorkingStatus workingStatus = new WorkingStatus();
                            workingStatus.WorkingStatusId = Cons.ranDomId();
                            workingStatus.AccountId       = item.AccountId;
                            workingStatus.timeBegin       = DateTime.Now;

                            Cons.WorkingStatusId = workingStatus.WorkingStatusId;       // luư lại.

                            dataContext.WorkingStatus.InsertOnSubmit(workingStatus);
                            dataContext.SubmitChanges();


                            CreateFormMain_Doctor();
                        }

                        if (item.PositionId == 3)
                        {
                            // Chèn dữ liệu login
                            Cons.AccountID = item.AccountId;
                            WorkingStatus workingStatus = new WorkingStatus();
                            workingStatus.WorkingStatusId = Cons.ranDomId();
                            workingStatus.AccountId       = item.AccountId;
                            workingStatus.timeBegin       = DateTime.Now;

                            Cons.WorkingStatusId = workingStatus.WorkingStatusId;       // luư lại.
                            dataContext.WorkingStatus.InsertOnSubmit(workingStatus);
                            dataContext.SubmitChanges();

                            CreateFormMain_Manager();
                        }
                        return;
                    }
                    else
                    {
                        error_transition.Show(lbl_Error);
                    }
                }
            }
            /*}*/
        }