Beispiel #1
0
        private void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _KhachSanO = GVGD.GetRow(GVGD.GetSelectedRows()[0]) as O_KHACHSAN;
            List <object>     lstCtv = new List <object>();
            List <O_KHACHSAN> lst    = __ListKhachSanO.Where(w => w.MaCho.Equals(_KhachSanO.MaCho) && w.IDKhachHang.Equals(_KhachSanO.IDKhachHang) && w.NgayGD.ToString("ddMMyyy").Equals(_KhachSanO.NgayGD.ToString("ddMMyyy"))).ToList();

            bool ThanhCong = false;

            if (lst.Count == 1)
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn xóa giao dịch ?", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.Yes:
                    ThanhCong = _KhachSanD.Xoa(_KhachSanO.ID) > 0;
                    break;

                default:
                    return;
                }
            }
            else
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn xóa tất cả giao dịch cùng Mã Chỗ ?", "Câu hỏi", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.Yes:
                    foreach (O_KHACHSAN gdoz in lst)
                    {
                        lstCtv.Add(gdoz.ID);
                    }
                    ThanhCong = _KhachSanD.XoaNhieu1Ban(lstCtv) > 0;
                    break;

                case DialogResult.No:
                    ThanhCong = _KhachSanD.Xoa(_KhachSanO.ID) > 0;
                    break;

                default:
                    return;
                }
            }

            if (XuLyGiaoDien.ThongBao(Text, ThanhCong, true))
            {
                string NoiDung = string.Empty;
                NoiDung = string.Format("Xóa {0} GD với tổng giá hệ thống là {1} \r\n", lst.Count(), lst.Sum(w => w.GiaHeThong).ToString("#,###"));
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("FormName", Text);
                dic.Add("MaCho", _KhachSanO.MaCho);
                dic.Add("NoiDung", NoiDung);
                dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID);
                dic.Add("LoaiKhachHang", 1);
                dic.Add("Ma", _KhachSanO.IDKhachHang);
                new D_LS_GIAODICH().ThemMoi(dic);
                new D_DAILY().ChayLaiPhi(_KhachSanO.NgayGD);
                DuLieu();
            }
        }
Beispiel #2
0
 private void btnIn_ItemClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         _GiaoDichO = GVGD.GetRow(GVGD.GetSelectedRows()[0]) as O_GIAODICH;
         List <O_GIAODICH> lst = _ListGiaoDichO.Where(w => w.MaCho.Equals(_GiaoDichO.MaCho) && w.LoaiGiaoDich.Equals(_GiaoDichO.LoaiGiaoDich) && w.IDKhachHang.Equals(_GiaoDichO.IDKhachHang) && w.NgayGD.ToString("ddMMyyy").Equals(_GiaoDichO.NgayGD.ToString("ddMMyyy")) && w.NhaCungCap.Equals(_GiaoDichO.NhaCungCap) && w.TuyenBayDi.Equals(_GiaoDichO.TuyenBayDi)).ToList();
         frmInVe           frm = new frmInVe(lst);
         frm.ShowDialog();
     }
     catch { }
 }
