Esempio n. 1
0
 private void cbHienThiAll_CheckedChanged(object sender, EventArgs e)
 {
     if (cbHienThiAll.Checked)
     {
         lblTrangThai.Visible            = true;
         btTrangThai.Visible             = true;
         dgvNhanVien.DataSource          = busnhanvien.DanhSachNhanVienAll();
         dgvNhanVien.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dgvNhanVien.Columns[5].Visible  = true;
         dgvNhanVien.Columns[7].Visible  = false;
         foreach (DataGridViewRow dr in dgvNhanVien.Rows)
         {
             if (!string.IsNullOrWhiteSpace(dr.Cells[5].FormattedValue.ToString()))
             {
                 if (!(string.Compare(dr.Cells[5].Value.ToString(), "Hoạt động", true) == 0))
                 {
                     dr.DefaultCellStyle.BackColor = Color.Red;
                     dr.DefaultCellStyle.ForeColor = Color.White;
                 }
             }
         }
     }
     else
     {
         lblTrangThai.Visible            = false;
         btTrangThai.Visible             = false;
         dgvNhanVien.DataSource          = busnhanvien.getDanhSachNV();
         dgvNhanVien.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     }
 }
Esempio n. 2
0
        // Check Email trùng
        public bool checkemailTrung(string email, BUS_NhanVien busnhanvien)
        {
            DataTable getMail = busnhanvien.DanhSachNhanVienAll();

            foreach (DataRow row in getMail.Rows)
            {
                if (string.Compare(email, row[1].ToString(), true) == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 3
0
        private void DgvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (cbHoaDon.Checked == true || cbDTNam.Checked == true || cbDTThang.Checked == true)
            {
                if (e.ColumnIndex == DgvData.Columns["Detail"].Index && e.RowIndex >= 0 && e.RowIndex < DgvData.Rows.Count - 1)
                {
                    DTO_HoaDon hd = busTK.curHD(DgvData.CurrentRow.Cells["MaHD"].FormattedValue.ToString());

                    string TenNV = (from DataRow dr in busNv.DanhSachNhanVienAll().Rows
                                    where string.Compare(dr[0].ToString(), hd.MaNV, true) == 0
                                    select dr[2].ToString()).FirstOrDefault();


                    string TenBan = (from DataRow dr in busBan.DanhSachBanALL().Rows
                                     where (int)dr[0] == hd.IdBan
                                     select dr[1].ToString()).FirstOrDefault();


                    DataTable            dtHDCT = busTK.ThongkeHoaDonChitiet(hd.MaHD);
                    CrystalReport.Detail cb     = new CrystalReport.Detail();
                    TextObject           txtnv  = (TextObject)cb.ReportDefinition.Sections["Section1"].ReportObjects["txtTenNV"];
                    txtnv.Text = TenNV;
                    TextObject txtDate = (TextObject)cb.ReportDefinition.Sections["Section1"].ReportObjects["TxtNgayHD"];
                    txtDate.Text = hd.NgayHD.ToString("dd/MM/yyyy");
                    TextObject txthd = (TextObject)cb.ReportDefinition.Sections["Section2"].ReportObjects["txtMaHD"];
                    txthd.Text = hd.MaHD;
                    TextObject txtvt = (TextObject)cb.ReportDefinition.Sections["Section2"].ReportObjects["txtViTri"];
                    txtvt.Text = TenBan;
                    TextObject txtkh = (TextObject)cb.ReportDefinition.Sections["Section2"].ReportObjects["txtKH"];
                    txtkh.Text = hd.SDT_KH;
                    TextObject txtkm = (TextObject)cb.ReportDefinition.Sections["Section4"].ReportObjects["TextKM"];
                    txtkm.Text = hd.KhuyenMai.ToString() + "%";
                    TextObject txttongtien = (TextObject)cb.ReportDefinition.Sections["Section5"].ReportObjects["TxtTongTien"];
                    txttongtien.Text = (hd.ThanhTien * 100 / (100 - hd.KhuyenMai)).ToString();
                    TextObject txtThanhTien = (TextObject)cb.ReportDefinition.Sections["Section5"].ReportObjects["txtThanhtien"];
                    txtThanhTien.Text = hd.ThanhTien.ToString();

                    TextObject txtname = (TextObject)cb.ReportDefinition.Sections["Section1"].ReportObjects["TextName"];
                    txtname.Text = "CHI TIẾT HOÁ ĐƠN";

                    cb.Database.Tables["CTHD"].SetDataSource(dtHDCT);

                    frmDetail frm = new frmDetail(cb);
                    frm.Show();
                }
            }
        }