Ejemplo n.º 1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = iSignIn, _Tu = 2, _Den = 20, _ChoQua = !new D_SIGNIN().DaTonTai(string.Format("WHERE SignIn='{0}' AND ID <> {1}", iSignIn.Text, _SignInO.ID)), _ThongBao2 = "Đã tồn tại"
                }
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            long CapNhatNum = (_SignInO.ID > 0) ? (_SignInD.CapNhat(dic, _SignInO.ID) > 0 ? _SignInO.ID : 0) : _SignInD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, CapNhatNum > 0))
            {
                if (Owner is frmSignIn)
                {
                    (Owner as frmSignIn).TaiLaiSignIn();
                }
                Close();
            }
        }
Ejemplo n.º 2
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = txtMatKhauCu, _ChoQuaThang = TMD5.TMd5Hash(txtMatKhauCu.Text) == DuLieuTaoSan.NV.MatKhauCty, _ThongBao2 = "Mật khẩu sai"
                },
                new KiemTra()
                {
                    _Control = txtMatKhauMoi
                },
                new KiemTra()
                {
                    _Control = iMatKhauCty, _ChoQuaThang = iMatKhauCty.Text == txtMatKhauMoi.Text, _ThongBao2 = "Mật khẩu mới không khớp"
                }
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("MatKhauCty", TMD5.TMd5Hash(iMatKhauCty.Text));

            if (XuLyGiaoDien.ThongBao(Text, new D_DAILY().CapNhat(dic, DuLieuTaoSan.NV.ID) > 0))
            {
                Close();
            }
        }
Ejemplo n.º 3
0
        private void btnLuu2_Click(object sender, EventArgs e)
        {
            if (!checkEdit2.Checked && _TinhTrangO.ID < 1)
            {
                XtraMessageBox.Show("Nếu muốn thêm mới vui lòng chọn vào [Thêm]", "Thông báo");
                return;
            }

            List <KiemTra> kiemTras = new List <KiemTra>();

            kiemTras.Add(new KiemTra()
            {
                _Control = iTenTrangThai, _Tu = 3, _Den = 30, _ChoQua = !(_ListTinhTrangO.Where(w => w.TenTrangThai.Equals(iTenTrangThai.Text) && !w.ID.Equals(checkEdit2.Checked ? 0 : _TinhTrangO.ID)).Count() > 0), _ThongBao2 = "Giá trị này đã tồn tại"
            });

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("TenTrangThai", iTenTrangThai.Text);
            dic.Add("LoaiKhachHang", _LoaiKhachHang);
            long a = !checkEdit2.Checked ? _TinhTrangD.CapNhat(dic, _TinhTrangO.ID) : _TinhTrangD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao("Tình trạng " + (checkEdit1.Checked ? "thêm" : "sửa"), a > 0))
            {
                _ListTinhTrangO = _TinhTrangD.DuLieu(_LoaiKhachHang, false);
                trangThaiOBindingSource.DataSource = _ListTinhTrangO;
                (Owner.ActiveMdiChild as frmDaiLy).DuLieu();
            }
        }
Ejemplo n.º 4
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            string CoDe = string.Empty;

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    CoDe += row[0].ToString() + ", ";
                }
                CoDe = CoDe.Substring(0, CoDe.Length - 2);
            }

            D_KHOANGAY bus = new D_KHOANGAY();
            Dictionary <string, object> dic = new Dictionary <string, object>()
            {
                { "HoatDong", chkGD.Checked },
                { "Them", chkThem.Checked },
                { "Sua", chkSua.Checked },
                { "Xoa", chkXoa.Checked },
                { "NganHang", chkNH.Checked },
                { "Code", CoDe },
                { "ThemNH", chkThemNH.Checked },
                { "SuaNH", chkSuaNH.Checked },
                { "XoaNH", chkXoaNH.Checked },
            };

            if (XuLyGiaoDien.ThongBao(Text + " sửa", bus.CapNhat(dic, _KhoaNgayO.MaNgay, "WHERE MaNgay = {0}") > 0))
            {
                chkGD.Checked = chkNH.Checked = chkSua.Checked = chkThem.Checked = chkXoa.Checked = chkSuaNH.Checked = chkThemNH.Checked = chkXoaNH.Checked = false;
                dt.Clear();
                GM.Enabled = false;
                DuLieu();
            }
        }
Ejemplo n.º 5
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 < GaVGD.RowCount; i++)
            {
                Dictionary <string, object> dicS = new Dictionary <string, object>(Dic);
                for (int y = 0; y < GaVGD.Columns.Count; y++) //Dòng
                {
                    if (GaVGD.Columns[y].Visible)             //Cột
                    {
                        object G = GaVGD.GetRowCellValue(i, GaVGD.Columns[y]);
                        dicS.Add(GaVGD.Columns[y].FieldName, G);
                    }
                    else if (y == GaVGD.Columns.Count - 1)
                    {
                        object G = GaVGD.GetRowCellValue(i, GaVGD.Columns[y]);
                        lstCTV.Add(string.Format("WHERE ID = {0}", G));
                        lstDicS.Add(dicS);
                    }
                }
            }

            a = (_ks.ID > 0) ? _ksD.SuaNhieu1Ban(lstDicS, lstCTV) : _ksD.ThemNhieu1Ban(lstDicS);
            if (XuLyGiaoDien.ThongBao(Text, a == lstDicS.Count))
            {
                GhiChuCmt(_ks.ID);
                (Owner.ActiveMdiChild as frmKhachSan).DuLieu();
                Close();
            }
        }