Beispiel #3
0
        public void DuLieu()
        {
            if (!XuLyGiaoDien.wait.IsSplashFormVisible)
            {
                XuLyGiaoDien.wait.ShowWaitForm();
            }

            _index = GVGD.GetFocusedDataSourceRowIndex() - 10;

            _Query = "LoaiGiaoDich in (4,8,9,13,14) AND TinhCongNo = 1";

            if (chk1.Checked)
            {
                _Query += DuLieuTaoSan.MocThoiGian()[_IDThoiGian];
            }
            else if (chk2.Checked)
            {
                if (bdtpTu.EditValue != null && bdtpDen.EditValue != null)
                {
                    _Query += string.Format("AND (convert(date, NgayGD) BETWEEN '{0}' AND '{1}')", ((DateTime)bdtpTu.EditValue).ToString("yyyyMMdd"), ((DateTime)bdtpDen.EditValue).ToString("yyyyMMdd"));
                }
            }
            else if (chk3.Checked && _SV_MC.Length > 0)
            {
                _Query += string.Format("AND REPLACE(COALESCE(SoVeVN,''),' ','') in ('{0}')", String.Join("' ,'", _SV_MC));
            }
            else if (chk4.Checked && _SV_MC.Length > 0)
            {
                _Query += string.Format("AND REPLACE(COALESCE(MaCho,''),' ','') in ('{0}')", String.Join("' ,'", _SV_MC));
            }

            if (_Query != "LoaiGiaoDich in (4,8,9,13,14) AND TinhCongNo = 1")
            {
                khachHangOBindingSource.DataSource = DaiLyD.All();
                _ListGiaoDichO = new D_GIAODICH().DuLieu(_Query, DuLieuTaoSan.Q.VeAdmin);
                giaoDichOBindingSource.DataSource = _ListGiaoDichO;
            }

            Size textSize = TextRenderer.MeasureText(_ListGiaoDichO.Count.ToString(), new Font("Tahoma", 9, FontStyle.Regular));

            GVGD.IndicatorWidth   = textSize.Width + 5;
            GVGD.FocusedRowHandle = _index;

            if (XuLyGiaoDien.wait.IsSplashFormVisible)
            {
                XuLyGiaoDien.wait.CloseWaitForm();
            }
        }
Beispiel #4
0
        void ChinhSua()
        {
            if (GVGD.GetSelectedRows().Count() < 1)
            {
                return;
            }
            _GiaoDichO = GVGD.GetRow(GVGD.GetSelectedRows()[0]) as O_GIAODICH;
            if (_GiaoDichO == null)
            {
                return;
            }
            _index = GVGD.GetFocusedDataSourceRowIndex();

            List <O_GIAODICH> lst = _ListGiaoDichO.Where(w => w.MaCho.Equals(_GiaoDichO.MaCho) && w.LoaiGiaoDich.Equals(_GiaoDichO.LoaiGiaoDich) && w.IDKhachHang.Equals(_GiaoDichO.IDKhachHang) && w.NgayGD.ToString("ddMMyyy").Equals(_GiaoDichO.NgayGD.ToString("ddMMyyy")) && w.NhaCungCap.Equals(_GiaoDichO.NhaCungCap) && w.TuyenBayDi.Equals(_GiaoDichO.TuyenBayDi)).ToList();

            if (lst.Count > 1)
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn sửa tất cả giao dịch cùng Mã Chỗ ?", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.No:
                    lst = _ListGiaoDichO.Where(w => w.ID.Equals(_GiaoDichO.ID)).ToList();
                    break;

                case DialogResult.Cancel:
                    return;
                }
            }


            if (new List <int>()
            {
                4, 13, 14
            }.Contains(_GiaoDichO.LoaiGiaoDich))
            {
                frmVeThem frm = new frmVeThem(lst);
                frm.ShowDialog(ParentForm);
            }
            else
            {
                frmVeHoanThem frm2 = new frmVeHoanThem(lst);
                frm2.ShowDialog(ParentForm);
            }
        }
Beispiel #5
0
        public void DuLieu()
        {
            if (!XuLyGiaoDien.wait.IsSplashFormVisible)
            {
                XuLyGiaoDien.wait.ShowWaitForm();
            }

            _index = GVGD.GetFocusedDataSourceRowIndex() - 10;
            _Query = "";

            if (chk1.Checked)
            {
                _Query += "WHERE " + DuLieuTaoSan.MocThoiGian()[_IDThoiGian].Substring(4);
            }
            else if (chk2.Checked)
            {
                if (bdtpTu.EditValue != null && bdtpDen.EditValue != null)
                {
                    _Query = string.Format("WHERE (convert(date, NgayGD) BETWEEN '{0}' AND '{1}')", ((DateTime)bdtpTu.EditValue).ToString("yyyyMMdd"), ((DateTime)bdtpDen.EditValue).ToString("yyyyMMdd"));
                }
            }
            else if (chk4.Checked && _SV_MC.Length > 0)
            {
                _Query += string.Format("WHERE REPLACE(COALESCE(Booking,''),' ','') in ('{0}')", String.Join("' ,'", _SV_MC));
            }

            if (_Query != "")
            {
                khachHangOBindingSource.DataSource = DaiLyD.All();
                __ListKhachSanO = new D_KHACHSAN().DuLieu(_Query);
                khachSanOBindingSource.DataSource = __ListKhachSanO;
            }

            Size textSize = TextRenderer.MeasureText(__ListKhachSanO.Count.ToString(), new Font("Tahoma", 9, FontStyle.Regular));

            GVGD.IndicatorWidth   = textSize.Width + 5;
            GVGD.FocusedRowHandle = _index;

            if (XuLyGiaoDien.wait.IsSplashFormVisible)
            {
                XuLyGiaoDien.wait.CloseWaitForm();
            }
        }
