示例#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();
            }
        }
示例#2
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();
            }
        }
        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);
        }
示例#4
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 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();
            }
        }
示例#6
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();
            }
        }
示例#7
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();
            }
        }
示例#8
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();
            }
        }
示例#9
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();
            }
        }
示例#10
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();
            }
        }
示例#11
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
        }
示例#12
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();
            }
        }
示例#13
0
        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);
        }
示例#14
0
        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();
            }
        }
示例#15
0
        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();
            }
        }
示例#16
0
        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();
            }
        }