Ejemplo n.º 6
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>();

            kiemTras.Add(new KiemTra()
            {
                _Control = iTenHang, _Tu = 5, _Den = 30,
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = iTenTat, _Tu = 2, _Den = 5, _ChoQua = !_HangBayD.DaTonTai("TenTat", iTenTat.Text, _HangBay.ID), _ThongBao2 = "Đã tồn tại"
            });

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            long a = (_HangBay.ID > 0) ? _HangBayD.CapNhat(dic, _HangBay.ID) : _HangBayD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, a > 0))
            {
                (Owner.ActiveMdiChild as frmHangBay).DuLieu();
                Close();
            }
        }
Ejemplo n.º 7
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();
            }
        }
Ejemplo n.º 8
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            string NCC = string.Empty;

            if (_DataHangBay.Rows.Count > 0)
            {
                foreach (DataRow row in _DataHangBay.Rows)
                {
                    NCC += row["ID"].ToString() + "|";
                }
            }

            List <KiemTra> kiemTras = new List <KiemTra>();

            kiemTras.Add(new KiemTra()
            {
                _Control = iTenDayDu, _Tu = 2, _Den = 50
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = iTen, _Tu = 2, _Den = 50, _ChoQua = !_NCCD.DaTonTai("Ten", iTen.Text, _NCCO.ID), _ThongBao2 = "Đã tồn tại"
            });

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            dic.Add("HangBay", NCC);
            long CapNhatNum = (_NCCO.ID > 0) ? _NCCD.CapNhat(dic, _NCCO.ID) : _NCCD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, CapNhatNum > 0))
            {
                if (_NCCO.ID < 1)
                {
                    List <Dictionary <string, object> > lstDicS = new List <Dictionary <string, object> >();
                    for (int i = 0; i < 180; i++)
                    {
                        dic = new Dictionary <string, object>();
                        dic.Add("NCCID", CapNhatNum);
                        dic.Add("SoDuCuoi", 0);
                        dic.Add("SoDuThucTe", 0);
                        dic.Add("Ngay", "getdate() - " + i);
                        lstDicS.Add(dic);
                    }
                    new D_SODU_HANG().ThemNhieu1Ban(lstDicS);
                }

                (Owner.ActiveMdiChild as frmHangBay).DuLieu();
                Close();
            }
        }
        private void btnSave_Click(Object sender, EventArgs e)
        {
            #region kiểm tra điều kiện
            List<KiemTra> kiemTras = new List<KiemTra>() {
            new KiemTra() { _Control = iTen } };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }
            #endregion

            D_NHOMQUYEN cvb = new D_NHOMQUYEN();

            #region Kiểm tra tên tắt hãng bay
            if (cvb.KiemTraTonTai(iTen.Text, ID))
            {
                XuLyGiaoDien.Alert("Tên nhóm quyền đã tồn tại", Form_Alert.enmType.Warning);
                return;
            }
            #endregion

            #region Lưu
            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("Ten", iTen.Text);
            foreach (Control ctl in Controls)
            {
                if (ctl is GroupControl)
                {
                    if ((ctl as GroupControl).CustomHeaderButtons.Count > 0)
                        dic.Add(ctl.Name, (ctl as GroupControl).CustomHeaderButtons[0].Properties.Checked);
                    foreach (Control ctl1 in (ctl as GroupControl).Controls)
                    {
                        if (ctl1 is CheckEdit)
                            dic.Add(ctl1.Name, (ctl1 as CheckEdit).Checked);
                        else if (ctl1 is GroupControl)
                        {
                            if ((ctl1 as GroupControl).CustomHeaderButtons.Count > 0)
                                dic.Add(ctl1.Name, (ctl1 as GroupControl).CustomHeaderButtons[0].Properties.Checked);
                            foreach (Control ctl2 in (ctl1 as GroupControl).Controls)
                            {
                                dic.Add(ctl2.Name, (ctl2 as CheckEdit).Checked);
                            }
                        }
                    }
                }
            }
            if (XuLyGiaoDien.ThongBao(Text, (ID != 0) ? (cvb.CapNhat(dic, ID) > 0) : (cvb.ThemMoi(dic) > 0)))
            {
                (Owner.ActiveMdiChild as frmQuyenNhanVien).QuyenNhanVienOBindingSource.DataSource = new D_NHOMQUYEN().DuLieu();
                Close();
            }
            #endregion
        }