Beispiel #6
0
        void XulyDuLieuTruocKhiThem(Dictionary <string, object> Dic)
        {
            long a = 0;
            List <Dictionary <string, object> > lstDicS = new List <Dictionary <string, object> >();
            List <string> lstCTV = new List <string>();

            for (int i = 0; i < GVGD.RowCount; i++)
            {
                Dictionary <string, object> dicS = new Dictionary <string, object>(Dic);
                for (int y = 0; y < GVGD.Columns.Count; y++) //Dòng
                {
                    if (GVGD.Columns[y].Visible)             //Cột
                    {
                        object G = GVGD.GetRowCellValue(i, GVGD.Columns[y]);
                        dicS.Add(GVGD.Columns[y].FieldName, G);
                    }
                    else if (y == GVGD.Columns.Count - 1)
                    {
                        object G = GVGD.GetRowCellValue(i, GVGD.Columns[y]);
                        lstCTV.Add(string.Format("WHERE ID = {0}", G));
                        lstDicS.Add(dicS);
                    }
                }
            }

            //xuLy(lstDicS[0]);

            a = (_GiaoDichO.ID > 0) ? _GiaoDichD.SuaNhieu1Ban(lstDicS, lstCTV) : _GiaoDichD.ThemNhieu1Ban(lstDicS);
            if (XuLyGiaoDien.ThongBao(Text, a == lstDicS.Count))
            {
                GhiChuCmt(_GiaoDichO.ID);
                if (iLoaiKhachHang.EditValue.ToString() != "3")
                {
                    new D_DAILY().ChayLaiPhi((_GiaoDichO.NgayGD > iNgayGD.DateTime) ? iNgayGD.DateTime : _GiaoDichO.NgayGD);
                }
                (Owner.ActiveMdiChild as frmVe).DuLieu();
                Close();
            }
        }
Beispiel #7
0
        void ChinhSua()
        {
            _KhachSanO = GVGD.GetRow(GVGD.GetSelectedRows()[0]) as O_KHACHSAN;
            _index     = GVGD.GetFocusedDataSourceRowIndex();

            List <O_KHACHSAN> lst = __ListKhachSanO.Where(w => w.MaCho.Equals(_KhachSanO.MaCho) && w.IDKhachHang.Equals(_KhachSanO.IDKhachHang) && w.NgayGD.ToString("ddMMyyy").Equals(_KhachSanO.NgayGD.ToString("ddMMyyy"))).ToList();

            if (lst.Count > 1)
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn sửa tất cả giao dịch cùng Mã Chỗ ?", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.No:
                    lst = __ListKhachSanO.Where(w => w.ID.Equals(_KhachSanO.ID)).ToList();
                    break;

                case DialogResult.Cancel:
                    return;
                }
            }

            new frmKhachSanThem(lst).ShowDialog(this);
        }
