private static void treatBadBloodPatient(object o) { bool sendMail = true; InputData input = o as InputData; if (input.BShowWindowBox) { DialogResult ret = MessageBoxEx.Show(Properties.ResStrings.strAlertBlood, Properties.ResStrings.strAlertDetected, MessageBoxButtons.YesNo, MessageBoxIcon.Stop, 10000); if (ret == DialogResult.No) { sendMail = false; } } if (sendMail) { MainDBClass db = new MainDBClass(); if (db.OpenDB()) { smtpInfo smtp = db.getSmtpInfo(true); alertInfo alert = db.getAlertInfo(AlertType.AT_Bad_Blood_Patient, true); db.CloseDB(); if ((alert != null) && (smtp != null)) { createAndSendMail(alert, smtp, input.Device, input.UTC, input.SpareData); } } } }
private void AlertMngmtForm_FormClosing(object sender, FormClosingEventArgs e) { if (db.isOpen()) { db.CloseDB(); } }
private void toolStripButtonExit_Click(object sender, EventArgs e) { if (_badgeReader != null) { _badgeReader.closePort(); } if (!_bSaved) { MessageBox.Show(ResStrings.str_DATA_NOT_SAVED, ResStrings.strInfo, MessageBoxButtons.OK, MessageBoxIcon.Information); } else //this.BeginInvoke((MethodInvoker)delegate { this.Close(); }); { DeviceInfo[] di = _db.RecoverAllDevice(); if (di != null) { foreach (DeviceInfo dev in di) { if (!string.IsNullOrEmpty(dev.IP_Server)) { if (CheckIpAddr(dev.IP_Server)) { TcpIpClient tcp = new TcpIpClient(); tcp.setUserRefresh(dev.IP_Server, dev.Port_Server); } } } } _myFinger.ReleaseFingerprint(); _db.CloseDB(); Close(); } }
private void UpdateGrid() { _dt.Rows.Clear(); _db = new MainDBClass(); _db.OpenDB(); DeviceInfo[] tmpDevice = _db.RecoverDevice(false); _db.CloseDB(); if (tmpDevice == null) { dataGridViewRemote.DataSource = null; dataGridViewRemote.Refresh(); return; } _networkDevice = new DeviceInfo[tmpDevice.Length]; tmpDevice.CopyTo(_networkDevice, 0); foreach (DeviceInfo di in _networkDevice) { _dt.Rows.Add(di.SerialRFID, di.DeviceName, di.deviceType, di.IP_Server, di.Port_Server); } dataGridViewRemote.DataSource = null; dataGridViewRemote.DataSource = _dt.DefaultView; dataGridViewRemote.Refresh(); }
private void ReaderHistoryForm_FormClosing(object sender, FormClosingEventArgs e) { try { _db.CloseDB(); } catch (Exception exp) { // On affiche l'erreur. ErrorMessage.ExceptionMessageBox.Show(exp); } }
private void tempHistory_FormClosing(object sender, FormClosingEventArgs e) { try { if (_db != null) { _db.CloseDB(); } } catch (Exception exp) { // On affiche l'erreur. ExceptionMessageBox.Show(exp); } }
private void BoxModeCreateUpdate_FormClosing(object sender, FormClosingEventArgs e) { db.CloseDB(); if (_device == null) { return; } if (_device.DeviceStatus == DeviceStatus.DS_NotReady) { _device.StopScan(); } if (_device.ConnectionStatus == ConnectionStatus.CS_Connected) { _device.ReleaseDevice(); } }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { if (dataGridViewRemote.SelectedRows.Count > 0) { // string ip = _networkDevice[dataGridViewRemote.SelectedRows[0].Index].IP_Server; // int _port = _networkDevice[dataGridViewRemote.SelectedRows[0].Index].Port_Server; MainDBClass db = new MainDBClass(); if (db.OpenDB()) { db.DeleteDevice(_networkDevice[dataGridViewRemote.SelectedRows[0].Index]); db.CloseDB(); } } UpdateGrid(); }
public static Image getImage(string LotID) { System.Drawing.Image imgFromDB = Properties.Resources.No_Image_Available; MainDBClass dbTemp = new MainDBClass(); dbTemp.OpenDB(); if (dbTemp.IsImageLinkExist(LotID)) { string imgName = dbTemp.getImageNameLink(LotID); if (imgName != null) { imgFromDB = DataClass.ImageUtils.byteArrayToImage(dbTemp.getImage(imgName)); } } dbTemp.CloseDB(); return(imgFromDB); }
private void AutoFillBox_FormClosing(object sender, FormClosingEventArgs e) { if (_device == null) { return; } if (_device.DeviceStatus != DeviceStatus.DS_Ready) { checkBoxUseRFid.Checked = false; Thread.Sleep(1000); } if (_device.ConnectionStatus == ConnectionStatus.CS_Connected) { _device.ReleaseDevice(); } _db.CloseDB(); }
private static void treatValueRemoved(object o) { InputData input = o as InputData; if (input.BShowWindowBox) { MessageBoxEx.Show(Properties.ResStrings.strAlertValue, Properties.ResStrings.strAlertDetected, MessageBoxButtons.OK, MessageBoxIcon.Stop, 10000); } MainDBClass db = new MainDBClass(); if (db.OpenDB()) { smtpInfo smtp = db.getSmtpInfo(true); alertInfo alert = db.getAlertInfo(AlertType.AT_Limit_Value_Exceed, true); db.CloseDB(); if ((alert != null) && (smtp != null)) { createAndSendMail(alert, smtp, input.Device, input.UTC, input.SpareData); } } }
private DataTable ConvertForExport(DataTable dt) { MainDBClass db = new MainDBClass(); db.OpenDB(); ArrayList columnToExport = db.GetColumnToExport(); dtColumnInfo[] colList = db.GetdtColumnInfo(); db.CloseDB(); if (columnToExport != null) { DataTable dtToexport = dt.Copy(); DataColumnCollection dcc = dt.Columns; for (int loop = 0; loop < dcc.Count; loop++) { if (!columnToExport.Contains(dcc[loop].ColumnName)) { dtToexport.Columns.Remove(dcc[loop].ColumnName); } } return(ConvertColumnType(dtToexport, colList)); } return(ConvertColumnType(dt, colList)); }
private void ImageListForm_FormClosing(object sender, FormClosingEventArgs e) { _db.CloseDB(); }
private void LocalDeviceForm_FormClosing(object sender, FormClosingEventArgs e) { _db.CloseDB(); }
static public void CreateGraphFile(string filePath, string graphTitle, List <PtTemp> points) { MainDBClass db = new MainDBClass(); db.OpenDB(); double tempTreshold = db.GetMaxTempFridgeValue(); db.CloseDB(); _minValueAnnotation = new TextAnnotation(); _maxValueAnnotation = new TextAnnotation(); _averageValueAnnotation = new TextAnnotation(); Chart exportChart = new Chart(); exportChart.Legends.Add(new Legend()); exportChart.Width = 1300; exportChart.Height = 750; if (points.Count == 0) { exportChart.SaveImage(filePath, ChartImageFormat.Png); return; } exportChart.BackColor = Color.WhiteSmoke; exportChart.BackGradientStyle = GradientStyle.None; exportChart.BorderlineColor = Color.FromArgb(64, 0, 64); exportChart.BorderlineDashStyle = ChartDashStyle.Solid; exportChart.BorderlineWidth = 2; exportChart.AntiAliasing = AntiAliasingStyles.All; exportChart.ChartAreas.Add("Main"); exportChart.ChartAreas["Main"].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount; exportChart.ChartAreas["Main"].AxisX.LabelStyle.Angle = -90; exportChart.ChartAreas["Main"].AxisX.LabelStyle.Font = new Font("Verdana", 8.0f, FontStyle.Bold); exportChart.ChartAreas["Main"].AxisY.LabelStyle.Font = new Font("Verdana", 10.0f, FontStyle.Bold); exportChart.ChartAreas["Main"].BackColor = Color.WhiteSmoke; exportChart.ChartAreas["Main"].BackGradientStyle = GradientStyle.VerticalCenter; exportChart.ChartAreas["Main"].BackSecondaryColor = Color.WhiteSmoke; exportChart.ChartAreas["Main"].BorderColor = Color.FromArgb(64, 0, 64); exportChart.ChartAreas["Main"].BorderDashStyle = ChartDashStyle.Solid; exportChart.ChartAreas["Main"].BorderWidth = 2; exportChart.ChartAreas["Main"].ShadowOffset = 3; exportChart.ChartAreas["Main"].ShadowColor = Color.FromArgb(128, 0, 0); exportChart.ChartAreas["Main"].AxisX.TitleForeColor = Color.Blue; exportChart.ChartAreas["Main"].AxisY.TitleForeColor = Color.Blue; exportChart.ChartAreas["Main"].AxisY.Title = "T°"; exportChart.ChartAreas["Main"].AxisY.TextOrientation = TextOrientation.Rotated270; exportChart.ChartAreas["Main"].AxisY.TitleFont = new Font("Verdana", 12.0f, FontStyle.Italic); exportChart.Titles.Add(graphTitle); exportChart.ChartAreas["Main"].AxisX.Title = "Time"; exportChart.ChartAreas["Main"].AxisX.TextOrientation = TextOrientation.Horizontal; exportChart.ChartAreas["Main"].AxisX.TitleFont = new Font("Verdana", 12.0f, FontStyle.Italic); exportChart.ChartAreas["Main"].CursorX.IsUserEnabled = true; exportChart.ChartAreas["Main"].CursorX.IsUserSelectionEnabled = true; exportChart.ChartAreas["Main"].AxisX.ScaleView.Zoomable = true; exportChart.ChartAreas["Main"].CursorX.IntervalType = DateTimeIntervalType.Auto; exportChart.ChartAreas["Main"].CursorX.Interval = 1; exportChart.ChartAreas["Main"].CursorX.AutoScroll = true; exportChart.ChartAreas["Main"].AxisX.ScrollBar.IsPositionedInside = false; exportChart.ChartAreas["Main"].AxisX.IsMarginVisible = false; exportChart.Titles[0].Font = new Font("Verdana", 16.0f, FontStyle.Bold); exportChart.Titles[0].ForeColor = Color.Blue; exportChart.Series.Add("T° Alarm High"); exportChart.Series["T° Alarm High"].ChartType = SeriesChartType.Line; exportChart.Series["T° Alarm High"].YValueType = ChartValueType.Double; exportChart.Series["T° Alarm High"].IsValueShownAsLabel = false; exportChart.Series["T° Alarm High"].ToolTip = "#VALX : #VALY"; exportChart.Series["T° Alarm High"].BackGradientStyle = GradientStyle.VerticalCenter; exportChart.Series["T° Alarm High"].ShadowOffset = 0; exportChart.Series["T° Alarm High"].BackSecondaryColor = Color.White; exportChart.Series["T° Alarm High"].ShadowColor = Color.FromArgb(128, 0, 0); exportChart.Series["T° Alarm High"].Color = Color.Red; exportChart.Series["T° Alarm High"].BorderWidth = 3; exportChart.Series.Add("T° Alarm Low"); exportChart.Series["T° Alarm Low"].ChartType = SeriesChartType.Line; exportChart.Series["T° Alarm Low"].YValueType = ChartValueType.Double; exportChart.Series["T° Alarm Low"].IsValueShownAsLabel = false; exportChart.Series["T° Alarm Low"].ToolTip = "#VALX : #VALY"; exportChart.Series["T° Alarm Low"].BackGradientStyle = GradientStyle.VerticalCenter; exportChart.Series["T° Alarm Low"].ShadowOffset = 0; exportChart.Series["T° Alarm Low"].BackSecondaryColor = Color.White; exportChart.Series["T° Alarm Low"].ShadowColor = Color.FromArgb(128, 0, 0); exportChart.Series["T° Alarm Low"].Color = Color.Red; exportChart.Series["T° Alarm Low"].BorderWidth = 3; exportChart.Series.Add("T° Bottle"); exportChart.Series["T° Bottle"].ChartType = SeriesChartType.Line; exportChart.Series["T° Bottle"].YValueType = ChartValueType.Double; exportChart.Series["T° Bottle"].IsValueShownAsLabel = false; exportChart.Series["T° Bottle"].ToolTip = "#VALX : #VALY"; exportChart.Series["T° Bottle"].BackGradientStyle = GradientStyle.VerticalCenter; exportChart.Series["T° Bottle"].ShadowOffset = 0; exportChart.Series["T° Bottle"].BackSecondaryColor = Color.White; exportChart.Series["T° Bottle"].ShadowColor = Color.FromArgb(128, 0, 0); exportChart.Series["T° Bottle"].Color = Color.DodgerBlue; exportChart.Series["T° Bottle"].BorderWidth = 3; Font ft = new Font("Verdana", 12.0f, FontStyle.Bold); exportChart.Series["T° Bottle"].Font = ft; exportChart.Series.Add("Measure presence"); exportChart.Series["Measure presence"].ChartType = SeriesChartType.Area; exportChart.Series["Measure presence"].YValueType = ChartValueType.Double; exportChart.Series["Measure presence"].IsValueShownAsLabel = false; exportChart.Series["Measure presence"].ToolTip = "Measure found at #VALX"; exportChart.Series["Measure presence"].Color = Color.ForestGreen; exportChart.Series["Measure presence"].BorderWidth = 1; List <double> tempBottlePointsValues = new List <double>(); foreach (PtTemp point in points) { string pointDate = DateTime.Parse(point.TempAcqDate).ToString("dd/MM - HH:mm t"); exportChart.Series["T° Alarm High"].Points.AddXY(pointDate, tempTreshold); exportChart.Series["T° Alarm Low"].Points.AddXY(pointDate, tempTreshold - 5); exportChart.Series["T° Bottle"].Points.AddXY(pointDate, point.TempBottle); exportChart.Series["Measure presence"].Points.AddXY(pointDate, (point.TempBottle != null) ? 1 : (double?)null); if (point.TempBottle == null) { continue; } tempBottlePointsValues.Add(point.TempBottle.Value); } double coeffHeight = 100 / (double)exportChart.Height; double coeffWidth = 100 / (double)exportChart.Width; int rightBorderOffset = -50; _minValueAnnotation.Text = String.Format(ResStrings.str_minValue, tempBottlePointsValues.Min()); SizeF annotationSize = TextRenderer.MeasureText(_minValueAnnotation.Text, _minValueAnnotation.Font); _minValueAnnotation.X = (exportChart.Width - annotationSize.Width + rightBorderOffset) * coeffWidth; _minValueAnnotation.Y = (exportChart.Height / 3.0 - 3 * (annotationSize.Height) + 10) * coeffHeight; _maxValueAnnotation.Text = String.Format(ResStrings.str_maxvalue, tempBottlePointsValues.Max()); annotationSize = TextRenderer.MeasureText(_maxValueAnnotation.Text, _minValueAnnotation.Font); _maxValueAnnotation.X = (exportChart.Width - annotationSize.Width + rightBorderOffset) * coeffWidth; _maxValueAnnotation.Y = (exportChart.Height / 3.0 - 2 * (annotationSize.Height) + 10) * coeffHeight; _averageValueAnnotation.Text = String.Format(ResStrings.str_Average_value, tempBottlePointsValues.Average()); annotationSize = TextRenderer.MeasureText(_averageValueAnnotation.Text, _minValueAnnotation.Font); _averageValueAnnotation.X = (exportChart.Width - annotationSize.Width + rightBorderOffset) * coeffWidth; _averageValueAnnotation.Y = (exportChart.Height / 3.0 - (annotationSize.Height) + 10) * coeffHeight; exportChart.Annotations.Add(_minValueAnnotation); exportChart.Annotations.Add(_maxValueAnnotation); exportChart.Annotations.Add(_averageValueAnnotation); exportChart.SaveImage(filePath, ChartImageFormat.Png); }
private void Formule_FormClosing(object sender, FormClosingEventArgs e) { _db.CloseDB(); }
private void DbColumnForm_FormClosing(object sender, FormClosingEventArgs e) { _db.CloseDB(); }
private void CompareInventoryForm_FormClosing(object sender, FormClosingEventArgs e) { _db.CloseDB(); }
private void toolStripButtonACreateNew_Click(object sender, EventArgs e) { toolStripStatusInfo.Text = ResStrings.str_Status; if (textBoxIPAddress.Text.Contains(".")) { _ip = textBoxIPAddress.Text; } else { _ip = System.Net.Dns.GetHostEntry(textBoxIPAddress.Text).AddressList[0].ToString(); } if (TcpIP_class.tcpUtils.CheckIp(_ip)) { _port = 0; int.TryParse(textBoxPort.Text, out _port); if (TcpIP_class.tcpUtils.PingAddress(_ip, 1000)) { TcpIP_class.TcpIpClient tcp = new TcpIP_class.TcpIpClient(); if (tcp.pingServer(_ip, _port) == TcpIP_class.TcpIpClient.RetCode.RC_Succeed) { _dev[listBoxReader.SelectedIndex].IP_Server = _serverIp; _dev[listBoxReader.SelectedIndex].Port_Server = _serverPort; //if (tcp.enableRemoteAccess(IP, port, dev[listBoxReader.SelectedIndex]) == TcpIP_class.TcpIpClient.RetCode.RC_Succeed) //{ MainDBClass db = new MainDBClass(); if (db.OpenDB()) { _dev[listBoxReader.SelectedIndex].IP_Server = _ip; _dev[listBoxReader.SelectedIndex].Port_Server = _port; if (db.StoreDevice(_dev[listBoxReader.SelectedIndex], true)) { MessageBox.Show(ResStrings.str_DATA_SAVED, ResStrings.strInfo, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(ResStrings.str_Error_while_Saving_Data, ResStrings.strInfo, MessageBoxButtons.OK, MessageBoxIcon.Information); } db.CloseDB(); } // } //else //{ // toolStripStatusInfo.Text = "Status : Error while set Remote On server"; //} } else { toolStripStatusInfo.Text = string.Format(ResStrings.Rstr_Unable_to_connect_to_server__0__on_port__1, _ip, _port); } } else { toolStripStatusInfo.Text = string.Format(ResStrings.str_Unable_to_connect_to_machine__0, _ip); } } else { toolStripStatusInfo.Text = string.Format(ResStrings.str_Status___Enter_a_valid_IP_or_DNS_Not_Resolve_adress__0_, textBoxIPAddress.Text); } UpdateGrid(); }
private void BoxModeConfig_FormClosing(object sender, FormClosingEventArgs e) { db.CloseDB(); }
private void TagUIDWritingForm_FormClosing(object sender, FormClosingEventArgs e) { _db.CloseDB(); }