private bool IsValid() { String soQuyetDinh = txtSoQuyetDinh.Text.Trim().ToLower(); if (soQuyetDinh == "") { BaseMessages.ShowErrorMessage("Số QĐ không được rỗng!"); return(false); } if (int.Parse(cmbNhaCungCap.EditValue.ToString()) <= 0) { BaseMessages.ShowErrorMessage("Chưa chọn nhà cung cấp"); return(false); } for (int i = fgQD.Rows.Fixed; i < fgQD.Rows.Count; i++) { if (!m_blFlag && i == fgQD.Row) { continue; } if (fgQD.GetDataDisplay(i, "So_QuyetDinh").Trim().ToLower() == soQuyetDinh) { BaseMessages.ShowErrorMessage("Số QĐ trùng với số QĐ dòng thứ " + i.ToString() + "!"); return(false); } } return(true); }
private bool IsValid() { for (int i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { if (!fg.Rows[i].Visible) { continue; //TonTai = false } String Ten_Kho = fg.GetDataDisplay(i, "Ten_Kho").ToLower().Trim(); if (Ten_Kho == "") { BaseMessages.ShowErrorMessage("Chưa nhập tên kho dòng thứ " + i.ToString() + "."); return(false); } for (int j = i + 1; j < fg.Rows.Count; j++) { if (!fg.Rows[j].Visible) { continue; } if (fg.GetDataDisplay(j, "Ten_Kho").ToLower().Trim() != Ten_Kho) { continue; } BaseMessages.ShowErrorMessage("Tên kho dòng thứ " + i.ToString() + " và dòng thứ " + j.ToString() + " trùng nhau!"); return(false); } } return(true); }
private void ThemMoiDataTableTmp(DataRow dr) { dr["ID_VatTu"] = fgChiTietXuat[fgChiTietXuat.Row, "ID_VatTu"]; dr["ID_TheKho"] = fgChiTietTheKho[fgChiTietTheKho.Row, "ID_TheKho"]; if ((fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"] ?? "").ToString() == "") { dr["SoLuong"] = 0; } else { if (int.Parse(fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"].ToString()) < 0) { BaseMessages.ShowErrorMessage("Số lượng xuất không âm."); fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"] = 0; return; } else { if (int.Parse(fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongtrongkho"].ToString()) < (int.Parse(fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"].ToString()) + int.Parse(fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongKhac"].ToString()))) { BaseMessages.ShowErrorMessage("Số lượng xuất phải bé hơn số lượng trong kho."); fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"] = 0; return; } else { dr["SoLuong"] = fgChiTietTheKho[fgChiTietTheKho.Row, "SoLuongXuat"]; } } } }
private void btnXoa_Click(object sender, System.EventArgs e) { DialogResult dg = BaseMessages.ShowQuestionMessage("Bạn có chắc chắn muốn xóa?"); if (dg == DialogResult.Yes) { try { clsPhieuXuat_ChiTiet cls0 = new clsPhieuXuat_ChiTiet(); cls0.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()); cls0.DeleteWID_PhieuXuatLogic(); clsPhieuXuat_ChiTiet_TheKho cls1 = new clsPhieuXuat_ChiTiet_TheKho(); cls1.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()); cls1.DeleteWID_PhieuXuatLogic(); clsQD_XuatVatTu cls = new clsQD_XuatVatTu(); cls.ID_PhieuXuat = int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()); cls.Delete(); BaseMessages.ShowInformationMessage("Xóa thành công."); Loadfg(); } catch (Exception ex) { BaseMessages.ShowErrorMessage("Lỗi" + ex.ToString()); } } }
private void IsValid() { var fg = fgNS_Nhom; for (var i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { if (!fg.Rows[i].Visible) { continue; } for (var j = i + 1; j < fg.Rows.Count; j++) { if (!fg.Rows[j].Visible) { continue; } if (fg.GetDataDisplay(i, "ID_NhanSu").ToLower().Trim() != fg.GetDataDisplay(j, "ID_NhanSu").ToLower().Trim()) { continue; } BaseMessages.ShowErrorMessage("Nhân sự dòng thứ " + i + " và dòng thứ " + j + " trùng nhau!"); fg.Rows.Remove(j); } } }
private bool IsValid() { for (var i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { if (!fg.Rows[i].Visible) { continue; } var ten_LoaiCV = fg.GetDataDisplay(i, "Ten_LoaiCV").ToLower().Trim(); //if (ten_LoaiCV == "") //{ // BaseMessages.ShowErrorMessage("Chưa nhập loại công việc dòng có STT là " + fg.GetDataDisplay(i, "STT").ToLower().Trim().ToString() + "!"); // return false; //} if (fg.GetIntValue(i, "ID_LoaiCV") == fg.GetIntValue(i, "ID_LoaiCV_Cha") && fg.GetIntValue(i, "ID_LoaiCV_Cha") != 0) { BaseMessages.ShowErrorMessage("Không được phép thực hiện thao tác này!"); return(false); } //if (fg.GetIntValue(i, "ID_LoaiCV") == fg.GetIntValue(i+1, "ID_LoaiCV_Cha") && fg.GetIntValue(i, "ID_LoaiCV_Cha") == fg.GetIntValue(i+1, "ID_LoaiCV")) //{ // BaseMessages.ShowErrorMessage("Không được tạo loại công việc vòng tròn"); // return false; //} for (var j = i + 1; j < fg.Rows.Count; j++) { if (!fg.Rows[j].Visible) { continue; } if (fg.GetDataDisplay(j, "Ten_LoaiCV").ToLower().Trim() != ten_LoaiCV || fg.GetDataDisplay(j, "Ten_LoaiCV").ToLower().Trim().ToString() == "" || ten_LoaiCV.ToString() != "") { continue; } BaseMessages.ShowErrorMessage("Tên loại công việc dòng thứ " + fg.GetDataDisplay(i, "STT").ToLower().Trim().ToString() + " và dòng thứ " + fg.GetDataDisplay(j, "STT").ToLower().Trim().ToString() + " trùng nhau!"); return(false); } var row = 0; if (!ThoaManCongViecGoc(i, out row)) { BaseMessages.ShowErrorMessage("Loại CV " + fg.GetDataDisplay(i, "Ten_LoaiCV") + " và " + fg.GetDataDisplay(row, "Ten_LoaiCV") + " là cha con của nhau"); return(false); } } return(true); }
private void btnGhiTheKho_Click(object sender, System.EventArgs e) { clsKho_VatTu cls = new clsKho_VatTu(); int HieuSo = cls.KiemTraSoLuong(int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()), int.Parse(fgQDX[fgQDX.Row, "ID_Kho"].ToString()), 0); if (HieuSo >= 0) // kiểm tra số lượng xuất { Duyet("Bạn có chắc chắn muốn ghi thẻ kho?", 6, "Ghi thành công!"); cls.Update_SoLuong_Xuat(int.Parse(fgQDX[fgQDX.Row, "ID_PhieuXuat"].ToString()), 6); } else { BaseMessages.ShowErrorMessage("Số lượng xuất lớn hơn số lượng trong kho. Vui lòng cập nhật."); return; } }
private void btnLuu_Click(object sender, EventArgs e) { clsPhieuXuat cls = new clsPhieuXuat(); cls.ID_Kho = int.Parse(cboKhoXuat.EditValue.ToString()); cls.Ngay_HachToan = (DateTime)dtpNgayHachToan.Value; cls.So_PhieuXuat = txtSoPhieuXuat.Text; cls.Ngay_XuatKho = (DateTime)dtpNgayXuatKho.Value; cls.Ngay_Lap = GlobalVariables.NgayLV; cls.Ngay_PheDuyet = GlobalVariables.NgayLV; cls.Nguoi_Lap = "ABC"; cls.Nguoi_PheDuyet = ""; cls.TrangThai = 0; cls.TonTai = true; if (IsValidPhieuXuat()) { try { if (GlobalVariables.m_Flag == 0) { cls.Insert(); SavePhieuChiTiet(int.Parse(cls.ID_PhieuXuat.ToString())); SavePhieuChiTiet_TheKho(int.Parse(cls.ID_PhieuXuat.ToString())); } else { cls.Update(); SavePhieuChiTiet(m_iID_PX); SavePhieuChiTiet_TheKho(m_iID_PX); } BaseMessages.ShowInformationMessage("Cập nhật thành công."); m_dtTmp.Dispose(); this.Close(); GlobalVariables.m_Flag = 100; } catch (Exception ex) { BaseMessages.ShowErrorMessage(ex.ToString()); } } }
private bool IsValid() { for (int i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { if ((!m_bFlag && i == fg.Row) || fg.Rows[i].IsNode) { continue; } if (cmbCapTren.EditValue.ToString() == fg[i, "ID_ChucVu_CapDuoi"].ToString() && cmbCapDuoi.EditValue.ToString() == fg[i, "ID_ChucVu_CapTren"].ToString()) { BaseMessages.ShowErrorMessage("Không thể quản lý nhân viên cấp cao hơn!"); return(false); } if (cmbCapTren.EditValue.ToString() == fg[i, "ID_ChucVu_CapTren"].ToString() && cmbCapDuoi.EditValue.ToString() == fg[i, "ID_ChucVu_CapDuoi"].ToString()) { BaseMessages.ShowErrorMessage("Dữ liệu trùng với dòng " + i.ToString() + "!"); return(false); } } return(true); }
private bool IsValid() { for (var i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { if (!m_bFlag && i == fg.Row || fg.Rows[i].IsNode) { continue; } if (cmbNguoiQuanLy.EditValue.ToString() == fg[i, "ID_NhanVien"].ToString() && cmbNhanVien.EditValue.ToString() == fg[i, "ID_NguoiQuanLy"].ToString()) { BaseMessages.ShowErrorMessage("Không thể quản lý nhân viên cấp cao hơn!"); return(false); } if (cmbNguoiQuanLy.EditValue.ToString() == fg[i, "ID_NguoiQuanLy"].ToString() && cmbNhanVien.EditValue.ToString() == fg[i, "ID_NhanVien"].ToString()) { BaseMessages.ShowErrorMessage("Dữ liệu trùng với dòng " + i + "!"); return(false); } } return(true); }
private bool IsValid() { for (int i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { if (!fg.Rows[i].Visible) { continue; //Tontai = 0 } String Ten_VatTu = fg.GetDataDisplay(i, "Ten_VatTu").ToLower().Trim(); if (Ten_VatTu == "") { BaseMessages.ShowErrorMessage("Chưa nhập tên vật tư dòng thứ " + i.ToString() + "."); return(false); } if (fg.GetIntValue(i, "ID_NhaCungCap") == 0) { BaseMessages.ShowErrorMessage("Chưa chọn nhà cung cấp dòng thứ " + i.ToString() + "."); return(false); } for (int j = i + 1; j < fg.Rows.Count; j++) { if (!fg.Rows[j].Visible) { continue; } if (fg.GetDataDisplay(j, "Ten_VatTu").ToLower().Trim() != Ten_VatTu) { continue; } BaseMessages.ShowErrorMessage("Tên vật tư dòng thứ " + i.ToString() + " và dòng thứ " + j.ToString() + " trùng nhau!"); return(false); } } return(true); }
private bool IsValidPhieuXuat() { if ((txtSoPhieuXuat.Text ?? "") == "" || cboKhoXuat.EditValue == null || dtpNgayHachToan.Text == "" || dtpNgayXuatKho.Text == "") { BaseMessages.ShowInformationMessage("Vui lòng nhập đầy đủ thông tin."); return(false); } else { clsPhieuXuat cls = new clsPhieuXuat(); DataTable dt = cls.SelectAll(); foreach (DataRow dr in dt.Rows) { if (txtSoPhieuXuat.Text.Trim() == dr["So_PhieuXuat"].ToString().Trim()) { if (GlobalVariables.m_Flag != 0) { continue; } BaseMessages.ShowErrorMessage("Trùng số phiếu. Vui lòng nhập lại."); return(false); } } if (fgChiTietTheKho.Row < 0 && GlobalVariables.m_Flag == 0) { BaseMessages.ShowInformationMessage("Vui lòng chọn vật tư."); return(false); } if (!IsValidPhieuXuatTheKho()) { BaseMessages.ShowInformationMessage("Vui lòng nhập số lượng vật tư và số vật tư xuất phải bé hơn vật tư có trong kho."); return(false); } } return(true); }
static void Main() { string[] SwitchKeys = { "/TenND", "/MatKhauND", "/TenMC", "/TenDangNhapMC", "/MatKhauMC", "/Internet" }; string[] CommandLines = System.Environment.CommandLine.Split(SwitchKeys, StringSplitOptions.None); if (CommandLines.Length < 7) { BaseMessages.ShowErrorMessage("Sai tham số khởi tạo chương trình"); return; } //Khởi tạo kết nối clsConnecionString.ConnectionString_System = string.Format("Data Source={0};Initial Catalog={1}; User ID={2}; Password={3}", CommandLines[3].Trim(), clsConnecionString.DBName_System, CommandLines[4].Trim(), CommandLines[5].Trim()); if (CommandLines[6].Trim() == "Y") { clsConnecionString.KetNoiInternet = true; } Garco10.SystemModule.HeThong.GlobalVariables.uTenDangNhap = CommandLines[1].Trim().ToLower(); clsConnecionString.CreateAllConnections(); clsTaiKhoanDangNhap cls = new clsTaiKhoanDangNhap(); cls.TenDangNhap = GlobalVariables.uTenDangNhap; DataTable dt = cls.Select_ThongTinTaiKhoan(); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; GlobalVariables.uID_TaiKhoanDangNhap = Int16.Parse(dr["ID_TaiKhoanDangNhap"].ToString()); GlobalVariables.uID_ChucVu = Int16.Parse("0" + dr["ID_ChucVu"]); GlobalVariables.uID_DonVi = Int16.Parse("0" + dr["ID_DonVi"]); GlobalVariables.uID_BoPhan = Int16.Parse("0" + dr["ID_BoPhan"]); GlobalVariables.uTen_ChucVu = dr["Ten_ChucVu"].ToString(); GlobalVariables.uTen_DonVi = dr["Ten_DonVi"].ToString(); GlobalVariables.uTen_BoPhan = dr["Ten_BoPhan"].ToString(); GlobalVariables.uTenDayDu = dr["TenDayDu"].ToString(); GlobalVariables.uLoai_TaiKhoan = (Enumerations.Loai_TaiKhoan) int.Parse("0" + dr["Loai_TaiKhoan"]); GlobalVariables.uQuyen_TatCaDonVi = (bool)dr["Quyen_TatCaDonVi"]; GlobalVariables.uTaiKhoan_DanhGia = (bool)dr["TaiKhoan_DanhGia"]; } clsPQ_TaiKhoan_DonVi oDV = new clsPQ_TaiKhoan_DonVi(); oDV.ID_TaiKhoanDangNhap = GlobalVariables.uID_TaiKhoanDangNhap; dt = oDV.Select_wTaiKhoan(); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { GlobalVariables.uListQuyen_DonVi.Add(dr["ID_DonVi"].ToString()); } } M10_System.clsFTP_Server o = new M10_System.clsFTP_Server(); dt = o.SelectAll(); String sLoaiServer = "FTP_Server_Local"; if (Garco10.ConnectionProviders.clsConnecionString.KetNoiInternet) { sLoaiServer = "FTP_Server_Internet"; } foreach (DataRow dr in dt.Rows) { Garco10.SystemModule.HeThong.FTP_FilesManager.FTP_Server = dr[sLoaiServer].ToString(); Garco10.SystemModule.HeThong.FTP_FilesManager.FTP_UserName = dr["FTP_UserName"].ToString(); Garco10.SystemModule.HeThong.FTP_FilesManager.FTP_PassWord = dr["FTP_PassWord"].ToString(); Garco10.SystemModule.HeThong.FTP_FilesManager.FTP_Port = dr["FTP_Port"].ToString(); break; } //Lấy CultureInfo của Win trước khi gán thành vi-VN của phần mềm System.Globalization.CultureInfo cultureinfo = new System.Globalization.CultureInfo("vi-VN", false); cultureinfo.NumberFormat.CurrencyDecimalSeparator = "."; cultureinfo.NumberFormat.CurrencyGroupSeparator = ","; cultureinfo.NumberFormat.NumberDecimalSeparator = "."; cultureinfo.NumberFormat.NumberGroupSeparator = ","; Application.CurrentCulture = cultureinfo; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DevExpress.Skins.SkinManager.EnableFormSkins(); DevExpress.UserSkins.BonusSkins.Register(); DevExpress.XtraGrid.Localization.GridLocalizer.Active = new VSCM.Base.Classes.clsVietHoaDevGrid(); Application.Run(new frmMain_QLCV()); }