private void mnuHT_KETCHUYENSODU_Click(object sender, RoutedEventArgs e) { if (Utils.ChonThoiGian(false, true, false)) { MTGlobal.Ketchuyensodu(); } }
public DM_BangGia() { InitializeComponent(); MTButton.cmdAdd = this.cmdAdd; MTButton.cmdEdit = this.cmdEdit; MTButton.cmdDel = this.cmdDel; MTButton.cmdSave = this.cmdSave; MTButton.cmdAbort = this.cmdAbort; MTGlobal.SetFormatGridControl(grdBangGiaCT, tblViewCT); MTGlobal.SetFormatGridControl(grdBangGiaCT, tblViewBG); Dlg = Utils.shwWait(); //LOAD PRODUCT GROUP //DataTable otblNhomSP = new MTSQLServer().wRead(SQL_PRODUCT_GROUP, null, false); //grdBangGia.ItemsSource = otblNhomSP; crud_BangGia = new CRUDHandling(grdBangGia, tblViewBG, colBanggia, MTROLE, MTButton, "DM_BANGGIA", "Banggiaid", CODE_NAME, CODE_HEADER, SQL_PRODUCT_GROUP, ""); String err = crud_BangGia.GridForm_Loaded(); MTGlobal.SetGridReadOnly(grdBangGia, tblViewBG, true); crud = new CRUDHandling(grdBangGiaCT, tblViewCT, colMasp, MTROLE, MTButton, TABLE_NAME, ID_NAME, CODE_NAME, CODE_HEADER, String.Format(SQL_LOAD_ALL_BGCT, mBangGiaId), SQL_DELETE_BGCT); System.Threading.Thread oThreSP = new System.Threading.Thread(LoadSanPham); oThreSP.Start(); Utils.closeWait(Dlg); }
private void cmdAddAll_Click(object sender, EventArgs e) { foreach (FunctionNode node in trees) { DataRow rw = tblSelected.NewRow(); rw["soid"] = MTGlobal.GetNewID(); rw["macn"] = node.macn; rw["tencn"] = node.chucnang; rw["them"] = true; rw["sua"] = true; rw["xoa"] = true; rw["duyet"] = true; rw["in"] = true; tblSelected.Rows.Add(rw); foreach (FunctionNode child in node.child) { DataRow rw1 = tblSelected.NewRow(); rw1["soid"] = MTGlobal.GetNewID(); rw1["macn"] = child.macn; rw1["tencn"] = child.chucnang; rw1["them"] = true; rw1["sua"] = true; rw1["xoa"] = true; rw1["duyet"] = true; rw1["in"] = true; tblSelected.Rows.Add(rw1); } } grdChucNang.DataSource = tblSelected; trees.Clear(); initTree(); }
public CX_PhieuCX(String mPhieuID, String mLoaiPhieu, String mTuNgay, String mDenNgay, MTGlobal.MT_ROLE mActRole, bool isAddNew = false) { InitializeComponent(); this.lblTitle.Content = "LÂP PHIẾU GỬI CHÀNH"; this.pPhieuID = mPhieuID; this.pTuNgay = mTuNgay == "" ? DateTime.Now.ToShortDateString() : mTuNgay; this.pDenNgay = mDenNgay == "" ? DateTime.Now.ToShortDateString() : mDenNgay; this.pLoaiPhieu = mLoaiPhieu; this.pACT_ROLE = mActRole; Dlg = Utils.shwWait(); setUserRight(); if (isAddNew) { fdoAdd(); } else { BindData(); MTGlobal.SetGridReadOnly(grdPhieu, tblView, true); setReadOnly(true); } System.Threading.Thread oThreSP = new System.Threading.Thread(LoadSanPham); oThreSP.Start(); Utils.closeWait(Dlg); }
private void fdoSave() { String msg = ""; try { if (MTGlobal.MT_CURRENT_ACTION == "ADD" || MTGlobal.MT_CURRENT_ACTION == "EDIT") { DataTable dt = ((DataView)gvNhomSanPham.DataSource).Table; if (MTSQLServer.getMTSQLServer().doSaveTable(SQLAdaptor, dt)) { SysPar.SetGridReadOnly(true, gvNhomSanPham); MTGlobal.SetToolStripButtonAction(MTROLE, MTButton, "SAVE"); setDataSourceNhomSanPham(); msg = Utils.SAVE_DB_OK; } else { msg = Utils.ERR_UPDATE_DB; } } } catch (Exception ex) { msg = ex.Message.ToString(); } if (msg != "") { //System.Windows.MessageBox.Show(msg); Utils.showMessage(msg, "Thông báo"); } }
public TC_PhieuThu(String mPhieuTCID, String mLoaiPhieu, String mTuNgay, String mDenNgay, MTGlobal.MT_ROLE mActRole, bool isAddNew = false) { InitializeComponent(); this.lblTitle.Content = "LẬP PHIẾU THU"; this.pPhieuTCID = mPhieuTCID; this.pTuNgay = mTuNgay == "" ? DateTime.Now.ToShortDateString() : mTuNgay; this.pDenNgay = mDenNgay == "" ? DateTime.Now.ToShortDateString() : mDenNgay; this.pLoaiPhieu = mLoaiPhieu; this.pACT_ROLE = mActRole; Dlg = Utils.shwWait(); setUserRight(); if (isAddNew) { fdoAdd(); } else { BindData(); MTGlobal.SetGridReadOnly(grdPhieuThuCT, tblView, true); setReadOnly(true); } Utils.closeWait(Dlg); }
private void fdoAdd() { try { int mMM = int.Parse(Convert.ToDateTime(pDenNgay).Month.ToString().PadLeft(2, '0')); int mYY = int.Parse(Convert.ToDateTime(pDenNgay).Year.ToString()); pPhieuTCID = MTGlobal.GetNewID(); txtSoPhieu.Text = MTGlobal.GetSophieu(MTGlobal.MT_KYHIEU_CUAHANG, this.pLoaiPhieu, mMM, mYY, MTGlobal.MT_USER_LOGIN).ToString(); txtNgayCT.Text = DateTime.Now.ToShortDateString(); txtNgayPS.Text = DateTime.Now.ToShortDateString(); BindData(); if (SysPar.SetGridReadOnly(false, gvPhieuThuCT)) { gvPhieuThuCT.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom; //gvPhieuThuCT.DataSource = new modPhieuNX().dtPhieuNXCT(); gvPhieuThuCT.FocusedRowHandle = GridControl.NewItemRowHandle; gvPhieuThuCT.FocusedColumn = gvPhieuThuCT.VisibleColumns[0]; gvPhieuThuCT.ShowEditor(); } setReadOnly(false); MTGlobal.SetToolStripButtonAction(pACT_ROLE, MTButton, "ADD"); txtSoPhieu.Focus(); isEdit = true; } catch (Exception ex) { Utils.showMessage(ex.Message.ToString(), "Thông báo lỗi"); } }
private void btnCreate_Click(object sender, EventArgs e) { SERVER = cbServer.SelectedText.Trim(); DBNAME = txtDB.Text.ToString().Trim(); USERNAME = txtUsername.Text.ToString().Trim(); PASSWORD = txtPassword.Text.ToString().Trim(); if (SERVER.Length == 0) { Utils.showMessage("CSDL không được để trống", "Thông báo"); cbServer.Focus(); return; } if (DBNAME.Length == 0) { Utils.showMessage("Vui lòng nhập tên CSDL cần tạo...", "Thông báo"); txtDB.Focus(); return; } if (FILE_RESTORE.Length == 0) { Utils.showMessage("Vui lòng chọn tập tin khôi phục", "Thông báo"); txtDB.Focus(); return; } if (!Utils.validateFileType(FILE_RESTORE, Utils.BACKUP_SQL_TYPE)) { Utils.showMessage(Utils.ERR_FILE_FORMAT(Utils.BACKUP_SQL_EXTENSION), "Thông báo"); txtDB.Text = ""; return; } string testConnectionStr = string.Format(@"Data Source={0};Persist Security Info=True;User ID={1};Password={2};Max Pool Size=2000", SERVER, USERNAME, PASSWORD); if (!isConnection(testConnectionStr)) { Utils.showMessage("Tài khoản hoặc mật khẩu không đúng. Vui lòng kiểm tra lại", "Thông báo"); isConnect = false; return; } if (Utils.createAndRestoreDB(SERVER, USERNAME, PASSWORD, DBNAME, FILE_RESTORE)) { Utils.showMessage("Tạo CSDL thành công", "Thông báo"); MTGlobal.WriteRegistryKey(MTGlobal.MT_REGKEY_SECTION_SQL, MTGlobal.MT_REGKEY_DBHOST, SERVER); MTGlobal.WriteRegistryKey(MTGlobal.MT_REGKEY_SECTION_SQL, MTGlobal.MT_REGKEY_DBNAME, DBNAME); MTGlobal.WriteRegistryKey(MTGlobal.MT_REGKEY_SECTION_SQL, MTGlobal.MT_REGKEY_DBUSER, USERNAME); MTGlobal.WriteRegistryKey(MTGlobal.MT_REGKEY_SECTION_SQL, MTGlobal.MT_REGKEY_DBPASS, PASSWORD); MTGlobal.MTAPPSTART(); isConnect = true; this.Close(); btnCreate.Visible = true; } else { Utils.showMessage("Không thể tạo CSDL", "Thông báo"); isConnect = false; } }
private void NX_PhieuNhap_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.F2) { fdoAdd(); } else if (e.KeyCode == Keys.F3) { fdoEdit(); } else if (e.KeyCode == Keys.F5) { fdoSave(); } else if (e.KeyCode == Keys.F7) { if (pPhieuNXID == "") { Utils.showMessage("Bạn chưa chọn phiếu để in...", "Lưu ý"); } new MTReport().rptNX_Phieunhap(pPhieuNXID); } else if (e.KeyCode == Keys.F8) { this.Close(); } else if (e.KeyCode == Keys.Escape) { BindData(); setReadOnly(true); MTGlobal.SetToolStripButtonAction(pACT_ROLE, MTButton, "ABORT"); } }
public dlg_ChonInCongno(DataTable oTblKH, String mType = "PTHU") { InitializeComponent(); this.otblChon = oTblKH; this.mIsType = mType; mTuNgay = MTGlobal.MT_TUNGAY; mDenNgay = MTGlobal.MT_DENNGAY; MTGlobal.SetFormatGridControl(grdCN, tblCN); dtpTungay.Text = mTuNgay; dtpDenngay.Text = mDenNgay; mLoaitien = "VND"; if (mType == "PTHU") { lblTitle.Content = "Bảng chi tiết công nợ phải thu"; } else if (mType == "PTHUTH") { lblTitle.Content = "Bảng tổng hợp công nợ phải thu"; } else if (mType == "PTRA") { lblTitle.Content = "Tổng hợp công nợ phải trả"; } else { lblTitle.Content = "Tổng hợp công nợ"; } setDataCombo(); }
private void fdoAdd() { try{ int mMM = int.Parse(Convert.ToDateTime(pDenNgay).Month.ToString().PadLeft(2, '0')); int mYY = int.Parse(Convert.ToDateTime(pDenNgay).Year.ToString()); pPhieuID = MTGlobal.GetNewID(); txtSophieu.Text = MTGlobal.GetSophieu(MTGlobal.MT_KYHIEU_CUAHANG, pLoaiPhieu, mMM, mYY, MTGlobal.MT_USER_LOGIN).ToString(); dtpNgaylap.Text = DateTime.Now.ToShortDateString(); dtpNgayPS.Text = DateTime.Now.ToShortDateString(); BindData(); if (MTGlobal.SetGridReadOnly(grdPhieu, tblView, false)) { tblView.NewItemRowPosition = DevExpress.Xpf.Grid.NewItemRowPosition.Bottom; tblView.FocusedRowHandle = DevExpress.Xpf.Grid.GridControl.NewItemRowHandle; tblView.FocusedColumn = grdPhieu.Columns.First(); tblView.ShowEditor(); } setReadOnly(false); MTGlobal.SetButtonAction(pACT_ROLE, MTButton, "ADD"); txtSophieu.Focus(); isEdit = true; } catch (Exception ex) { Utils.showMessage(ex.Message.ToString(), "Thông báo lỗi"); } }
private void formLoad(object sender, RoutedEventArgs e) { DataTable otblNhomSP = new MTSQLServer().wRead(SQL_NHOMQUYEN, null, false); grdNhomQuyen.ItemsSource = otblNhomSP; MTGlobal.SetGridReadOnly(grdNhomQuyen, tblViewGrp, true); }
private void gvXe_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { try { gvXe.SetRowCellValue(e.RowHandle, colXeid, MTGlobal.GetNewID()); } catch { } }
private void tblView_InitNewRow(object sender, DevExpress.Xpf.Grid.InitNewRowEventArgs e) { try{ grdBangGiaCT.SetCellValue(e.RowHandle, colBanggiactid, MTGlobal.GetNewID()); grdBangGiaCT.SetCellValue(e.RowHandle, colBanggiaid2, mBangGiaId); } catch { } }
private void gvNhomSanPham_InitNewRow(object sender, InitNewRowEventArgs e) { try { gvNhomSanPham.SetRowCellValue(e.RowHandle, colManhomspid, MTGlobal.GetNewID()); } catch { } }
private void tblView_InitNewRow(object sender, DevExpress.Xpf.Grid.InitNewRowEventArgs e) { try{ grdProduct.SetCellValue(e.RowHandle, colSPID, MTGlobal.GetNewID()); grdProduct.SetCellValue(e.RowHandle, colManhomSPID, mNhomspid); } catch { } }
private void tblView_InitNewRow(object sender, DevExpress.Xpf.Grid.InitNewRowEventArgs e) { try { grdKhachHang.SetCellValue(e.RowHandle, colMakhid, MTGlobal.GetNewID()); } catch { } }
private void tblView_InitNewRow(object sender, DevExpress.Xpf.Grid.InitNewRowEventArgs e) { try{ grdPhieu.SetCellValue(e.RowHandle, colChanhxectid, MTGlobal.GetNewID()); grdPhieu.SetCellValue(e.RowHandle, colChanhxeid, pPhieuID); } catch { } }
private void tblView_InitNewRow(object sender, DevExpress.Xpf.Grid.InitNewRowEventArgs e) { try{ grdPhieuNhap.SetCellValue(e.RowHandle, colPhieuNXCTID, MTGlobal.GetNewID()); grdPhieuNhap.SetCellValue(e.RowHandle, colPhieuNXID, pPhieuNXID); } catch { } }
private void BindData(bool isDetailOnly = false) { try{ if (isDetailOnly) { otblCXCT = new MTSQLServer().wRead(String.Format("SELECT A.*,B.Tensp,B.Dvt,B.Quycach FROM NX_CHANHXECT A LEFT JOIN DM_SANPHAM B ON A.Masp=B.Masp WHERE Chanhxeid='{0}' ORDER BY Chanhxectid ASC", pPhieuID), null, false); grdPhieu.ItemsSource = otblCXCT; MTGlobal.SetFormatGridControl(grdPhieu, tblView, false); } else { txtTrongluong.Text = ""; txtChiphi.Text = ""; cbThanhtoan.Text = ""; txtMadv.Text = ""; txtTendonvi.Text = ""; txtDienthoai.Text = ""; txtDiachi.Text = ""; txtSoxe.Text = ""; txtLoaixe.Text = ""; txtTaixe.Text = ""; txtDienthoaiXe.Text = ""; txtGhichu.Text = ""; if (pPhieuID != "") { String mSql = String.Format("SELECT * FROM NX_CHANHXE WHERE Chanhxeid='{0}'", pPhieuID); otblCX = new MTSQLServer().wRead(mSql, null, false); if (otblCX != null) { foreach (DataRow vR in otblCX.Rows) { txtSophieu.Text = vR["Sophieu"].ToString(); dtpNgaylap.EditValue = vR["Ngayct"].ToString() != "" ? Convert.ToDateTime(vR["Ngayct"].ToString()).ToShortDateString() : ""; dtpNgayPS.EditValue = vR["Ngayps"].ToString() != "" ? Convert.ToDateTime(vR["Ngayps"].ToString()).ToShortDateString() : ""; txtTrongluong.Text = vR["Trongluong"].ToString(); txtChiphi.Text = vR["Chiphi"].ToString(); cbThanhtoan.Text = vR["HTThanhtoan"].ToString(); txtMadv.Text = vR["Makh"].ToString(); txtTendonvi.Text = vR["Tenkh"].ToString(); txtDienthoai.Text = vR["Dienthoai"].ToString(); txtDiachi.Text = vR["Diachi"].ToString(); txtSoxe.Text = vR["Soxe"].ToString(); txtLoaixe.Text = vR["Loaixe"].ToString(); txtTaixe.Text = vR["Taixe"].ToString(); txtDienthoaiXe.Text = vR["Dienthoaixe"].ToString(); txtGhichu.Text = vR["Ghichu"].ToString(); } } } otblCXCT = new MTSQLServer().wRead(String.Format("SELECT A.*,B.Tensp,B.Dvt,B.Quycach FROM NX_CHANHXECT A LEFT JOIN DM_SANPHAM B ON A.Masp=B.Masp WHERE Chanhxeid='{0}' ORDER BY Chanhxectid ASC", pPhieuID), null, false); grdPhieu.ItemsSource = otblCXCT; MTGlobal.SetFormatGridControl(grdPhieu, tblView, false); } } catch { } }
private void gvBangGiaCT_InitNewRow(object sender, InitNewRowEventArgs e) { try { gvBangGiaCT.SetRowCellValue(e.RowHandle, colBanggiactid, MTGlobal.GetNewID()); gvBangGiaCT.SetRowCellValue(e.RowHandle, colBanggiaid, bangGiaID); } catch { } }
public dlg_ChonSanPham(DataTable mTblSP) { InitializeComponent(); MTGlobal.SetFormatGridControl(grdChonDM, tblView); grdChonDM.View.NavigationStyle = DevExpress.Xpf.Grid.GridViewNavigationStyle.Row; setDataSource(mTblSP); }
private void gvPhieuXuat_InitNewRow(object sender, InitNewRowEventArgs e) { try { gvPhieuXuat.SetRowCellValue(e.RowHandle, colPhieunxctid, MTGlobal.GetNewID()); gvPhieuXuat.SetRowCellValue(e.RowHandle, colPhieunxid, pPhieuNXID); } catch { } }
private void gvNguoiDung_InitNewRow_1(object sender, InitNewRowEventArgs e) { try { currentUserId = MTGlobal.GetNewID(); gvNguoiDung.SetRowCellValue(e.RowHandle, colsoid, currentUserId); } catch { } }
private void gvPhieu_InitNewRow(object sender, InitNewRowEventArgs e) { try { gvPhieu.SetRowCellValue(e.RowHandle, colChanhxectid, MTGlobal.GetNewID()); gvPhieu.SetRowCellValue(e.RowHandle, colChanhxeid, pPhieuID); } catch { } }
private void gvNguoiDung_KeyDown_1(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { var editObj = ((DevExpress.XtraGrid.Views.Grid.GridView)(sender)).EditingValue; if (gvNguoiDung.FocusedColumn.FieldName == "manv" && gvNguoiDung.FocusedColumn.Name == "colmanv") { if (gvNguoiDung.GetFocusedRowCellValue(colmanv) == null)// || gvPhieuBH.GetFocusedRowCellValue(colMasp).ToString() == "") { gvNguoiDung.FocusedColumn = colmanv; return; } String sManv = editObj != null?editObj.ToString() : ""; if (sManv == null || sManv == "") { gvNguoiDung.FocusedColumn = colmanv; return; } if (sManv != "") { DataRow[] vRow = otblSrcNV.Select(string.Format("Manv='{0}'", sManv)); if (vRow.Length > 0) { String tennv = vRow[0]["Tennv"].ToString(); gvNguoiDung.SetRowCellValue(gvNguoiDung.FocusedRowHandle, colhoten, tennv); } } } else if (gvNguoiDung.FocusedColumn.FieldName == "matkhau" && gvNguoiDung.FocusedColumn.Name == "colmatkhau") { if (gvNguoiDung.GetFocusedRowCellValue(colmatkhau) == null)// || gvPhieuBH.GetFocusedRowCellValue(colMasp).ToString() == "") { gvNguoiDung.FocusedColumn = colmatkhau; return; } String pwd = editObj != null?editObj.ToString() : ""; if (pwd == null || pwd == "") { gvNguoiDung.FocusedColumn = colmatkhau; return; } string md5Pwd = MTGlobal.HashMD5(pwd); gvNguoiDung.SetRowCellValue(gvNguoiDung.FocusedRowHandle, colmatkhau, md5Pwd); } } } catch (Exception ex) { Utils.showMessage("Phát sinh lỗi xử lý[KEYDOWN]=>" + ex.Message.ToString(), "Thông báo lỗi"); } }
private void fdoEdit() { if (SysPar.SetGridReadOnly(false, gvNguoiDung)) { gvNguoiDung.Focus(); gvNguoiDung.FocusedColumn = colmanv; gvNguoiDung.ShowEditor(); MTGlobal.SetToolStripButtonAction(MTROLE, MTButton, "EDIT"); } }
private void fdoAbort() { try { MTSQLServer.getMTSQLServer().Abort(SQLAdaptor, DSetMain.Tables["HT_NHOMQUYEN_CHUCNANG"]); SysPar.SetGridReadOnly(true, gvQuyenHan); MTGlobal.SetToolStripButtonAction(MTROLE, MTButton, "ABORT"); } catch { } }
private void fdoEdit() { if (SysPar.SetGridReadOnly(false, gvQuyenHan)) { gvQuyenHan.Focus(); gvQuyenHan.FocusedColumn = colthem; gvQuyenHan.ShowEditor(); MTGlobal.SetToolStripButtonAction(MTROLE, MTButton, "EDIT"); } }
private void fdoEdit() { if (SysPar.SetGridReadOnly(false, gvNhomSanPham)) { gvNhomSanPham.Focus(); gvNhomSanPham.FocusedColumn = colManhom; gvNhomSanPham.ShowEditor(); MTGlobal.SetToolStripButtonAction(MTROLE, MTButton, "EDIT"); } }