private void btnNhapHang_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...", "Đang thêm phiếu nhập kho mới "); frmWailt.LookAndFeel.SetSkinStyle("Seven Classic"); try { frmWailt.Show(); if (busDatHang.UpdateTinhTrangDatHang(mode, lsDatHang[sttDH - 1].MaHoaDon, "Đã Giao") == 1) { frmWailt.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Thêm phiếu nhập kho thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { frmWailt.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Thêm phiếu nhập khothất bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { frmWailt.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnDongY_Click(object sender, EventArgs e) { if (txtTenNguyenLieu.Text.Trim().Length == 0) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập Tên Nguyên Liệu !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtTenNguyenLieu.Focus(); } else if (txtDonVi.Text.Trim().Length == 0) { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa nhập đơn vị nguyên liêu!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtDonVi.Focus(); } else { _nguyenlieu.TenNL = txtTenNguyenLieu.Text.Trim(); _nguyenlieu.DonVi = txtDonVi.Text.Trim(); DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...", "Đang thêm nguyên liệu mới "); frmWailt.LookAndFeel.SetSkinStyle("Seven Classic"); frmWailt.Show(); if (busNguyenLieu.InsertNguyenLieu(mode, NguyenLieu) == 1) { frmWailt.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Thêm dử liệu thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { frmWailt.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Thêm dử liệu thất bại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
void refreshData() { DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү."); try { dlg.Show(); command = new SqlCommand(); command.Connection = frmMain.conn; if (para != null) { command.CommandText = "SELECT * FROM TBLAUTHOR WHERE " + para[1] + " ORDER BY CREATED DESC"; } else { command.CommandText = "SELECT * FROM TBLAUTHOR ORDER BY CREATED DESC"; } command.CommandType = CommandType.Text; SqlDataReader dr = command.ExecuteReader(); mainTable.Clear(); mainTable.Load(dr); frmMain.dataTableColumnNameToUpper(mainTable); gridControl1.DataSource = mainTable; command.Dispose(); dlg.Close(); } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } }
void refreshData() { DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү."); try { dlg.Show(); command = new SqlCommand(); command.Connection = frmMain.conn; command.CommandText = "SELECT TBLUSER.USERID, TBLUSER.ISACTIVE, TBLSTUDENT.LASTNAME, TBLSTUDENT.FIRSTNAME, TBLSTUDENT.CODE, TBLSTUDENT.MOBILEPHONE, TBLSTUDENT.EMAIL, Addr1 +' '+ Addr2 ADDRESS FROM TBLUSER LEFT JOIN TBLSTUDENT ON TBLSTUDENT.STUDENTID = TBLUSER.STUDENTID ORDER BY TBLUSER.CREATED"; command.CommandType = CommandType.Text; SqlDataReader dr = command.ExecuteReader(); mainTable.Clear(); mainTable.Load(dr); frmMain.dataTableColumnNameToUpper(mainTable); gridControl1.DataSource = mainTable; command.Dispose(); dlg.Close(); } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } }
void refreshData() { DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү."); try { dlg.Show(); mainTableDTLGrid = new DataTable(); adapterDTLGrid = new SqlDataAdapter("SELECT * FROM TBLBOOKREMAINDER ORDER BY CREATED DESC", frmMain.conn); builderDTLGrid = new SqlCommandBuilder(adapterDTLGrid); adapterDTLGrid.Fill(mainTableDTLGrid); frmMain.dataTableColumnNameToUpper(mainTableDTLGrid); mainTableDTLGridView = new DataTable(); adapterDTLGridView = new SqlDataAdapter("SELECT TBLBOOKREMAINDER.*, TBLBOOK.NAME, TBLBOOK.CODE FROM TBLBOOKREMAINDER LEFT JOIN TBLBOOK ON TBLBOOK.BOOKID = TBLBOOKREMAINDER.BOOKID ORDER BY TBLBOOKREMAINDER.CREATED", frmMain.conn); adapterDTLGridView.Fill(mainTableDTLGridView); frmMain.dataTableColumnNameToUpper(mainTableDTLGridView); gridControl1.DataSource = mainTableDTLGridView; barSave.Enabled = false; barCancel.Enabled = false; barRefresh.Enabled = true; dlg.Close(); } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } }
public void ExecuteScript( ) { if (ScriptTabControl.SelectedTabPage == null) { return; } Scintilla rtbScript = (Scintilla)ScriptTabControl.SelectedTabPage.Controls[0]; String stQuery = rtbScript.Selection.Text.Trim(); if (String.IsNullOrEmpty(stQuery)) { stQuery = rtbScript.Text; } if (String.IsNullOrEmpty(stQuery)) { return; } Cursor.Current = Cursors.WaitCursor; DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm(); waiting.SetCaption("Executing . . .!"); waiting.Show(); DataSet ds = DataQueryProvider.RunQuery(stQuery); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1) { ResultRichText.Text = ds.Tables[0].Rows[0][0].ToString(); } waiting.Close(); Cursor.Current = Cursors.Default; }
static void Main( ) { DevExpress.Skins.SkinManager.EnableFormSkins(); DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged(); DevExpress.Skins.SkinManager.EnableMdiFormSkins(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm(); waiting.SetCaption("Connecting . . .!"); waiting.Text = ""; waiting.Show(); if (DataQueryProvider.Connect() == false) { waiting.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Please check connection", "Auto generator", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataQueryProvider.InitDataTables(); Form1 form = new Form1(); waiting.Close(); Application.Run(form); }
public void XoaNhaCungCap() { if (DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có chắc là xóa nhà cung cấp này không", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //try //{ DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm(); frmWailt.Caption = " Đang cập nhật dữ liệu ! "; frmWailt.Show(); int result = busNhaCungCap.DeleteNhaCungCap(mode, lsNCC[indexNCC].MaNCC); frmWailt.Close(); if (result == 1) { LoadNhaCungCap(); DevExpress.XtraEditors.XtraMessageBox.Show("Đã xóa nhà cung cấp", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (result == -1) { DevExpress.XtraEditors.XtraMessageBox.Show("Không thể xóa nhà cung cấp này \n Ghi chú :không thể xóa nhà cung cấp khi thông tin nhà cung cấp được sử dụng trong đơn đặt hàng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DevExpress.XtraEditors.XtraMessageBox.Show("Xóa nhà cung cấp thất bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } //} //catch (Exception) //{ // DevExpress.XtraEditors.XtraMessageBox.Show("Xóa nhà cung cấp thất bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //} } }
void refreshData() { DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү."); try { dlg.Show(); string whereStr = " WHERE TBLBOOKORDER.REASON <> 0"; if (txtStudentID.Tag != null) { whereStr += " AND TBLBOOKORDER.STUDENTID = '" + Convert.ToString(txtStudentID.Tag) + "'"; } if (txtBookID.Tag != null) { whereStr += " AND TBLBOOKORDER.BOOKID = '" + Convert.ToString(txtBookID.Tag) + "'"; } try { command = new SqlCommand(); command.Connection = frmMain.conn; command.CommandText = @"SELECT TBLBOOKORDER.*, TBLSTUDENT.CODE STUDENTCODE, TBLSTUDENT.FIRSTNAME STUDENTNAME, TBLSTUDENT.LASTNAME, TBLSTUDENT.REGNO, TBLSTUDENT.GENDER, TBLBOOK.CODE BOOKCODE, TBLBOOK.NAME BOOKNAME FROM TBLBOOKORDER LEFT JOIN TBLSTUDENT ON TBLBOOKORDER.STUDENTID = TBLSTUDENT.STUDENTID LEFT JOIN TBLBOOK ON TBLBOOK.BOOKID = TBLBOOKORDER.BOOKID" + whereStr; command.CommandType = CommandType.Text; SqlDataReader dr = command.ExecuteReader(); mainTable.Clear(); mainTable.Load(dr); frmMain.dataTableColumnNameToUpper(mainTable); gridControl1.DataSource = mainTable; command.Dispose(); dlg.Close(); } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } }
void refreshData() { DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү."); try { dlg.Show(); string studentID = string.Empty; if (txtStudentID.Tag != null) { studentID = "WHERE TBLBOOKORDER.STUDENTID = '" + Convert.ToString(txtStudentID.Tag) + "'"; } mainTableDTLGrid = new DataTable(); adapterDTLGrid = new SqlDataAdapter("SELECT * FROM TBLBOOKORDER " + (string.IsNullOrEmpty(studentID) ? " WHERE STATUS = '0' " : studentID + " AND STATUS = '0' ") + " ORDER BY CREATED DESC", frmMain.conn); builderDTLGrid = new SqlCommandBuilder(adapterDTLGrid); adapterDTLGrid.Fill(mainTableDTLGrid); frmMain.dataTableColumnNameToUpper(mainTableDTLGrid); mainTableDTLGridView = new DataTable(); adapterDTLGridView = new SqlDataAdapter(@"SELECT TBLBOOKORDER.*, TBLSTUDENT.FIRSTNAME STUDENTNAME, TBLSTUDENT.CODE STUDENTCODE, TBLSTUDENT.LASTNAME, TBLSTUDENT.REGNO, TBLSTUDENT.GENDER, TBLBOOK.NAME BOOKNAME, TBLBOOK.CODE BOOKCODE, TBLBOOKREMAINDER.REMAINDER, TBLBOOKREMAINDER.FIRSTRETURNDATE FROM TBLBOOKORDER LEFT JOIN TBLSTUDENT ON TBLSTUDENT.STUDENTID = TBLBOOKORDER.STUDENTID LEFT JOIN TBLBOOK ON TBLBOOK.BOOKID = TBLBOOKORDER.BOOKID LEFT JOIN TBLBOOKREMAINDER ON TBLBOOKREMAINDER.BOOKID = TBLBOOK.BOOKID " + (string.IsNullOrEmpty(studentID) ? " WHERE TBLBOOKORDER.STATUS = '0' " : studentID + " AND TBLBOOKORDER.STATUS = '0' ") + @" ORDER BY TBLBOOKORDER.CREATED", frmMain.conn); adapterDTLGridView.Fill(mainTableDTLGridView); frmMain.dataTableColumnNameToUpper(mainTableDTLGridView); gridControl1.DataSource = mainTableDTLGridView; barSave.Enabled = false; barCancel.Enabled = false; barRefresh.Enabled = true; dlg.Close(); } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } }
public void showWaiting(String msg) { try { if (Dlg != null) { Dlg.Close(); Dlg = null; } Dlg = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ, hệ thống đang xử lý...", "PHẦN MỀM QUẢN LÝ KHO"); Dlg.Show(); } catch (Exception ex) { } }
private void btnReGenPass_Click(object sender, EventArgs e) { if (txtUserName.EditValue == null) { DevExpress.XtraEditors.XtraMessageBox.Show("<Нэвтрэх нэр> талбарт утга оруулах шаардлагатай!"); return; } try { string userid = Convert.ToString(txtUserName.EditValue); string your_id = ConfigurationSettings.AppSettings["SystemEmail"]; string your_password = ConfigurationSettings.AppSettings["SystemEmailPassword"]; DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Имэйл илгээж байна....", "Түр хүлээнэ үү."); dlg.Show(); SmtpClient client = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, Credentials = new System.Net.NetworkCredential(your_id, your_password), Timeout = 10000, }; string[] retMessage = getLoginPassword(userid); if (retMessage[0] == "Бүртгэлгүй хэрэглэгч байна.") { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Бүртгэлгүй хэрэглэгч байна."); client.Dispose(); return; } if (txtUserName.Text.Equals("Administrator")) { retMessage[1] = ConfigurationSettings.AppSettings["AdminEmail"]; } MailMessage mm = new MailMessage(your_id, retMessage[1], "УБТЗ номын сангийн хэрэглэгчийн нууц үг", "Хэрэглэгч: " + userid + '\n' + "Нууц үг: " + retMessage[0]); mm.BodyEncoding = UTF8Encoding.UTF8; client.Send(mm); dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(retMessage[1] + " имэйл рүү амжилттай илгээлээ."); client.Dispose(); } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.ToString()); } }
public void LoadDuLieu() { DataSet temp = new DataSet(); DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...", "Đang Load Dử liệu "); frmWailt.LookAndFeel.SetSkinStyle("Seven Classic"); frmWailt.Show(); temp = busNguyenLieu.SelectNguyenLieu_NCC(mode, dtoNCC.MaNCC, maNH); frmWailt.Close(); dtNguyenLieuChon_Source = temp.Tables[0]; DtNguyenLieu = temp.Tables[1]; Load_lvNguyenLieuChon(); Load_lvNguyenLieu(); }
public static void Show(String strTitle, String strCaption) { Close(); if (string.IsNullOrWhiteSpace(strTitle)) { strTitle = "Đang xử lý, vui lòng chờ..."; } waiting = new DevExpress.Utils.WaitDialogForm(strCaption, strTitle); Cursor.Current = Cursors.WaitCursor; SetCaption(strCaption); waiting.Show(); }
private static void ptStartProcess() { Thread.Sleep(400); if (stop) { return; } dlgWaitWind.Show(); try { while (!stop) { Application.DoEvents(); Thread.Sleep(10); } } catch { } }
private void btnSave_Click(object sender, EventArgs e) { DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm(); waiting.SetCaption("Saving . . .!"); waiting.Text = ""; waiting.Show(); Cursor.Current = Cursors.WaitCursor; STTableConfigController aliasCtrl = new STTableConfigController(); foreach (DataRow dr in ((DataTable)this.gridControl1.DataSource).Rows) { STTableConfigInfo aliasInfo = (STTableConfigInfo)aliasCtrl.GetObjectFromDataRow(dr); if (aliasInfo != null) { aliasCtrl.UpdateObject(aliasInfo); } } ABCDataLib.Tables.ConfigProvider.InvalidateConfigList(); InvalidateData(); Cursor.Current = Cursors.Default; waiting.Close(); }
public void CapNhatNhaCungCap() { frmNhaCungCap_Them_CapNhat _frm = new frmNhaCungCap_Them_CapNhat(); _frm.Flag = 2; _frm.MaNH = maNH; _frm.DtoNCC = lsNCC[indexNCC]; _frm.Mode = mode; if (_frm.ShowDialog() == DialogResult.OK) { DataTable dtNguyenLieu = _frm.DtNguyenLieuChon; VNhaCungCap_DTO dtoNCC = _frm.DtoNCC; DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("", " Đang Cập Nhật Thông Tin Nhà Cung Cấp "); frmWailt.LookAndFeel.SetSkinStyle("Seven Classic"); try { frmWailt.Show(); int result = busNhaCungCap.UpdatetNhaCungCap(mode, _frm.DtoNCC, _frm.DtChiTietNCC); if (result == 0) { DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp không thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { frmWailt.Close(); LoadNhaCungCap(); LoadNguyenLieu(lsNCC[sttNCC - 1].MaNCC); DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception) { frmWailt.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp không thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
void refreshData() { DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("Ачаалж байна...", "Түр хүлээнэ үү."); try { dlg.Show(); string whereStr = " WHERE TBLBOOKORDER.LATEDAY > 0"; if (txtStudentID.Tag != null) { whereStr += " AND TBLBOOKORDER.STUDENTID = '" + Convert.ToString(txtStudentID.Tag) + "'"; } if (txtBookID.Tag != null) { whereStr += " AND TBLBOOKORDER.BOOKID = '" + Convert.ToString(txtBookID.Tag) + "'"; } if (Convert.ToString(txtIsReturned.EditValue).Equals("Y")) { whereStr += " AND TBLBOOKORDER.RETURNEDDATE IS NOT NULL"; } else if (Convert.ToString(txtIsReturned.EditValue).Equals("N")) { whereStr += " AND TBLBOOKORDER.RETURNEDDATE IS NULL"; } try { command = new SqlCommand(); command.Connection = frmMain.conn; command.CommandText = @"SELECT TBLBOOKORDER.*, TBLSTUDENT.CODE STUDENTCODE, TBLSTUDENT.FIRSTNAME STUDENTNAME, TBLSTUDENT.LASTNAME, TBLSTUDENT.REGNO, TBLSTUDENT.GENDER, TBLBOOK.CODE BOOKCODE, TBLBOOK.NAME BOOKNAME FROM (SELECT CASE WHEN DATEDIFF(dd, TBLBOOKORDER.RETURNDATE, ISNULL(TBLBOOKORDER.RETURNEDDATE, getdate())) <= 0 THEN 0 ELSE FLOOR(DATEDIFF(dd, TBLBOOKORDER.RETURNDATE, ISNULL(TBLBOOKORDER.RETURNEDDATE, getdate()))) END LATEDAY, TBLBOOKORDER.* FROM TBLBOOKORDER) TBLBOOKORDER LEFT JOIN TBLSTUDENT ON TBLBOOKORDER.STUDENTID = TBLSTUDENT.STUDENTID LEFT JOIN TBLBOOK ON TBLBOOK.BOOKID = TBLBOOKORDER.BOOKID" + whereStr; command.CommandType = CommandType.Text; SqlDataReader dr = command.ExecuteReader(); mainTable.Clear(); mainTable.Load(dr); frmMain.dataTableColumnNameToUpper(mainTable); gridControl1.DataSource = mainTable; command.Dispose(); dlg.Close(); } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } } catch (Exception ex) { dlg.Close(); DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Đang nạp dữ liệu...", "QUẢN LÝ KHO HÀNG"); Dlg.Show(); try { String userName = txtUserName.Text.ToUpper().Trim(); string pass = txtPassWord.Password; lblMSG.Visibility = Visibility.Hidden; lblLoading.Visibility = Visibility.Visible; Mouse.OverrideCursor = Cursors.Wait; txtUserName.IsEnabled = false; txtPassWord.IsEnabled = false; btnLogin.IsEnabled = false; string mLoginRs = new modMember().fValidMember(userName, pass); if (mLoginRs == "T") { MTGlobal.SetConfigKey("MT_ACCOUNT", userName); if (chkRemember.IsChecked == true) { MTGlobal.SetConfigKey("MT_PASSWORD", txtPassWord.Password.ToString()); MTGlobal.SetConfigKey("MT_REMEMBER", "1"); } else { MTGlobal.SetConfigKey("MT_PASSWORD", ""); MTGlobal.SetConfigKey("MT_REMEMBER", "0"); } if (bw.IsBusy == false) { bw.RunWorkerAsync(); } Thread vThread = new Thread(() => { try{ MTSynData.doSyncCheckActive(); MTGlobal.onSetPara(); } catch { } }); vThread.Start(); } else { lblLoading.Visibility = Visibility.Hidden; lblMSG.Visibility = Visibility.Visible; lblMSG.Content = mLoginRs; txtUserName.IsEnabled = true; txtUserName.BorderBrush = Brushes.Red; txtPassWord.IsEnabled = true; txtPassWord.BorderBrush = Brushes.Red; btnLogin.IsEnabled = true; Mouse.OverrideCursor = null; if (Pos_Expend) { txtUserName.Focus(); txtUserName.SelectAll(); } else { txtPassWord.Focus(); txtPassWord.SelectAll(); } } } catch (Exception ex) {} if (Dlg != null) { Dlg.Close(); } }
/// <summary> /// 数据表格打印预览 /// </summary> /// <param name="ListGrid">数据表格</param> /// <param name="strHead">表头显示信息</param> public static void PrintView(DevExpress.XtraGrid.GridControl ListGrid,DevExpress.XtraGrid.Views.Grid.GridView gridView, string strHead) { Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; //"Report file creating","Read Data, Please waiting..." DevExpress.Utils.WaitDialogForm frmWait = new DevExpress.Utils.WaitDialogForm("正在获取数据,请稍候...", "表格报表"); frmWait.Show(); //以下以前的一种用法,现在改为可加上表头信息的印方式 //if (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable) // DevExpress.XtraPrinting.PrintHelper.ShowPreview(ListGrid); //else // //"XtraPrinting Library is not found..." // DevExpress.XtraEditors.XtraMessageBox.Show(common.GetLanguageWord("MESSAGE", "M0028"), "", MessageBoxButtons.OK, MessageBoxIcon.Information); //以下为采用新的打印方式 string middleColumn = strHead; string rightColumn = string.Format("打印时间:{0:g}", DateTime.Now); PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.Clear(); phf.Header.Font = new Font("宋体", 12, FontStyle.Bold); phf.Header.Content.AddRange(new string[] { "打印用户:" + Common._personname, middleColumn, rightColumn }); phf.Footer.Content.AddRange(new string[] { "", "页次[页 #/#]", "" }); gridView.OptionsPrint.AutoWidth = false; //<- 2012-09-18 add link.Component = ListGrid; //link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); DevExpress.LookAndFeel.UserLookAndFeel lookfeel = new DevExpress.LookAndFeel.UserLookAndFeel(ListGrid); lookfeel.ParentLookAndFeel = ListGrid.LookAndFeel; PrintingSystem printSystem = new PrintingSystem(); PrinterSettingsUsing pst = new PrinterSettingsUsing(); pst.UseMargins = true; pst.UsePaperKind = true; printSystem.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4; printSystem.PageSettings.PaperName = "A4"; printSystem.PageSettings.LeftMargin = 1; printSystem.PageSettings.RightMargin = 1; printSystem.PageSettings.Landscape = true; printSystem.PageSettings.AssignDefaultPrinterSettings(pst); link.PaperKind = printSystem.PageSettings.PaperKind; link.Margins = printSystem.PageSettings.Margins; link.Landscape = printSystem.PageSettings.Landscape; link.CreateDocument(); link.ShowPreview(lookfeel); Cursor.Current = currentCursor; frmWait.Dispose(); frmWait = null; }
public void LoadDuLieu() { DataSet temp = new DataSet(); DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm("...","Đang Load Dử liệu "); frmWailt.LookAndFeel.SetSkinStyle("Seven Classic"); frmWailt.Show(); temp = busNguyenLieu.SelectNguyenLieu_NCC(mode, dtoNCC.MaNCC, maNH); frmWailt.Close(); dtNguyenLieuChon_Source = temp.Tables[0]; DtNguyenLieu = temp.Tables[1]; Load_lvNguyenLieuChon(); Load_lvNguyenLieu(); }
public void CapNhatNhaCungCap() { frmNhaCungCap_Them_CapNhat _frm = new frmNhaCungCap_Them_CapNhat(); _frm.Flag = 2; _frm.MaNH = maNH; _frm.DtoNCC = lsNCC[indexNCC]; _frm.Mode = mode; if (_frm.ShowDialog() == DialogResult.OK) { DataTable dtNguyenLieu = _frm.DtNguyenLieuChon; VNhaCungCap_DTO dtoNCC = _frm.DtoNCC; DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm(""," Đang Cập Nhật Thông Tin Nhà Cung Cấp "); frmWailt.LookAndFeel.SetSkinStyle("Seven Classic"); try { frmWailt.Show(); int result = busNhaCungCap.UpdatetNhaCungCap(mode, _frm.DtoNCC, _frm.DtChiTietNCC); if (result == 0) { DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp không thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { frmWailt.Close(); LoadNhaCungCap(); LoadNguyenLieu(lsNCC[sttNCC - 1].MaNCC); DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception) { frmWailt.Close(); DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật nhà cung cấp không thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public void XoaNhaCungCap() { if (DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có chắc là xóa nhà cung cấp này không", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //try //{ DevExpress.Utils.WaitDialogForm frmWailt = new DevExpress.Utils.WaitDialogForm(); frmWailt.Caption = " Đang cập nhật dữ liệu ! "; frmWailt.Show(); int result = busNhaCungCap.DeleteNhaCungCap(mode, lsNCC[indexNCC].MaNCC); frmWailt.Close(); if (result == 1) { LoadNhaCungCap(); DevExpress.XtraEditors.XtraMessageBox.Show("Đã xóa nhà cung cấp", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (result == -1) DevExpress.XtraEditors.XtraMessageBox.Show("Không thể xóa nhà cung cấp này \n Ghi chú :không thể xóa nhà cung cấp khi thông tin nhà cung cấp được sử dụng trong đơn đặt hàng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); else DevExpress.XtraEditors.XtraMessageBox.Show("Xóa nhà cung cấp thất bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //} //catch (Exception) //{ // DevExpress.XtraEditors.XtraMessageBox.Show("Xóa nhà cung cấp thất bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //} } }
private void cmdConnect_Click(object sender, RoutedEventArgs e) { //SERVER = ((MTPMSWIN.View.HT_TaoKetNoi.ServerSQL)(cbcServer.SelectedItem)).name; DBNAME = txtDB.Text.ToString().Trim(); USERNAME = txtUsername.Text.ToString().Trim(); PASSWORD = txtPassword.Text.ToString().Trim(); if (SERVER.Length == 0) { Utils.showMessage("Bạn chưa chọn Máy chủ..", "Thông báo"); cbcServer.Focus(); return; } if (DBNAME.Length == 0) { Utils.showMessage("CSDL không được để trống", "Thông báo"); txtDB.Focus(); return; } if (USERNAME.Length == 0) { Utils.showMessage("Tài khoản không được bỏ trống", "Thông báo"); txtUsername.Focus(); return; } if (PASSWORD.Length == 0) { Utils.showMessage("Mật khẩu không được bỏ trống", "Thông báo"); txtPassword.Focus(); return; } try { DevExpress.Utils.WaitDialogForm Dlg2 = null; DevExpress.Utils.WaitDialogForm Dlg = new DevExpress.Utils.WaitDialogForm("Đang thiết lập kết nối đến máy chủ...", "KẾT NỐI MÁY CHỦ"); Dlg.Show(); string testConnectionStr = string.Format(@"Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3};Max Pool Size=2000", SERVER, DBNAME, USERNAME, PASSWORD); if (isConnection(testConnectionStr)) { 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); if (MTGlobal.MTAPPSTART() == true) { Dlg.Close(); isConnect = true; Utils.showMessage("Tạo kết nối thành công", "Thông báo"); this.Close(); } else { Dlg.Close(); isConnect = false; Utils.showMessage("Không thể tạo kết nối. Vui lòng kiểm tra lại...", "Thông báo"); } Dlg.Close(); return; } else { Dlg.Close(); Dlg2 = new DevExpress.Utils.WaitDialogForm("Đang kiểm tra tài khoản máy chủ...", "KẾT NỐI MÁY CHỦ"); Dlg2.Show(); string testConnectionStr2 = string.Format(@"Data Source={0};Persist Security Info=True;User ID={1};Password={2};Max Pool Size=2000", SERVER, USERNAME, PASSWORD); if (!isConnection(testConnectionStr2)) { Dlg2.Close(); Utils.showMessage("Tài khoản hoặc mật khẩu Máy chủ không đúng. Vui lòng kiểm tra lại", "Thông báo"); isConnect = false; return; } Dlg2.Close(); } Dlg.Close(); Dlg2.Close(); } catch { } }
private void btnConfirm_Click(object sender, EventArgs e) { var loaiHoSo = (DTO.LoaiHoSoDTO) this.cbLoaiHoSo.SelectedItem; var nguoiTiepNhan = (DTO.NhanVienDTO) this.cbNguoiTiepNhan.SelectedItem; var phongKham = (DTO.PhongKhamDTO) this.cbPhong.SelectedItem; if (this.patient == null) { return; } var hoso = new DTO.HoSoBenhAnDTO() { MaBenhNhan = this.patient.MaBenhNhan, MaHoSoTruoc = this.cbMaHoSoTruoc.Text, MaLoaiHoSo = loaiHoSo != null ? loaiHoSo.MaLoaiHoSo : "", MaNguoiTN = nguoiTiepNhan != null ? nguoiTiepNhan.MaNV : "", NgayTiepNhan = DateTime.Now.ToString("yyyyMMdd"), YeuCauKham = this.txtYeuCauKham.Text, MaPhongKham = phongKham != null ? phongKham.MaPhong : "" }; var thanhToan = new DTO.ThanhToanDTO() { ChiPhiKham = ClinicManagement.Common.SourceLibrary.PhiKhamTiepNhan }; this.bus.confirmReception(hoso, thanhToan, (stt, result) => { if (result.Equals(COM.Constant.RES_SUC)) { DevExpress.Utils.WaitDialogForm f = new DevExpress.Utils.WaitDialogForm(); f.Show(); Report.FormSoThuTu soThuTuForm = new Report.FormSoThuTu() { AutoSize = true, StartPosition = FormStartPosition.CenterParent, DataReport = new Report.DataReportSoThuTu() { MaHoSo = hoso.MaHoSo, TenBenhNhan = patient.HoTen, DiaChi = patient.DiaChi, NgayKham = DateTime.Now.ToString("dd/MM/yyyy"), SoThuTu = hoso.SoThuTu.ToString(), TenPhong = phongKham?.TenPhong } }; soThuTuForm.FormClosed += (obj, er) => { this.refreshEvent?.Invoke(this, null); if (this.Parent is Form) { var formParent = (Form)this.Parent; formParent.Close(); } }; f.Close(); soThuTuForm.ShowDialog(); } }); }