Ejemplo n.º 10
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>();

            kiemTras.Add(new KiemTra()
            {
                _Control = iTenDangNhapCty, _Tu = 5, _Den = 30, _ChoQua = !_DaiLyD.DaTonTai("TenDangNhapCty", iTenDangNhapCty.Text, _KhachHangO.ID), _ThongBao2 = "Đã tồn tại"
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = txtMatKhauCty, _Tu = 5, _Den = 30, _ChoQuaThang = !txtMatKhauCty.Enabled
            });

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            dic.Add("Ten", iTenDangNhapCty.Text);
            if (txtMatKhauCty.Enabled)
            {
                dic.Add("MatKhauCty", TMD5.TMd5Hash(txtMatKhauCty.Text));
            }
            dic.Add("LoaiKhachHang", 0);
            NguoiThanKhach(false);
            dic.Add("ThongTinLienLac", _HoHang);
            long a = (_KhachHangO.ID > 0) ? _DaiLyD.CapNhat(dic, _KhachHangO.ID) : _DaiLyD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, a > 0))
            {
                if (_KhachHangO.ID < 1)
                {
                    List <Dictionary <string, object> > lstDicS = new List <Dictionary <string, object> >();
                    for (int i = 0; i < 90; i++)
                    {
                        dic = new Dictionary <string, object>();
                        dic.Add("LoaiKhachHangSD", _KhachHangO.LoaiKhachHang);
                        dic.Add("ChinhSachID", iChinhSach.EditValue);
                        dic.Add("DaiLyID", a);
                        dic.Add("Ngay", "getdate() - " + i);
                        lstDicS.Add(dic);
                    }
                    new D_SODU_DAILY().ThemNhieu1Ban(lstDicS);
                }
                (Owner.ActiveMdiChild as frmNhanVien).DuLieu();
                Close();
            }
        }
Ejemplo n.º 11
0
        private void btnLuuMau_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("NoiDung", txtMauEmail.HtmlText);
            dic.Add("TenMau", iTen.Text);
            long Suc = (iThem.Checked) ? mauEmailD.ThemMoi(dic, false) : mauEmailD.CapNhat(dic, iMau.EditValue);

            if (XuLyGiaoDien.ThongBao("Mẫu Email" + (!iThem.Checked ? " sửa" : " thêm"), Suc > 0))
            {
                mauEmailOBindingSource.DataSource = mauEmailD.DuLieu();
            }
        }
Ejemplo n.º 12
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("Host", txtHost.Text);
            dic.Add("Port", nudPort.Value);
            dic.Add("SSL", chkSSL.Checked);
            dic.Add("Email", txtEmail.Text);
            dic.Add("Password", txtMatKhau.Text);
            long Suc = cauHinhSMTPD.CapNhat(dic, nudPort.Value, " WHERE Port <> 0");

            XuLyGiaoDien.ThongBao("Cấu hình Email sửa", Suc > 0);
        }
Ejemplo n.º 13
0
 private void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (GVNKH.GetSelectedRows().Count() > 0)
     {
         _NhomDaiLyO = GVNKH.GetRow(GVNKH.GetSelectedRows()[0]) as O_NHOMDAILY;
         if (_NhomDaiLyO != null)
         {
             XuLyGiaoDien.ThongBao(Text, _NhomDaiLyD.Xoa(_NhomDaiLyO.ID) > 0, true);
             _ListNhomDaiLyO = _NhomDaiLyD.DuLieu(_LoaiKhachHang);
             nhomKhachHangOBindingSource.DataSource = _ListNhomDaiLyO;
         }
     }
 }
Ejemplo n.º 14
0
        private void btnLuu2_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            dic.Add("NoiDung", txtMauEmail.Text);
            long CapNhatNum = (kpi.ID > 0) ? (kpid.CapNhat(dic, kpi.ID) > 0 ? kpi.ID : 0) : kpid.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, CapNhatNum > 0))
            {
                (Owner.ActiveMdiChild as frmKPIHangMuc).TaiLaiKPI();
                Close();
            }
        }
Ejemplo n.º 15
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>();

            kiemTras.Add(new KiemTra()
            {
                _Control = iTen, _Tu = 3, _Den = 30,
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = iNguoiDaiDienHD, _Tu = 3, _Den = 30,
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = iDiDong, _SDT = true, _ChoQua = !_DaiLyD.DaTonTai("DiDong", iDiDong.Text, _DaiLyO.ID, "AND LoaiKhachHang = 3"), _ThongBao2 = "Đã tồn tại"
            });

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            dic.Add("LoaiKhachHang", 3);
            long a = (_DaiLyO.ID > 0) ? _DaiLyD.CapNhat(dic, _DaiLyO.ID) : _DaiLyD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, a > 0))
            {
                if (Owner.ActiveMdiChild is frmKhachLe)
                {
                    (Owner.ActiveMdiChild as frmKhachLe).DuLieu();
                }
                else if (Owner is frmVeThem)
                {
                    (Owner as frmVeThem).DuLieuKhachLe(a);
                }
                else
                {
                    (Owner as frmKhachSanThem).DuLieuKhachLe(a);
                }
                Close();
            }
        }
Ejemplo n.º 16
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (!checkEdit1.Checked && _NhomDaiLyO.ID < 1)
            {
                XtraMessageBox.Show("Nếu muốn thêm mới vui lòng chọn vào [Thêm]", "Thông báo");
                return;
            }

            List <KiemTra> kiemTras = new List <KiemTra>();

            kiemTras.Add(new KiemTra()
            {
                _Control = iTen, _Tu = 3, _Den = 30,
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = iTu, _Tu = 0, _Den = 30, _ChoQua = !(_ListNhomDaiLyO.Where(w => iTu.Value > w.Tu - 1 && w.Den + 1 > iTu.Value && !w.ID.Equals(checkEdit1.Checked ? 0 : _NhomDaiLyO.ID)).Count() > 0), _ThongBao2 = "Giá trị này đã tồn tại"
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = iDen, _Tu = 0, _Den = 30, _ChoQua = !(_ListNhomDaiLyO.Where(w => iDen.Value > w.Tu - 1 && w.Den + 1 > iDen.Value && !w.ID.Equals(checkEdit1.Checked ? 0 : _NhomDaiLyO.ID)).Count() > 0) && iDen.Value - 1000000 > iTu.Value, _ThongBao2 = "Giá trị này đã tồn tại"
            });

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("LoaiKhachHang", _LoaiKhachHang);
            dic.Add("Den", iDen.Value);
            dic.Add("Tu", iTu.Value);
            dic.Add("Ten", iTen.EditValue);
            long a = !checkEdit1.Checked ? _NhomDaiLyD.CapNhat(dic, _NhomDaiLyO.ID) : _NhomDaiLyD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao("Nhóm " + (checkEdit1.Checked ? "thêm" : "sửa"), a > 0))
            {
                _ListNhomDaiLyO = _NhomDaiLyD.DuLieu(_LoaiKhachHang);
                nhomKhachHangOBindingSource.DataSource = _ListNhomDaiLyO;
                (Owner.ActiveMdiChild as frmDaiLy).DuLieu();
            }
        }
Ejemplo n.º 17
0
        private void btnLuu2_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = iKyHieuDi, _Tu = 3, _Den = 100,
                },
                new KiemTra()
                {
                    _Control = iKyHieuDen, _Tu = 3, _Den = 5, _ChoQua = !_TuyenBayD.DaTonTai("Ten", iKyHieuDi.Text + "-" + iKyHieuDen.Text, _TuyenBayO.ID), _ThongBao2 = "Tuyến bay đã tồn tại"
                }
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            List <Dictionary <string, object> > Lstdic = new List <Dictionary <string, object> >();
            Dictionary <string, object>         dic    = new Dictionary <string, object>();

            dic.Add("KyHieuDen", iKyHieuDi.EditValue);
            dic.Add("KyHieuDi", iKyHieuDen.EditValue);
            dic.Add("Ten", iKyHieuDen.Text + "-" + iKyHieuDi.Text);
            Dictionary <string, object> dic2 = new Dictionary <string, object>();

            dic2.Add("KyHieuDen", iKyHieuDen.EditValue);
            dic2.Add("KyHieuDi", iKyHieuDi.EditValue);
            dic2.Add("Ten", iKyHieuDi.Text + "-" + iKyHieuDen.Text);
            Lstdic.Add(dic);
            Lstdic.Add(dic2);

            long a = _TuyenBayD.ThemNhieu1Ban(Lstdic);

            if (XuLyGiaoDien.ThongBao(Text, a > 0))
            {
                (Owner.ActiveMdiChild as frmTuyenBay).DuLieuSanBay();
                Close();
            }
        }
Ejemplo n.º 18
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 < GVH.RowCount; i++)
            {
                Dictionary <string, object> dicS = new Dictionary <string, object>(Dic);
                for (int y = 0; y < GVH.Columns.Count; y++) //Dòng
                {
                    if (y == GVH.Columns.Count - 1)
                    {
                        object G = GVH.GetRowCellValue(i, GVH.Columns[y]);
                        lstCTV.Add(string.Format("WHERE ID = {0}", G));
                        lstDicS.Add(dicS);
                    }
                    else
                    {
                        object G = GVH.GetRowCellValue(i, GVH.Columns[y]);
                        dicS.Add(GVH.Columns[y].FieldName, G);
                    }
                }
            }
            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);
                }
                if (Owner.ActiveMdiChild is frmVe)
                {
                    (Owner.ActiveMdiChild as frmVe).DuLieu();
                }
                else
                {
                    (Owner.ActiveMdiChild as frmTheoDoiHoan).DuLieu();
                }
                Close();
            }
        }
Ejemplo n.º 19
0
        private void btnLuu2_Click(object sender, EventArgs e)
        {
            if (iDiem.Value == 0)
            {
                XuLyGiaoDien.ShowToolTip(iDiem, "Vui lòng cho điểm");
                return;
            }
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            dic.Add("NhanVien", _NhanVien);
            long CapNhatNum = (kpi.ID > 0) ? (kpid.CapNhat(dic, kpi.ID) > 0 ? kpi.ID : 0) : kpid.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, CapNhatNum > 0))
            {
                (Owner as frmNhanVienThem).TaiLaiKPI();
                Close();
            }
        }
Ejemplo n.º 20
0
        private void btnLuu2_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = iTenDayDu, _Tu = 3, _Den = 100, _ChoQuaThang = !_SanBayD.DaTonTai("TenDayDu", iKyHieu.Text, _SanBayO.ID), _ThongBao2 = "Sân bay đã tồn tại"
                },
                new KiemTra()
                {
                    _Control = iKyHieu, _Tu = 3, _Den = 5, _ChoQuaThang = !_SanBayD.DaTonTai("KyHieu", iKyHieu.Text, _SanBayO.ID), _ThongBao2 = "Sân bay đã tồn tại"
                }
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("TenDayDu", iTenDayDu.Text);
            dic.Add("KyHieu", iKyHieu.Text);
            dic.Add("NoiDia", iNoiDia.Checked);
            dic.Add("KhuVuc", (Text.StartsWith("Khu vực")));
            long CapNhatNum = (_SanBayO.ID > 0) ? (_SanBayD.CapNhat(dic, _SanBayO.ID) > 0 ? _SanBayO.ID : 0) : _SanBayD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, CapNhatNum > 0))
            {
                if (Text.StartsWith("Khu vực"))
                {
                    (Owner as frmNCCThem).KhuVuc();
                }
                else
                {
                    (Owner.ActiveMdiChild as frmTuyenBay).DuLieuSanBay();
                }
                Close();
            }
        }
Ejemplo n.º 21
0
        private void iAC1_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e)
        {
            BindingSource bs        = (BindingSource)GVKPI.DataSource;
            List <O_KPI>  dt        = bs.DataSource as List <O_KPI>;
            int           sumObject = 0;

            if (dt != null)
            {
                sumObject = dt.Select(w => w.Diem).Sum();
            }
            else
            {
                sumObject = 0;
            }

            switch (int.Parse(e.Button.Properties.Tag.ToString()))
            {
            case 1:
                new frmKPIThem(_KhachHangO.ID, sumObject).ShowDialog(this);
                break;

            case 2:
                if (dt.Count > 0)
                {
                    O_KPI SignInOz = GVKPI.GetRow(GVKPI.GetSelectedRows()[0]) as O_KPI;
                    if (SignInOz != null)
                    {
                        new frmKPIThem(SignInOz, sumObject).ShowDialog(this);
                    }
                }
                break;

            case 3:
                if (dt.Count > 0)
                {
                    O_KPI SignInOz = GVKPI.GetRow(GVKPI.GetSelectedRows()[0]) as O_KPI;
                    XuLyGiaoDien.ThongBao(Text, new D_KPI().Xoa(SignInOz.ID) > 0, true);
                    TaiLaiKPI();
                }
                break;
            }
        }
Ejemplo n.º 22
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            if (!btnHuy.Enabled)
            {
                dic.Add("NgayLuu", "GETDATE()");
            }
            dic.Add("TieuDe", iTieuDe.Text);
            dic.Add("NoiDung", iNoiDung.Text);
            dic.Add("GhiChuRieng", iGhiChu.Text);
            dic.Add("TenNV", DuLieuTaoSan.NV.TenDangNhapCty);
            long CapNhatNum = (ghiChu.ID > 0) ? (ghiChuD.CapNhat(dic, ghiChu.ID) > 0 ? ghiChu.ID : 0) : ghiChuD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text + ((ghiChu.ID > 0) ? " sửa" : " thêm"), CapNhatNum > 0))
            {
                DSGhiChu.DataSource = ghiChuD.LayDanhSach();
                iTieuDe.Text        = iNoiDung.Text = iGhiChu.Text = string.Empty;
                btnHuy.Enabled      = false;
            }
        }
Ejemplo n.º 23
0
        private void btnXDC_ItemClick(object sender, ItemClickEventArgs e)
        {
            O_GIAODICH GD = (GVDC.GetRow(GVDC.GetSelectedRows()[0]) as O_GIAODICH);

            switch (GD.LoaiGiaoDich)
            {
            case 1:
            case 0:
                if (!DuLieuTaoSan.Q.KhacXoa)
                {
                    return;
                }
                break;

            default:
                if (!DuLieuTaoSan.Q.KhacAdminXoa)
                {
                    return;
                }
                break;
            }

            if (XuLyGiaoDien.ThongBao("giao dịch", new D_GIAODICH().Xoa(GD.ID) > 0, true))
            {
                string NoiDung = string.Format("Xóa GD ", GD.GhiChu);
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("FormName", Text);
                dic.Add("MaCho", GD.MaCho);
                dic.Add("NoiDung", NoiDung);
                dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID);
                dic.Add("LoaiKhachHang", GD.LoaiKhachHang);
                dic.Add("Ma", GD.IDKhachHang);
                new D_LS_GIAODICH().ThemMoi(dic);
                NapDatCho();
            }
            else
            {
                XuLyGiaoDien.Alert("Xóa không thành công", Form_Alert.enmType.Error);
            }
        }
Ejemplo n.º 24
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = iNCC, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iLoaiGiaoDich, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iGhiChu, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iSoTien, _Tu = 2, _Den = 5000
                }
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);

            if (XuLyGiaoDien.ThongBao(Text, _nCCGDO.ID != 0 ? (_nCCGDD.CapNhat(dic, _nCCGDO.ID) > 0) : (_nCCGDD.ThemMoi(dic) > 0)))
            {
                (Owner.ActiveMdiChild as frmHangBay).DuLieu();
                Close();
            }
        }
Ejemplo n.º 25
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            D_NGANHANG nhb = new D_NGANHANG();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            long CapNhatNum = nho.ID > 0 ? nhb.CapNhat(dic, nho.ID) : nhb.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, CapNhatNum > 0))
            {
                if (nho.ID < 1)
                {
                    List <Dictionary <string, object> > lstDicS = new List <Dictionary <string, object> >();
                    for (int i = 0; i < 30; i++)
                    {
                        dic = new Dictionary <string, object>();
                        dic.Add("NganHangID", CapNhatNum);
                        dic.Add("SoDuCuoi", 0);
                        dic.Add("Ngay", "getdate() - " + i);
                        lstDicS.Add(dic);
                    }
                    new D_SODU_NGANHANG().ThemNhieu1Ban(lstDicS);
                }

                (Owner.ActiveMdiChild as frmNganHang).LayDLNganHang();
                (Owner.ActiveMdiChild as frmNganHang).TaiLaiDuLieu();
                (Owner.ActiveMdiChild as frmNganHang).LayDLKhac();
                GhiChuCmt(nho.ID);
                Close();
            }
        }
Ejemplo n.º 26
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (iTN.DateTime < iDN.DateTime && iCS.EditValue != null)
     {
         Dictionary <string, object> dic = new Dictionary <string, object>();
         dic.Add("ChinhSachID", iCS.EditValue);
         if (XuLyGiaoDien.ThongBao("Chi tiết chính sách sửa", _SODU_DAILYD.CapNhat(dic, IDDaiLy, "WHERE DAILYID= {0} and convert(date,Ngay) between '" + iTN.DateTime.ToString("yyyyMMdd") + "' and '" + iDN.DateTime.ToString("yyyyMMdd") + "'") > 0))
         {
             if (DateTime.Now.ToString("ddMMyyyy") == iDN.DateTime.ToString("ddMMyyyy"))
             {
                 (Owner as frmDaiLyThem).iChinhSach.EditValue = iCS.EditValue;
                 dic = new Dictionary <string, object>();
                 dic.Add("ChinhSach", iCS.EditValue);
                 DaiLyD.CapNhat(dic, IDDaiLy);
             }
             DaiLyD.ChayLaiPhi(iTN.DateTime);
             Close();
         }
     }
     else
     {
         XtraMessageBox.Show("Thông tin nhập không hợp lệ. Vui lòng kiểm tra lại", "Thông báo");
     }
 }
Ejemplo n.º 27
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            bool ChoQua = false;

            if (iMaHD.Text == "0" || !iMaHD.Enabled)
            {
                ChoQua = true;
            }
            else
            {
                ChoQua = !_HoaDonD.DaTonTai(string.Format("WHERE MaHD = N'{0}' AND ID not in ({1})", iMaHD.Text, String.Join(" ,", IDHD.ToArray())));
            }
            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = iMaHD, _ChoQuaThang = ChoQua, _ThongBao2 = "Đã tồn tại", _Tu = 1
                },
                new KiemTra()
                {
                    _Control = iIDKhachHang, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iDiaChi, _Tu = 10, _Den = 500
                },
                new KiemTra()
                {
                    _Control = iMail, _Tu = 10, _Den = 200
                },
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            List <Dictionary <string, object> > lstDicS = new List <Dictionary <string, object> >();
            List <string> lstCTV = new List <string>();

            if (!aaa.Visible)
            {
                dic.Add("SoChungTu", _HoaDonD.TaoChungTu());
            }
            else
            if (_HoaDonO.HoTro < 1)
            {
                _HoaDonO.HoTro = DuLieuTaoSan.NV.ID;
            }
            for (int i = 0; i < bandedGridView1.RowCount; i++)
            {
                Dictionary <string, object> dicS = new Dictionary <string, object>(dic);
                for (int y = 0; y < bandedGridView1.Columns.Count; y++) //Dòng
                {
                    if (bandedGridView1.Columns[y].FieldName.StartsWith("CL"))
                    {
                        continue;
                    }
                    if (bandedGridView1.Columns[y].Visible)//Cột
                    {
                        object G = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns[y]);
                        dicS.Add(bandedGridView1.Columns[y].FieldName, G);
                    }
                    else if (y == bandedGridView1.Columns.Count - 1)
                    {
                        object G = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns[y]);
                        lstCTV.Add(string.Format("WHERE ID = {0}", G));
                        lstDicS.Add(dicS);
                    }
                }
            }

            long a = (_HoaDonO.ID > 0) ? _HoaDonD.SuaNhieu1Ban(lstDicS, lstCTV) : _HoaDonD.ThemNhieu1Ban(lstDicS);

            if (XuLyGiaoDien.ThongBao(Text, a == lstDicS.Count))
            {
                (Owner.ActiveMdiChild as frmHoaDon).DuLieu();
                Close();
            }
        }
Ejemplo n.º 28
0
        private void btnEx_ItemClick(object sender, ItemClickEventArgs e)
        {
            DialogResult dal = XtraMessageBox.Show("Thu hồi chọn [OK], trả chiết khấu chọn [Cancel]", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (XtraMessageBox.Show("Chỉ dùng cho đại lý. File gồm các cột [TenDaiLy,Gia,NoiDung]", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
            {
                return;
            }

            List <Dictionary <string, object> > lstdic = new List <Dictionary <string, object> >();
            List <O_GIAODICH>  giaoDichOs = new List <O_GIAODICH>();
            XtraOpenFileDialog ofd        = new XtraOpenFileDialog();

            ofd.Title      = "Mở File";
            ofd.Filter     = "Excel File (*.xlsx, *.xls) | *.xlsx; *.xls";
            ofd.DefaultExt = ".xlsx";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string ChuoiKetNoi = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ofd.FileName + "; Extended Properties='Excel 12.0 Xml;HDR=YES';";
                using (OleDbConnection conn = new OleDbConnection(ChuoiKetNoi))
                {
                    conn.Open();
                    DataTable        dbSchema   = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                    string           CauTruyVan = "SELECT * FROM [" + dbSchema.Rows[0].Field <string>("TABLE_NAME").Replace("'", string.Empty) + ']';
                    OleDbDataAdapter da         = new OleDbDataAdapter(CauTruyVan, conn);
                    DataTable        dt         = new DataTable();
                    da.Fill(dt);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataRow row = dt.Rows[i];
                        if ((row["TenDaiLy"] ?? "").ToString().Length > 0 && int.Parse((row["Gia"] ?? 0).ToString()) != 0)
                        {
                            if (lstDaiLy.Where(w => w.Ten.ToUpper().Equals(row["TenDaiLy"].ToString().Replace(" Total", "").ToUpper())).Count() > 0)
                            {
                                Dictionary <string, object> dic = new Dictionary <string, object>();
                                dic.Add("NgayGD", "getdate()");
                                dic.Add("NgayCuonChieu", "getdate()");
                                dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID);
                                dic.Add("CoDinh", 1);
                                dic.Add("LoaiKhachHang", "1");
                                dic.Add("IDKhachHang", lstDaiLy.Where(w => w.Ten.ToUpper().Equals(row["TenDaiLy"].ToString().Replace(" Total", "").ToUpper())).First().ID);

                                if (dal == DialogResult.OK)
                                {
                                    dic.Add("GiaHeThong", int.Parse(row["Gia"].ToString().Replace("-", "")));
                                    dic.Add("GiaThu", int.Parse(row["Gia"].ToString().Replace("-", "")));
                                    dic.Add("LoaiGiaoDich", 6);
                                    dic.Add("GiaHoan", 0);
                                }
                                else
                                {
                                    dic.Add("GiaHeThong", 0);
                                    dic.Add("GiaThu", 0);
                                    dic.Add("LoaiGiaoDich", 12);
                                    dic.Add("GiaHoan", int.Parse(row["Gia"].ToString().Replace("-", "")));
                                }

                                dic.Add("TenKhach", row["NoiDung"].ToString());
                                lstdic.Add(dic);
                            }
                            else
                            {
                                XuLyGiaoDien.Alert($"Thông tin đại lý dòng {i} sai", Form_Alert.enmType.Error);
                                return;
                            }
                        }
                        else
                        {
                            XuLyGiaoDien.Alert("Cột Tên đại lý hoặc Giá thiếu thông tin", Form_Alert.enmType.Error);
                            return;
                        }
                    }

                    if (dt.Rows.Count == lstdic.Count)
                    {
                        if (XuLyGiaoDien.ThongBao(Text, new D_GIAODICH().ThemNhieu1Ban(lstdic) > 0))
                        {
                            NapDatCho();
                            Close();
                        }
                    }
                }
            }
        }