Beispiel #8
0
        private void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _GiaoDichO = GVGD.GetRow(GVGD.GetSelectedRows()[0]) as O_GIAODICH;

            O_KHOANGAY kn = new D_KHOANGAY().KiemTraNgayKhoa(_GiaoDichO.NgayGD);

            if (_GiaoDichO.TinhCongNo)
            {
                if (!DuLieuTaoSan.Q.VeAdmin)
                {
                    if ((kn.HoatDong) && !(kn.Code ?? string.Empty).Contains(_GiaoDichO.MaCho.Replace(" ", string.Empty)))
                    {
                        XuLyGiaoDien.Alert("Ngày đã bị khóa", Form_Alert.enmType.Warning);
                        return;
                    }
                }
            }

            if (DateTime.Now.Date.Subtract(_GiaoDichO.NgayGD.Date).Days > 30)
            {
                XuLyGiaoDien.Alert("Ngày đã bị khóa", Form_Alert.enmType.Warning);
                return;
            }

            List <object>     lstCtv = new List <object>();
            List <O_GIAODICH> lst    = _ListGiaoDichO.Where(w => (w.MaCho ?? "").Equals(_GiaoDichO.MaCho ?? "") && w.LoaiGiaoDich.Equals(_GiaoDichO.LoaiGiaoDich) && w.IDKhachHang.Equals(_GiaoDichO.IDKhachHang) && w.NgayGD.ToString("ddMMyyy").Equals(_GiaoDichO.NgayGD.ToString("ddMMyyy")) && w.NhaCungCap.Equals(_GiaoDichO.NhaCungCap) && w.TuyenBayDi.Equals(_GiaoDichO.TuyenBayDi)).ToList();

            bool ThanhCong = false;

            if (lst.Count == 1)
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn xóa giao dịch ?", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.Yes:
                    ThanhCong = _GiaoDichD.Xoa(_GiaoDichO.ID) > 0;
                    break;

                default:
                    return;
                }
            }
            else
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn xóa tất cả giao dịch cùng Mã Chỗ ?", "Câu hỏi", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.Yes:
                    foreach (O_GIAODICH gdoz in lst)
                    {
                        lstCtv.Add(gdoz.ID);
                    }
                    ThanhCong = _GiaoDichD.XoaNhieu1Ban(lstCtv) > 0;
                    break;

                case DialogResult.No:
                    ThanhCong = _GiaoDichD.Xoa(_GiaoDichO.ID) > 0;
                    break;

                default:
                    return;
                }
            }

            if (XuLyGiaoDien.ThongBao(Text, ThanhCong, true))
            {
                string NoiDung = string.Empty;
                if (_GiaoDichO.LoaiGiaoDich == 4)
                {
                    NoiDung = string.Format("Xóa {0} GD với tổng giá hệ thống là {1} \r\n", lst.Count(), lst.Sum(w => w.GiaHeThong).ToString("#,###"));
                }
                else
                {
                    NoiDung = string.Format("Xóa {0} GD với tổng giá hoàn là {1} \r\n", lst.Count(), lst.Sum(w => w.GiaHoan).ToString("#,###"));
                }
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("FormName", Text);
                dic.Add("MaCho", _GiaoDichO.MaCho);
                dic.Add("NoiDung", NoiDung);
                dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID);
                dic.Add("LoaiKhachHang", _GiaoDichO.LoaiKhachHang);
                dic.Add("Ma", _GiaoDichO.IDKhachHang);
                new D_LS_GIAODICH().ThemMoi(dic);
                new D_DAILY().ChayLaiPhi(_GiaoDichO.NgayGD);
                DuLieu();
            }
        }
