private void UserControl_ViewDB_VisibleChanged(object sender, EventArgs e) { FileInfo existFunctionFileCheck = new FileInfo(this.jsonFunctionSettingFilePath); if (existFunctionFileCheck.Exists == true) { using (FileStream fs = new FileStream(this.jsonFunctionSettingFilePath, FileMode.Open)) { using (BinaryReader br = new BinaryReader(fs)) { string jsonDeSerializedData = br.ReadString(); this.function = JsonConvert.DeserializeObject <FunctionSetting>(jsonDeSerializedData); br.Close(); } fs.Close(); } } if (this.function.DATABASE == false) { dateTimePicker_StartTime.Enabled = true; dateTimePicker_EndTime.Enabled = true; button_Search.Enabled = true; InitializeDatabaseConfig(); } else { dateTimePicker_StartTime.Enabled = false; dateTimePicker_EndTime.Enabled = false; button_Search.Enabled = false; } }
private void InitializeControlAddedEvent() { FileInfo existFunctionFileCheck = new FileInfo(this.jsonFunctionSettingFilePath); if (existFunctionFileCheck.Exists == true) { using (FileStream fs = new FileStream(this.jsonFunctionSettingFilePath, FileMode.Open)) { using (BinaryReader br = new BinaryReader(fs)) { string jsonDeSerializedData = br.ReadString(); this.function = JsonConvert.DeserializeObject <FunctionSetting>(jsonDeSerializedData); br.Close(); } fs.Close(); } } if (function.INSPECTION_INFO != false) { button_Save.Enabled = false; textBox_FactoryName.Enabled = false; textBox_FactoryName.Text = ""; textBox_LineNum.Enabled = false; textBox_LineNum.Text = "0"; textBox_WorkerName.Enabled = false; textBox_WorkerName.Text = ""; return; } else { button_Save.Enabled = true; textBox_FactoryName.Enabled = true; textBox_LineNum.Enabled = true; textBox_WorkerName.Enabled = true; } FileInfo existCheck = new FileInfo(this.jsonFilePath); if (existCheck.Exists == true) { using (FileStream fs = new FileStream(this.jsonFilePath, FileMode.Open)) { using (BinaryReader br = new BinaryReader(fs)) { string jsonDeSerializedData = br.ReadString(); this.trInfo = JsonConvert.DeserializeObject <BarcodeTestResultInfo>(jsonDeSerializedData); br.Close(); } fs.Close(); } textBox_FactoryName.Text = trInfo.Factory_Name; textBox_LineNum.Text = trInfo.Line_Num.ToString(); textBox_WorkerName.Text = trInfo.Worker_Name; } }
private void UserControl_Master_VisibleChanged(object sender, EventArgs e) { FileInfo existFunctionFileCheck = new FileInfo(this.jsonFunctionSettingFilePath); if (existFunctionFileCheck.Exists == true) { using (FileStream fs = new FileStream(this.jsonFunctionSettingFilePath, FileMode.Open)) { using (BinaryReader br = new BinaryReader(fs)) { string jsonDeSerializedData = br.ReadString(); this.function = JsonConvert.DeserializeObject <FunctionSetting>(jsonDeSerializedData); br.Close(); } fs.Close(); } } }
private void UserControl_SettingFunction_Load(object sender, EventArgs e) { FileInfo existFunctionFileCheck = new FileInfo(this.jsonFunctionSettingFilePath); if (existFunctionFileCheck.Exists == true) { using (FileStream fs = new FileStream(this.jsonFunctionSettingFilePath, FileMode.Open)) { using (BinaryReader br = new BinaryReader(fs)) { string jsonDeSerializedData = br.ReadString(); this.function = JsonConvert.DeserializeObject <FunctionSetting>(jsonDeSerializedData); br.Close(); } fs.Close(); } this.checkBox_BoxCode_LotCode.Checked = this.function.BOX_LOT_CODE; this.checkBox_Inspection_Info.Checked = this.function.INSPECTION_INFO; this.checkBox_CountSetting.Checked = this.function.COUNT_SETUP; this.checkBox_DatabaseQuery.Checked = this.function.DATABASE; } }
private void InitializeControlAddedEvent() { FileInfo existFunctionFileCheck = new FileInfo(this.jsonFunctionSettingFilePath); if (existFunctionFileCheck.Exists == true) { using (FileStream fs = new FileStream(this.jsonFunctionSettingFilePath, FileMode.Open)) { using (BinaryReader br = new BinaryReader(fs)) { string jsonDeSerializedData = br.ReadString(); this.function = JsonConvert.DeserializeObject <FunctionSetting>(jsonDeSerializedData); br.Close(); } fs.Close(); } } FileInfo existCheck = new FileInfo(this.jsonFilePath); if (existCheck.Exists == true) { using (FileStream fs = new FileStream(this.jsonFilePath, FileMode.Open)) { using (BinaryReader br = new BinaryReader(fs)) { string jsondeSerializedData = br.ReadString(); this.testResultInfo = JsonConvert.DeserializeObject <BarcodeTestResultInfo>(jsondeSerializedData); br.Close(); } fs.Close(); } if (this.testResultInfo.Factory_Name == "" || this.testResultInfo.Worker_Name == "") { this.testResultInfo.Factory_Name = "None"; this.testResultInfo.Worker_Name = "None"; this.testResultInfo.Line_Num = 0; } } else { this.testResultInfo.Factory_Name = "None"; this.testResultInfo.Worker_Name = "None"; this.testResultInfo.Line_Num = 0; } using (conn = new SQLiteConnection(connStr)) { conn.Open(); code_CRUD = new BarcodeReferenceCode_CRUD(conn); master_ds = code_CRUD.SelectAll_Dataset(BarcodeReferenceCode_CRUD.Table.MASTER_CODE); middle_ds = code_CRUD.SelectAll_Dataset(BarcodeReferenceCode_CRUD.Table.BOX_CODE); carton_ds = code_CRUD.SelectAll_Dataset(BarcodeReferenceCode_CRUD.Table.LOT_CODE); } cbbMaster.DataSource = master_ds.Tables["MasterCodeTable"]; cbbMaster.DisplayMember = "MasterCode"; try { if (function.BOX_LOT_CODE == false) { cbbMaster.Enabled = true; cbbMaster.SelectedIndex = _masterIndex; chbOnlyMaster.Checked = false; } else { if (chbOnlyMaster.Checked) { cbbMaster.Enabled = true; cbbMaster.SelectedIndex = _masterIndex; } else { cbbMaster.Enabled = false; cbbMaster.Text = ""; } } } catch { } cbbMiddle.DataSource = middle_ds.Tables["BoxCodeTable"]; cbbMiddle.DisplayMember = "BoxCode"; try { if (function.BOX_LOT_CODE == false) { cbbMiddle.Enabled = true; cbbMiddle.SelectedIndex = _middleIndex; chbSelectMiddle.Checked = false; } else { if (chbSelectMiddle.Checked) { cbbMiddle.Enabled = true; cbbMiddle.SelectedIndex = _middleIndex; } else { cbbMiddle.Enabled = false; cbbMiddle.Text = ""; } } } catch { } cbbCarton.DataSource = carton_ds.Tables["LotCodeTable"]; cbbCarton.DisplayMember = "LotCode"; try { if (function.BOX_LOT_CODE == false) { cbbCarton.Enabled = true; cbbCarton.SelectedIndex = _cartonIndex; chbSelectCarton.Checked = false; } else { if (chbSelectCarton.Checked) { cbbCarton.Enabled = true; cbbCarton.SelectedIndex = _middleIndex; } else { cbbCarton.Enabled = false; cbbCarton.Text = ""; } } } catch { } if (function.BOX_LOT_CODE == false) { chbSerial.Checked = false; } else { chbSerial.Checked = true; } }