public FillingLineData() { DataTable defaultFillingLineData = ADODatabase.GetDataTable("SELECT FillingLineData.ProductID, ListProductName.ProductCode, ListProductName.ProductCodeOriginal, ListProductName.NoItemPerCarton, FillingLineData.BatchNo, FillingLineData.SettingDate, FillingLineData.SettingMonthID, FillingLineData.BatchSerialNumber, FillingLineData.MonthSerialNumber, FillingLineData.BatchCartonNumber, FillingLineData.MonthCartonNumber FROM FillingLineData INNER JOIN ListProductName ON FillingLineData.ProductID = ListProductName.ProductID WHERE FillingLineData.FillingLineID = " + (int)this.FillingLineID + " AND FillingLineData.IsDefault = 1"); if (defaultFillingLineData.Rows.Count > 0) { this.StartTracking(); this.ProductID = int.Parse(defaultFillingLineData.Rows[0]["ProductID"].ToString()); this.ProductCode = defaultFillingLineData.Rows[0]["ProductCode"].ToString(); this.ProductCodeOriginal = defaultFillingLineData.Rows[0]["ProductCodeOriginal"].ToString(); GlobalVariables.noItemPerCartonSetByProductID = int.Parse(defaultFillingLineData.Rows[0]["NoItemPerCarton"].ToString()); int noItem = 0; GlobalVariables.noItemPerCartonSetByProductID = int.TryParse(GlobalRegistry.Read("NoItemPerCartonSetByProductID"), out noItem) ? noItem : 0; this.BatchNo = defaultFillingLineData.Rows[0]["BatchNo"].ToString(); this.SettingDate = DateTime.Parse(defaultFillingLineData.Rows[0]["SettingDate"].ToString()); this.SettingMonthID = int.Parse(defaultFillingLineData.Rows[0]["SettingMonthID"].ToString()); this.BatchSerialNumber = defaultFillingLineData.Rows[0]["BatchSerialNumber"].ToString(); this.MonthSerialNumber = defaultFillingLineData.Rows[0]["MonthSerialNumber"].ToString(); this.BatchCartonNumber = defaultFillingLineData.Rows[0]["BatchCartonNumber"].ToString(); this.MonthCartonNumber = defaultFillingLineData.Rows[0]["MonthCartonNumber"].ToString(); this.StartTracking(); } }
public FillterOption() { try { this.FillingLineID = 0; this.LowerFillterDate = DateTime.Today.AddDays(-1); this.UpperFillterDate = DateTime.Today.AddDays(365); string savedDownLoadInterval = GlobalRegistry.Read("DownLoadInterval"); this.DownLoadInterval = savedDownLoadInterval == null ? "8:00" : savedDownLoadInterval; string savedUpLoadInterval = GlobalRegistry.Read("UpLoadInterval"); int lastUpLoadInterval; if (int.TryParse(savedUpLoadInterval, out lastUpLoadInterval)) { this.UpLoadInterval = lastUpLoadInterval; } else { this.UpLoadInterval = 60; } } catch (Exception exception) { throw exception; } }
private void PublicGetServerName_Load(object sender, EventArgs e) { try { this.textBoxServerName.Text = GlobalRegistry.Read("ServerName"); this.textBoxDatabaseName.Text = GlobalRegistry.Read("DatabaseName"); } catch (Exception ex) { GlobalExceptionHandler.ShowExceptionMessageBox(this, ex); } }
private void PublicApplicationLogon_Load(object sender, EventArgs e) { try { this.comboBoxImageS8PortName.DataSource = System.IO.Ports.SerialPort.GetPortNames(); this.comboBoxAutonicsPortName.DataSource = System.IO.Ports.SerialPort.GetPortNames(); if (this.comboBoxImageS8PortName.Items.Count == 0) { this.comboBoxImageS8PortName.DataSource = null; this.comboBoxImageS8PortName.Items.Add("COM 0"); this.comboBoxAutonicsPortName.DataSource = null; this.comboBoxAutonicsPortName.Items.Add("COM 0"); } DataTable dataTablePublicPrinterProperties = SQLDatabase.GetDataTable("SELECT TOP 1 * FROM PublicPrinterProperties"); if (dataTablePublicPrinterProperties.Rows.Count > 0) { this.comboBoxImageS8PortName.Text = (string)dataTablePublicPrinterProperties.Rows[0]["ImageS8PortName"]; this.comboBoxAutonicsPortName.Text = (string)dataTablePublicPrinterProperties.Rows[0]["AutonicsPortName"]; } string stringEmployeeID = GlobalRegistry.Read("EmployeeID"); int employeeID = -1; if (stringEmployeeID == null || stringEmployeeID.Length <= "string".Length || !int.TryParse(stringEmployeeID.Substring("string".Length), out employeeID)) { employeeID = 1; } this.EmployeeID = employeeID; this.buttonListEmployee.Visible = this.EmployeeID == 1; this.commonMetaList = new CommonMetaList(); ListMaintenance.ListEmployeeDataTable listEmployeeDataTable = this.commonMetaList.GetListEmployee(); this.comboBoxEmployeeID.DataSource = listEmployeeDataTable; this.comboBoxEmployeeID.DisplayMember = listEmployeeDataTable.DescriptionColumn.ColumnName; this.comboBoxEmployeeID.ValueMember = listEmployeeDataTable.EmployeeIDColumn.ColumnName; this.employeeIDBinding = this.comboBoxEmployeeID.DataBindings.Add("SelectedValue", this, "EmployeeID", true, DataSourceUpdateMode.OnPropertyChanged); this.employeeIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); } catch (Exception exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, exception); } }
static void Main() { bool isLoginOK = false; ////KHONG LOAD DATABASE //GlobalVariables.LocationID = 1; //isLoginOK = true; try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GlobalRegistry.ShowError = true; //GlobalMsADO.ServerName = "SERVER\\SQLEXPRESS"; GlobalMsADO.ServerName = GlobalRegistry.Read("ServerName"); GlobalMsADO.DatabaseName = GlobalRegistry.Read("DatabaseName"); //GlobalMsADO.ServerName = "WH\\SQLEXPRESS"; //GlobalMsADO.DatabaseName = "E:\\20.02.2013\\Database\\BPFillingSystem.mdf"; //GlobalMsADO.ServerName = "HOME-PC\\SQLEXPRESS"; //GlobalMsADO.DatabaseName = "BPFillingSystem"; //GlobalMsADO.ServerName = "SONY-VIO\\SQLEXPRESS"; //GlobalMsADO.DatabaseName = "ImageS8SongThan"; GlobalMsADO.ServerName = "192.168.1.18"; while (!isLoginOK && GlobalVariables.LocationID >= -1)//Try to open startup database, Exit if user cancel to input ServerName and DatabaseName { //MessageBox.Show (GlobalStaticFunction.TextToASCII("AB")); //MessageBox.Show(GlobalStaticFunction.TextToHEX("AB")); ////byte[] a = GlobalStaticFunction.XORBytes(GlobalStaticFunction.StringToByteArrayFastest("01"), GlobalStaticFunction.StringToByteArrayFastest("02")); //////////string hex = BitConverter.ToString(data); //////////string hex = BitConverter.ToString(data).Replace("-", string.Empty); ; ////string hex = BitConverter.ToString(a); ////MessageBox.Show (hex); //////////1111111111---------MessageBox.Show(GlobalStaticFunction.TextToHEX("BOURG LES VALENCE" )); ////////////byte[] a = GlobalStaticFunction.CheckSumHEXString("0A,00,13,01,0A,02,38,49,4D,41,4A,45,20,02,54,46,52,41,4E,43,45,0D"); ////////////byte[] a = GlobalStaticFunction.CheckSumHEXString("0A,00,2A,01,0A,02,38,49,4D,41,4A,45,20,01,53,42,4F,55,52,47,20,4C,45,53,20,56,41,4C,45,4E,43,45,0A,02,54,46,52,41,4E,43,45,1E,1E,1E,0D"); //////////1111111111---------byte[] a = GlobalStaticFunction.CheckSumHEXString("0A,00,2A,01,0A,02,38,49,4D,41,4A,45,20,1C,01,53,42,4F,55,52,47,20,4C,45,53,20,56,41,4C,45,4E,43,45,0A,02,54,46,52,41,4E,43,45,1E,1E,1E,0D"); //////////1111111111---------MessageBox.Show(BitConverter.ToString(a)); if (GlobalMsADO.ServerName == null || GlobalMsADO.DatabaseName == null || GlobalMsADO.ServerName == "" || GlobalMsADO.DatabaseName == "")//Show Get Server Name Dialog { PublicGetServerName publicGetServerName = new PublicGetServerName(); if (publicGetServerName.ShowDialog() != DialogResult.OK) { GlobalVariables.LocationID = -2; } if (publicGetServerName.DialogResult == DialogResult.OK) { publicGetServerName.Dispose(); } } if (GlobalVariables.LocationID >= -1)//Do not execute if user cancel to input ServerName and DatabaseName { try { if (GlobalMsADO.MainDataAccessConnection(true).State == ConnectionState.Open)//Try to open new connection { isLoginOK = true; GlobalVariables.LocationID = 1; } else { GlobalMsADO.ServerName = ""; GlobalMsADO.DatabaseName = ""; } } catch { GlobalMsADO.ServerName = ""; GlobalMsADO.DatabaseName = ""; } } } if (GlobalVariables.LocationID > 0) { GlobalVariables.IgnoreEmptyCarton = GlobalRegistry.Read("IgnoreEmptyCarton") == "0" ? false : true; PublicApplicationLogon publicApplicationLogon = new PublicApplicationLogon(); if (publicApplicationLogon.ShowDialog() == DialogResult.OK) { Application.Run(new frmMDIMain()); } publicApplicationLogon.Dispose(); } } catch (Exception ex) { GlobalExceptionHandler.ShowExceptionMessageBox(new Form(), ex); } finally { Console.WriteLine("Executing finally block."); } }