private void btnOk_Click(object sender, EventArgs e) { try { #region Khai báo Model và gán giá trị EventsLogErrorModel mELE = new EventsLogErrorModel(); mELE.MessageCode = MessageCode; mELE.ComputerName = TextUtils.GetHostName(); mELE.ErrorDate = TextUtils.GetSystemDate(); mELE.EventName = EventName; mELE.FormName = FormName; mELE.ErrorContent = SystemMessage; EventsLogErrorBO.Instance.Insert(mELE); #endregion } catch { return; } finally { this.Close(); } }
public frmMain() { if (Application.StartupPath.Contains("Share")) { frmCloseForm frm = new frmCloseForm(); frm.ShowDialog(); } string strPath = Application.StartupPath + @"\LastLog.ini"; Global.DefaultFileName = "default.ini"; Global.ComputerName = TextUtils.GetHostName(); //"NVTHAO" #region Check Update try { if (Global.ComputerName != "NVTHAO" && Global.ComputerName != "MrGrey" && Global.ComputerName != "DELL-NVTHAO" && Global.ComputerName != "AMD-TPA") { string pathServer = TextUtils.GetPathServer(); string fileNumberLocal = Application.StartupPath + "\\UpdateNumber.ini"; string fileNumberServer = pathServer + "\\UpdateNumber.ini"; if (!File.Exists(fileNumberLocal)) { _isUpdated = true; } else { string valueLocal = File.ReadAllText(fileNumberLocal); string valueServer = File.ReadAllText(fileNumberServer); if (valueLocal != valueServer) { _isUpdated = true; } } } } catch { _isUpdated = false; } #endregion check update if (!_isUpdated)// && ConnectdToBD) { frmLogin frm = new frmLogin(); frm.ShowDialog(); //_loginOK = frm.loginSuccess; if (frm.loginSuccess == false) { Application.Exit(); return; } } InitializeComponent(); }
public frmMain() { Global.ComputerName = TextUtils.GetHostName(); DocUtils.InitFTPQLSX(); //Check update version updateVersion(); if (!_isUpdated) // && ConnectdToBD) { frmLogin frm = new frmLogin(); frm.ShowDialog(); //_loginOK = frm.loginSuccess; if (frm.loginSuccess == false) { Application.Exit(); return; } else { InitializeComponent(); } } }
private void PrintReportToolStripButton_Click(object sender, EventArgs e) { /* Chọn máy in trong danh sách */ if (mode == 1) { PrintDialog PrintDialog1 = new PrintDialog(); DialogResult result = PrintDialog1.ShowDialog(); if (result == DialogResult.OK) { rpt.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName; rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter; rpt.PrintToPrinter(1, true, 1, 99); //; crystalReportViewer1.ViewCount); string sql = "Insert Into PrintVAT(DateTime, FolioNo, RoomNo, GuestName, CompanyName, TaxCode, Address,AmountBeforeTax, VAT5, VAT10, AmountAfterTax, FullName,UserName, ComputerName, PrinterName,Status) Values " + " ('" + TextUtils.GetSystemDate().ToString("MM/dd/yyy hh:mm:ss tt") + "', " + Convert.ToInt32(FormulaFieldsValue[5]) + " ,'" + FormulaFieldsValue[0] + "',N'" + FormulaFieldsValue[6] + "', " + " N'" + (FormulaFieldsValue[7]) + "', N'" + (FormulaFieldsValue[8]) + "',N'" + (FormulaFieldsValue[9]) + "', " + " '" + ((FormulaFieldsValue[18])) + "', '" + ((FormulaFieldsValue[20])) + "', '" + ((FormulaFieldsValue[21])) + "','" + ((FormulaFieldsValue[22])) + "', " + " N'" + Global.AppFullName + "',N'" + Global.AppUserName + "','" + TextUtils.GetHostName() + "','" + PrintDialog1.PrinterSettings.PrinterName + "',1)"; TextUtils.ExcuteSQL(sql); TextUtils.ExcuteSQL("Update Folio Set IsPrintVAT =1 Where ID = " + Convert.ToInt32(FormulaFieldsValue[5])); //ActionPosting.InsertHistory(TextUtils.GetSystemDate(), TextUtils.GetBusinessDate(), TextUtils.ToInt(FormulaFieldsValue[5]), TextUtils.ToInt(FormulaFieldsValue[5]), FormulaFieldsValue[5], ActionPosting.HistoryType.Print, // ActionPosting.GetActionText(ActionPosting.HistoryType.Print, "", "Print VAT Invoice "), // Global.UserName, "", "Print VAT Invoice", TextUtils.ToDecimal((FormulaFieldsValue[22])), TextUtils.GetHostName() + PrintDialog1.PrinterSettings.PrinterName, "", "", ""); } } else { #region Khong hoi may in ////rpt.PrintOptions.PrinterName = GetDefaultPrinter(); ////rpt.PrintToPrinter(1, true, 1, 99); //; crystalReportViewer1.ViewCount); #endregion PrintDialog PrintDialog1 = new PrintDialog(); DialogResult result = PrintDialog1.ShowDialog(); if (result == DialogResult.OK) { rpt.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName; rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4; rpt.PrintToPrinter(1, true, 1, 99); //ActionPosting.InsertHistory(Convert.ToDateTime(TextUtils.GetSystemDate()), Convert.ToDateTime(TextUtils.GetBusinessDate()), TextUtils.ToInt(FormulaFieldsValue[6]), TextUtils.ToInt(FormulaFieldsValue[6]), "", ActionPosting.HistoryType.Print, // ActionPosting.GetActionText(ActionPosting.HistoryType.Print, "", "Print Folio "), // Global.UserName, "", "PrintFolio", TextUtils.ToDecimal((FormulaFieldsValue[19])), TextUtils.GetHostName(), "", "", ""); } } }