Beispiel #9
0
        public void LoadDCCT(int id, int ctdt_Id, TextBox TenChuongTrinh, TextBox TenTiengAnh, TextBox MaHocPhan, ComboBox KhoiKienThuc_1, ComboBox KhoiKienThuc_2, ComboBox KhoiKienThuc_3,
                             TextBox GVPTMH, TextBox DiaChiCoQuan, TextBox DiaChiLienHe, TextBox Email, TextBox GVTG, NumericUpDown SoTinChi, TextBox TrinhDo, DataGridView ListHocPhanTruoc,
                             ListBox ListMucTieuMonHoc, ListBox ListChuanDauRa,
                             ComboBox MaTran_CDRMH_CDRCTDT, DataGridView ListMaTran_CDRMH_CDRCTDT, TextBox MoTaVanTan, ComboBox MaTran_CDRMH_HD,
                             ListBox List_MaTran_CDRMH_HDGD, ListBox ListTaiLieu,
                             ListBox ListPPDanhGiaKQHT, ListBox ListKeHoachKiemTra, ListBox ListKeHoachGiangDay)
        {
            DBEntities model = new DBEntities();

            DeCuongChiTiet dcct = model.DeCuongChiTiets.Single(x => x.Id == id);
            DeCuongChiTiet mh   = model.DeCuongChiTiets.Single(x => x.MonHoc.Id == dcct.MonHoc_Id);

            TenChuongTrinh.Text          = mh.TenDCCT;
            TenTiengAnh.Text             = mh.TenTiengAnh;
            MaHocPhan.Text               = mh.MonHoc.MonHoc_Id;
            KhoiKienThuc_1.SelectedIndex = int.Parse(model.MonHocs.Single(x => x.Id == mh.MonHoc_Id).LoaiKienThuc.ToString().Substring(0, 1)) - 1;
            KhoiKienThuc_2.SelectedIndex = int.Parse(model.MonHocs.Single(x => x.Id == mh.MonHoc_Id).LoaiKienThuc.ToString().Substring(1, 1)) - 1;
            int lkt3 = int.Parse(model.MonHocs.Single(x => x.Id == mh.MonHoc_Id).LoaiKienThuc.ToString().Substring(2, 1)) - 1;

            if (lkt3 >= 0)
            {
                KhoiKienThuc_3.SelectedIndex = lkt3;
            }

            GVGD gv = model.GVGDs.FirstOrDefault(x => x.DCCT_Id == mh.Id);

            if (gv != null)
            {
                GVPTMH.Text       = gv.TenGV;
                DiaChiCoQuan.Text = gv.DiaChi;
                DiaChiLienHe.Text = gv.DienThoai;
                Email.Text        = gv.Email;
                GVTG.Text         = gv.TroGiang;
            }

            //ListGVDT.Text = dcct
            SoTinChi.Value = model.MonHocs.FirstOrDefault(x => x.Id == mh.MonHoc_Id).SoTinChi;
            TrinhDo.Text   = mh.TrinhDo;
            //PhanBoThoiGian.DocumentText = dcct.PhanBoThoiGian;
            //ListHocPhanTruoc.DataSource = model.MonTienQuyets.Where(x => x.MonHoc_Id == dcct.MonHoc_Id).ToList();

            ListHocPhanTruoc.DataSource            = model.MonTienQuyet_Select_Sang(mh.MonHoc_Id);
            ListHocPhanTruoc.Columns[0].HeaderText = "Mã";
            ListHocPhanTruoc.Columns[1].HeaderText = "Tên môn học";
            ListHocPhanTruoc.Columns[2].HeaderText = "Mã môn tiên quyết";
            ListHocPhanTruoc.Columns[3].HeaderText = "Chọn";
            ListHocPhanTruoc.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.Fill;

            try
            {
                MaTran_CDRMH_CDRCTDT.DataSource    = model.ChuanDauRaMonHocs.Where(x => x.DeCuongChiTiet_Id == mh.Id).ToList();
                MaTran_CDRMH_CDRCTDT.DisplayMember = "NoiDung";
                MaTran_CDRMH_CDRCTDT.ValueMember   = "Id";

                ListMaTran_CDRMH_CDRCTDT.DataSource = model.MucTieuDaoTaos.Where(x => x.ChuongTrinhDaoTao_Id == ctdt_Id && x.Loai != "Chung").ToList();
                //ListMaTran_CDRMH_CDRCTDT.Columns["Id"].Visible = false;
                //ListMaTran_CDRMH_CDRCTDT.Columns["ChuongTrinhDaoTao_Id"].Visible = false;
                //ListMaTran_CDRMH_CDRCTDT.Columns["Loai"].Visible = false;
                //ListMaTran_CDRMH_CDRCTDT.Columns["ChuongTrinhDaoTao"].Visible = false;
                //ListMaTran_CDRMH_CDRCTDT.Columns["MaTran_CDRMH_CDRCTDT"].Visible = false;

                MaTran_CDRMH_HD.DataSource    = model.ChuanDauRaMonHocs.Where(x => x.DeCuongChiTiet_Id == mh.Id).ToList();
                MaTran_CDRMH_HD.DisplayMember = "NoiDung";
                MaTran_CDRMH_HD.ValueMember   = "Id";

                MoTaVanTan.Text = model.MonHocs.FirstOrDefault(x => x.Id == mh.MonHoc_Id).NoiDungVanTat;
            }
            catch
            {
            }
        }