public int UpdateSpectrum(string wafer, TEST_TYPE type, TEST_AREA area, double[] wl, double[] spect, double[] wl50mA, double[] spect50mA) { int retVal = 0; try { using (MySqlConnection connect = new MySqlConnection(connectionString)) { connect.Open(); string query = "epi_update_spectrum"; MySqlCommand cmd = new MySqlCommand(query, connect); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Prepare(); cmd.Parameters.AddWithValue("@wafer", wafer); cmd.Parameters.AddWithValue("@test", (int)type); cmd.Parameters.AddWithValue("@area", (int)area); var wlout = JsonConvert.SerializeObject(wl); cmd.Parameters.AddWithValue("@wl", wlout); var spectout = JsonConvert.SerializeObject(spect); cmd.Parameters.AddWithValue("@spect", spectout); var wlout50 = JsonConvert.SerializeObject(wl50mA); cmd.Parameters.AddWithValue("@wl50mA", wlout50); var spectout50 = JsonConvert.SerializeObject(spect50mA); cmd.Parameters.AddWithValue("@spect50mA", spectout50); cmd.ExecuteNonQuery(); } return(retVal); }catch (MySqlException ex) { return(-1); } }
}//End GetWaferSpectrum private IEnumerable <Spectrum> ExtractSpectrum(DataTable dt) { List <Spectrum> spectList = new List <Spectrum>(); double[] wl = new double[Spectrum.ARRAY_SIZE]; double[] inten = new double[Spectrum.ARRAY_SIZE]; int count = 0; foreach (DataRow row in dt.Rows) { foreach (DataColumn col in dt.Columns) { TEST_AREA area = col.ColumnName.GetTestArea(); if (!DBNull.Value.Equals(row[col])) { if (col.ColumnName.Contains("WL")) { wl = JsonConvert.DeserializeObject <double[]>((string)row[col]); } else { inten = JsonConvert.DeserializeObject <double[]>((string)row[col]); } } else { if (col.ColumnName.Contains("WL")) { wl = new double[Spectrum.ARRAY_SIZE]; } else { inten = new double[Spectrum.ARRAY_SIZE]; } } count += 1; if (count % 2 == 1) { int cur = col.ColumnName.Contains("50mA") == false ? 20 : 50; try { spectList.Add(new Spectrum(area, cur, wl, inten)); } catch (ArgumentNullException e) { } } } } //End transpose/convert return(spectList); } //End Extract Spectrums
public string LogData50mA(string wafer, TEST_TYPE type, TEST_AREA area, double wl, double power, double voltage, double knee, double reverse) { try { using (MySqlConnection connect = new MySqlConnection(connectionString)) { connect.Open(); string query = "epi_update_50ma"; MySqlCommand cmd = new MySqlCommand(query, connect); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Prepare(); cmd.Parameters.AddWithValue("@wafer", wafer); cmd.Parameters.AddWithValue("@test", (int)type); cmd.Parameters.AddWithValue("@area", (int)area); cmd.Parameters.AddWithValue("@wl", wl); cmd.Parameters.AddWithValue("@power", power); cmd.Parameters.AddWithValue("@voltage", voltage); cmd.Parameters.AddWithValue("@knee", knee); cmd.Parameters.AddWithValue("@reverse", reverse); cmd.ExecuteNonQuery(); } return("success"); } catch (MySqlException ex) { return(ex.ToString()); } }
public static string GetAreaString(this TEST_AREA area) { DescriptionAttribute[] attributes = (DescriptionAttribute[])area.GetType().GetField(area.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }