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(); } }
private void btnLuu_Click(object sender, EventArgs e) { List <KiemTra> kiemTras = new List <KiemTra>(); kiemTras.Add(new KiemTra() { _Control = iKhachSan, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iMaCho, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iIDKhachHang, _Tu = 1, _Den = 50 }); 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); XulyDuLieuTruocKhiThem(dic); }
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(); } }
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(); } }
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(); } }
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 }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
private void btnLuu_Click(object sender, EventArgs e) { if (_lstSIChinh.Where(w => w.SignIn.Equals(iSignIn.Text) && iSignIn.Text.Length > 0).Count() == 0) { GCSI.DataSource = null; List <KiemTra> kiemTras = new List <KiemTra>(); kiemTras.Add(new KiemTra() { _Control = icmb, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iHangBay, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iSignIn, _Tu = 1, _Den = 50, _ChoQuaThang = icmb.SelectedIndex == 0 }); XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1); if (!dxValidationProvider1.Validate()) { XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning); return; } O_SIGNIN si = new O_SIGNIN(); si.CanLam = icmb.SelectedIndex; si.DaiLy = (int)iIDKhachHang.EditValue; si.HangBay = (int)iHangBay.EditValue; si.SignIn = iSignIn.Text; si.MatKhau = iMatKhau.Text; si.Chinh = iChinh.Checked; _lstSIChinh.Add(si); GCSI.DataSource = _lstSIChinh; GVSI.ExpandAllGroups(); XulyDulieuKhiThem(); iMatKhau.Text = RandomPassword(); iSignIn.Text = ""; } }
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(); } }
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(); } }
private void btnLuu_Click(object sender, EventArgs e) { if (gridView2.RowCount > 0 && gridView2.Columns["SoTien"].SummaryItem.SummaryValue.ToString() != (iSoTien.Value * (iLoaiKhachHang.EditValue.ToString() == "8" ? -1 : 1)).ToString()) { XuLyGiaoDien.Alert("Tổng tiền chi tiết không bằng giao dịch", Form_Alert.enmType.Warning); return; } List <KiemTra> kiemTras = new List <KiemTra>() { new KiemTra() { _Control = iNganHangID, _Tu = 2, _Den = 50 }, new KiemTra() { _Control = iLoaiGiaoDich, _Tu = 2, _Den = 50 }, new KiemTra() { _Control = iMaDL, _Tu = 2, _Den = 50, _ChoQuaThang = new List <int>() { 6, 9 }.Contains((int)iLoaiKhachHang.EditValue) }, new KiemTra() { _Control = iLoaiKhachHang, _Tu = 2, _Den = 50 } }; 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 = XuLyDuLieu.FormToDictionary(this, dic); bool ThanhCong = false; if (int.Parse(iLoaiKhachHang.EditValue.ToString()) == 7) { Dictionary <string, object> dicnh = new Dictionary <string, object>(); dicnh.Add("NgayGD", iNgayGD.DateTime); dicnh.Add("NganHangID", iMaDL.EditValue); dicnh.Add("MaDL", iNganHangID.EditValue); dicnh.Add("SoTien", 0 - iSoTien.Value); dicnh.Add("GhiChu", iGhiChu.Text); dicnh.Add("TrangThaiID", iTrangThaiID.EditValue); dicnh.Add("NgayHT", iNgayHT.DateTime); dicnh.Add("LoaiGiaoDich", ((int)iLoaiGiaoDich.EditValue % 2 == 0) ? int.Parse(iLoaiGiaoDich.EditValue.ToString()) - 1 : int.Parse(iLoaiGiaoDich.EditValue.ToString()) + 1); dicnh.Add("LoaiKhachHang", iLoaiKhachHang.EditValue); dicnh.Add("NVGiaoDich", iNVGiaoDich.EditValue); dicnh.Add("GhiChuNV", iGhiChuNV.Text); if (CTM.ID == 0) { string Ma = ct.LayGioServer().ToString("yyyyMMddhhmmssttt"); dicnh.Add("MaLienKet", Ma); dic.Add("MaLienKet", Ma); lstDic.Add(dic); lstDic.Add(dicnh); ThanhCong = ct.ThemNhieu1Ban(lstDic) > 1; } else { List <string> lstCTV = new List <string>() { string.Format("WHERE ID = {0}", CTM.ID), string.Format("WHERE MaLienKet = '{1}' and ID <> {0}", CTM.ID, CTM.MaLienKet) }; lstDic.Add(dic); lstDic.Add(dicnh); if ((int)iLoaiGiaoDich.EditValue != CTM.LoaiGiaoDich) { string Ma = ct.LayGioServer().ToString("yyyyMMddhhmmssttt"); dicnh.Add("MaLienKet", Ma); dic.Add("MaLienKet", Ma); List <string> lstTb = new List <string>(); List <string> lstThem = new List <string>(); lstThem.Add("S"); lstThem.Add("T"); lstTb.Add("CTNGANHANG"); lstTb.Add("CTNGANHANG"); ThanhCong = ct.CapNhat_ThemNhieu(lstDic, lstTb, lstCTV, lstThem) > 1; } else { ThanhCong = ct.SuaNhieu1Ban(lstDic, lstCTV) > 1; } } } else { ThanhCong = ((CTM.ID == 0) ? ct.ThemMoi(dic) : ct.CapNhat(dic, CTM.ID)) > 0; } if (XuLyGiaoDien.ThongBao(iLoaiGiaoDich.Text + (CTM.ID != 0 ? " sửa" : " thêm"), ThanhCong)) { if (_GiaoDichOLD.Count > 0 || _GiaoDich.Count > 0) { List <Dictionary <string, object> > lstDicT = new List <Dictionary <string, object> >(); List <string> lstTb = new List <string>(); List <string> lstThem = new List <string>(); List <string> lstCTV = new List <string>(); foreach (O_BAOCAOCTNH d in _GiaoDich) { if (_GiaoDichOLD.Contains(d)) { lstDicT.Add(XuLyDuLieu.ConvertClassToDic(d)); lstThem.Add("S"); } else { lstDicT.Add(XuLyDuLieu.ConvertClassToDic(d)); lstThem.Add("T"); } lstCTV.Add(string.Format("WHERE ID = {0}", d.ID)); lstTb.Add("BAOCAOCTNH"); } new D_BAOCAOCTNH().CapNhat_ThemNhieu(lstDicT, lstTb, lstCTV, lstThem); List <object> lstCTVBC = new List <object>(); foreach (O_BAOCAOCTNH d in _GiaoDichOLD) { if (!_GiaoDich.Contains(d)) { lstCTVBC.Add(d.ID); } } if (lstCTVBC.Count > 0) { new D_BAOCAOCTNH().XoaNhieu1Ban(lstCTVBC, "BAOCAOCTNH"); } } new D_NGANHANG().ChayLaiSD(); O_LOAIGIAODICH _NCCO = iLoaiGiaoDich.GetSelectedDataRow() as O_LOAIGIAODICH; if (CTM.NganHangID == 1) { (Owner.ActiveMdiChild as frmTienMat).TaiLaiDuLieu(); } else { (Owner.ActiveMdiChild as frmNganHang).LayDLNganHang(); (Owner.ActiveMdiChild as frmNganHang).TaiLaiDuLieu(); } GhiChuCmt(CTM.ID); Close(); } }
private void simpleButton3_Click(object sender, EventArgs e) { List <KiemTra> kiemTras = new List <KiemTra>(); kiemTras.Add(new KiemTra() { _Control = iTen, _Tu = 2 }); kiemTras.Add(new KiemTra() { _Control = iMaDL, _ChoQua = !_DaiLyD.DaTonTai("MaDL", iMaDL.Text, _DaiLyO.ID), _ThongBao2 = "Đã tồn tại", _Tu = 3, _Den = 10 }); kiemTras.Add(new KiemTra() { _Control = iMaAGS, _Tu = 3, _Den = 10 }); kiemTras.Add(new KiemTra() { _Control = iDiDong, _SDT = true }); kiemTras.Add(new KiemTra() { _Control = iChinhSach }); kiemTras.Add(new KiemTra() { _Control = iTinhTrang }); kiemTras.Add(new KiemTra() { _Control = iNguoiDaiDienHD, _Tu = 3, _Den = 1000 }); kiemTras.Add(new KiemTra() { _Control = iDienThoaiHD, _SDT = true }); kiemTras.Add(new KiemTra() { _Control = iEmailHD, _Mail = true }); kiemTras.Add(new KiemTra() { _Control = iEmailGiaoDich, _Tu = 10, _Den = 1000 }); if (iEmailGiaoDich.Text.StartsWith("\r\n")) { iEmailGiaoDich.Text = iEmailGiaoDich.Text.Substring(4); } 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 (_DaiLyO.ID < 1) { dic.Add("LoaiKhachHang", _DaiLyO.LoaiKhachHang); } long CapNhatNum = (_DaiLyO.ID > 0) ? (_DaiLyD.CapNhat(dic, _DaiLyO.ID) > 0 ? _DaiLyO.ID : 0) : _DaiLyD.ThemMoi(dic, true); if (XuLyGiaoDien.ThongBao(Text, CapNhatNum > 0)) { if (_DaiLyO.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", _DaiLyO.LoaiKhachHang); dic.Add("ChinhSachID", iChinhSach.EditValue); dic.Add("DaiLyID", CapNhatNum); dic.Add("Ngay", "getdate() - " + i); lstDicS.Add(dic); } new D_SODU_DAILY().ThemNhieu1Ban(lstDicS); DaiLy(); } (Owner.ActiveMdiChild as frmDaiLy).DuLieu(); Close(); } }
private void btnLuu_Click(object sender, EventArgs e) { List <KiemTra> kiemTras = new List <KiemTra>(); kiemTras.Add(new KiemTra() { _Control = iHang, _Tu = 3, _Den = 30, }); kiemTras.Add(new KiemTra() { _Control = iLoaiPhi, _Tu = 3, _Den = 30, }); XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1); if (!dxValidationProvider1.Validate()) { XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning); return; } if (!chk.Checked && _CTchinhSachO.NgayA < DateTime.Now.AddDays(30)) { if (XtraMessageBox.Show("Chỉnh chính sách sẽ ảnh hưởng tới số dư bạn muốn chỉnh sửa", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) { return; } } List <string> lstString = iHanhTrinh.Lines.ToList(); string lstint = ","; if (!iTatCaTuyenBay.Checked) { foreach (string str in lstString) { if (str.Length > 0) { if (TuyenBayOs.Where(w => w.Ten.Replace(" ", string.Empty).Equals(str.Replace(" ", string.Empty))).Count() == 0) { XuLyGiaoDien.Alert("Hành trình " + str + " không tồn tại", Form_Alert.enmType.Warning); lstint = string.Empty; return; } else { lstint += TuyenBayOs.Where(w => w.Ten.Replace(" ", string.Empty).Equals(str.Replace(" ", string.Empty))).ToList()[0].ID.ToString() + " ,"; } } } } Dictionary <string, object> dic = new Dictionary <string, object>(); dic = XuLyDuLieu.FormToDictionary(this, dic); dic.Add("IDChinhSach", _ChinhSachO.ID); if (!iHanhTrinh.Text.Contains("-")) { dic.Add("HanhTrinhID", iHanhTrinh.Text); } else { dic.Add("HanhTrinhID", lstint); } long a = (!chk.Checked) ? _CTChinhSachD.CapNhat(dic, _CTchinhSachO.IDCT, "WHERE IDCT = {0}") : _CTChinhSachD.ThemMoi(dic, true); if (XuLyGiaoDien.ThongBao(igroupControl1.Text, a > 0)) { LayChiTiet(); } }
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 }
private void btnLuu_Click(object sender, EventArgs e) { #region Bước kiểm tra nhập Dictionary <string, object> dic = new Dictionary <string, object>(); O_KHOANGAY kn = new D_KHOANGAY().KiemTraNgayKhoa(_GiaoDichO.NgayGD); if (_GiaoDichO.TinhCongNo) { if (!DuLieuTaoSan.Q.TheoDoiHoanAdmin) { if ((kn.HoatDong) && !(kn.Code ?? string.Empty).Contains(iMaCho.Text.Replace(" ", string.Empty))) { XuLyGiaoDien.Alert("Ngày đã bị khóa", Form_Alert.enmType.Warning); return; } } if (DateTime.Now.Date.Subtract(iNgayGD.DateTime.Date).Days > 30 || DateTime.Now.Date.Subtract(_GiaoDichO.NgayGD.Date).Days > 30) { XuLyGiaoDien.Alert("Ngày đã bị khóa", Form_Alert.enmType.Warning); return; } } List <KiemTra> kiemTras = new List <KiemTra>(); kiemTras.Add(new KiemTra() { _Control = iNganHang, _Tu = 1, _Den = 50, _ChoQuaThang = iNganHang.Properties.ReadOnly }); kiemTras.Add(new KiemTra() { _Control = iIDKhachHang, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iNhaCungCap, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iHTTT, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iHang, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iMaCho, _Tu = 5, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iLoaiVeDi, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iTuyenBayDi, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iIDKhachHang, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iSoHieuVe, _ChoQuaThang = iGioBayVe.Properties.ReadOnly, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iLoaiVeVe, _ChoQuaThang = iLoaiVeVe.Properties.ReadOnly, _Tu = 1, _Den = 50 }); kiemTras.Add(new KiemTra() { _Control = iTuyenBayVe, _ChoQuaThang = iTuyenBayVe.Properties.ReadOnly, _Tu = 1, _Den = 50 }); if (!chkDen.Checked) { dic.Add("SoHieuVe", null); dic.Add("LoaiVeVe", null); dic.Add("HanhLyVe", null); dic.Add("TuyenBayVe", null); dic.Add("GioBayVe_Den", null); dic.Add("GioBayVe", null); } dic = XuLyDuLieu.FormToDictionary(this, dic); dic.Add("GhiChu", iGhiChu.Text); XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1); if (!dxValidationProvider1.Validate()) { XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning); return; } if ((int)iHTTT.EditValue == 7) { dic.Add("SMS", 1); } dic.Add("SoLuongVe", (chkDen.Checked) ? 2 : 1); if (_GiaoDichO.ID < 1) { dic.Add("NgayCuonChieu", iNgayGD.DateTime); } dic.Add("LoaiGiaoDich", 9); if (_GiaoDichO.ID < 1) { dic.Add("Khoa", 0); } #endregion XulyDuLieuTruocKhiThem(dic); }