Ejemplo n.º 29
0
        private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (XtraMessageBox.Show("Bạn có chắc xóa", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
            {
                return;
            }

            cTNgan = (GVCTNH.GetRow(GVCTNH.GetSelectedRows()[0]) as O_CTNGANHANG);
            D_CTNGANHANG nh = new D_CTNGANHANG();

            List <object> lstCtv = new List <object>();

            if (cTNgan.LoaiKhachHang == 7)
            {
                List <O_CTNGANHANG> cTNganHangOs = new D_CTNGANHANG().Dem($"WHERE MaLienKet = '{cTNgan.MaLienKet}'");
                if (cTNganHangOs.Count == 2)
                {
                    lstCtv.Add(cTNganHangOs[0].ID);
                    lstCtv.Add(cTNganHangOs[1].ID);
                }
                else
                {
                    XuLyGiaoDien.Alert("Sai định dạng", Form_Alert.enmType.Info);
                    return;
                }
            }
            else
            {
                lstCtv.Add(cTNgan.ID);
                new D_BAOCAOCTNH().Xoa(cTNgan.ID, "WHERE IDCTNganHang = {0}");
            }

            if (XuLyGiaoDien.ThongBao(Text, nh.XoaNhieu1Ban(lstCtv, "CTNGANHANG") > 0, true))
            {
                if (cTNgan.LoaiKhachHang == 1 || cTNgan.LoaiKhachHang == 2)
                {
                    new D_DAILY().ChayLaiPhi(cTNgan.NgayHT);
                }
                else if (cTNgan.LoaiKhachHang == 4 || cTNgan.LoaiKhachHang == 30)
                {
                    List <O_GIAODICH> _GiaoDich = new D_GIAODICH().DuLieuNganHang(cTNgan.IDGiaoDich);
                    List <Dictionary <string, object> > lstdic2 = new List <Dictionary <string, object> >();
                    List <string> CTV = new List <string>();
                    Dictionary <string, object> dic2 = new Dictionary <string, object>();
                    for (int i = 0; i < _GiaoDich.Count; i++)
                    {
                        O_GIAODICH gd = _GiaoDich[i];
                        dic2 = new Dictionary <string, object>();
                        CTV.Add(string.Format("WHERE ID = {0}", gd.ID));
                        dic2.Add("Khoa", false);
                        lstdic2.Add(dic2);
                    }
                    new D_GIAODICH().SuaNhieu1Ban(lstdic2, CTV);
                }
                nhD.ChayLaiSD();

                string NoiDung = string.Format("Xóa GD Ngân Hàng : {0} VNĐ [{1}]", cTNgan.SoTien.ToString("#,###"), cTNgan.GhiChu);
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("FormName", Text);
                dic.Add("MaCho", cTNgan.MaLienKet);
                dic.Add("NoiDung", NoiDung);
                dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID);
                dic.Add("LoaiKhachHang", cTNgan.LoaiKhachHang);
                dic.Add("Ma", cTNgan.MaDL);
                if (NoiDung.Length > 10)
                {
                    new D_LS_GIAODICH().ThemMoi(dic);
                }
                TaiLaiDuLieu();
            }
        }
Ejemplo n.º 30
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            D_GIAODICH nhb = new D_GIAODICH();

            switch (iLoaiGiaoDich.EditValue.ToString())
            {
            case "1":
            case "0":
                if (!DuLieuTaoSan.Q.KhacThemSua)
                {
                    return;
                }
                break;

            default:
                if (!DuLieuTaoSan.Q.Lv2KhacAdmin)
                {
                    return;
                }
                break;
            }

            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = iIDKhachHang, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iLoaiKhachHang, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iLoaiGiaoDich, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iTenKhach, _Tu = 2, _Den = 50
                },
                new KiemTra()
                {
                    _Control = iMaCho, _Tu = 2, _Den = 50, _ChoQuaThang = !(new List <int>()
                    {
                        1, 0
                    }).Contains((int)iLoaiGiaoDich.EditValue)
                }
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            #region Lưu
            Dictionary <string, object> dic = new Dictionary <string, object>();
            dic = XuLyDuLieu.FormToDictionary(this, dic);
            dic.Add("NgayCuonChieu", "getdate()");
            dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID);
            dic.Add("CoDinh", 1);

            if ((new List <int>()
            {
                7, 11, 12
            }).Contains((int)iLoaiGiaoDich.EditValue))
            {
                dic.Remove("GiaThu");
                dic.Add("GiaHeThong", 0);
                dic.Add("GiaThu", 0);
                dic.Add("GiaHoan", iGiaThu.Value);
            }
            else
            {
                dic.Add("GiaHeThong", iGiaThu.Value);
            }


            if (XuLyGiaoDien.ThongBao(Text, Gd.ID != 0 ? (nhb.CapNhat(dic, Gd.ID) > 0) : (nhb.ThemMoi(dic) > 0)))
            {
                (Owner.ActiveMdiChild as frmTongHop).NapDatCho();
                GhiChuCmt(Gd.ID);
                Close();
            }
            #endregion
        }