/// <summary> ///This function will check the compatibility of database version if it is match. /// </summary> /// <returns>return false if the database version is not match.</returns> /// <remarks></remarks> static internal bool DBCompatibilityCheck() { Maintenance m = new Maintenance(); Console.WriteLine("Checking database compatibility..."); string strDB = m.GetValue("DBVersion"); if (DBversion == strDB) { Console.WriteLine("Success!"); return(true); } else { Console.WriteLine("Database Version didn't match... " + strDB); return(false); } }
private void lvMaintenance_DoubleClick(object sender, EventArgs e) { if (lvMaintenance.SelectedItems.Count == 0) { return; } int idx = Convert.ToInt32(lvMaintenance.FocusedItem.Text.ToString()); tmpMaintenance = new Maintenance(); tmpMaintenance.ID = idx; tmpMaintenance.LoadMaintenance(); txtKey.Text = tmpMaintenance.MaintenanceKey; txtValue.Text = tmpMaintenance.MaintenanceValue; txtRemarks.Text = tmpMaintenance.Remarks; txtKey.Enabled = false; btnSaveMaintenance.Text = "&Update"; }
private void btnSaveMaintenance_Click(object sender, EventArgs e) { if (btnSaveMaintenance.Text == "&Update") { tmpMaintenance.MaintenanceValue = txtValue.Text; tmpMaintenance.Remarks = txtRemarks.Text; tmpMaintenance.SaveMaintenance(); } else { if (isValidMaintenance() == false) { return; } tmpMaintenance = new Maintenance(); var with = tmpMaintenance; with.MaintenanceKey = txtKey.Text; with.MaintenanceValue = txtValue.Text; with.Remarks = txtRemarks.Text; with.SaveMaintenance(); } MessageBox.Show("Data Save"); LoadMaintenance(); }
private void btnOrder_Click(object sender, EventArgs e) { QueOrder = new Queue(); Maintenance tmpMain = new Maintenance(); string tmpOrderNum = tmpMain.GetValue("ORDERNUM"); var with = QueOrder; with.OrderNum = tmpOrderNum; //Queue Number from table Maintenance with.OrderDate = DateTime.Now; //with.Status = true; with.SaveQueue(); foreach (ListViewItem lv in lvOrderList.Items) { QueueLines tmpLines = new QueueLines(); tmpLines.QueueID = QueOrder.GetLastID(); tmpLines.MenuID = Convert.ToInt32(lv.Tag); tmpLines.QTY = Convert.ToDouble(lv.SubItems[4].Text.ToString()); tmpLines.Price = Convert.ToDouble(lv.SubItems[3].Text.ToString()); tmpLines.Status = true; tmpLines.SaveInfo(); } MessageBox.Show("Order Post", "Information"); int tmpNum = Convert.ToInt32(tmpOrderNum) + 1; string finalNum = Convert.ToString(tmpNum); tmpMain.UpdateOption("ORDERNUM", finalNum); lvDisplay.Items.Clear(); lvOrderList.Items.Clear(); string optPrint = tmpMain.GetValue("ORDERPRINT"); if (optPrint == "YES") { Reporting AutoPrint = new Reporting(); string printerName = tmpMain.GetValue("PrinterOrder"); if (canPrint(printerName) == false) { return; } LocalReport report = new LocalReport(); String dsName = "dsOrderPrint"; string mysql = "Select OrderNum From tblQueue Where ID = '" + QueOrder.GetLastID() + "'"; DataSet ds = Database.LoadSQL(mysql, "tblQueue"); report.ReportPath = @"Report\rpt_OrderPrint.rdlc"; report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(dsName, ds.Tables[0])); Dictionary <string, string> addParameters = new Dictionary <string, string>(); if ((addParameters != null)) { foreach (KeyValuePair <string, string> nPara_loopVariable in addParameters) { var nPara = nPara_loopVariable; ReportParameter tmpPara = new ReportParameter(); tmpPara.Name = nPara.Key; tmpPara.Values.Add(nPara.Value); report.SetParameters(new ReportParameter[] { tmpPara }); } } Dictionary <string, double> paperSize = new Dictionary <string, double>(); paperSize.Add("width", 3.5); paperSize.Add("height", 2.5); try { AutoPrint.Export(report, paperSize); AutoPrint.m_currentPageIndex = 0; AutoPrint.Print(printerName); } catch (Exception ex) { MessageBox.Show(ex.Message, "PRINT FAILED"); } } }