/// <summary>保存Jew数据 /// </summary> /// <param name="data"></param> /// <param name="IsDelete"></param> public static void SaveJewData(JewDataClass jewData) { string sqlstr = @"insert into JewDataTable(ID,Name,JewClass,Wavelength,Spectrum,AddTime,Creator,Remark,RealSign,UnRealSign)values(@ID,@Name,@JewClass,@Wavelength,@Spectrum,@AddTime,@Creator,@Remark,@RealSign,@UnRealSign)"; SqliteHelper.ExecuteSql(sqlstr, new { ID = jewData.jewId, Name = jewData.jewName, JewClass = jewData.jewClass, Wavelength = ProcessArray.DoubleToStringEncryption(jewData.wavelength), Spectrum = ProcessArray.DoubleToStringEncryption(jewData.spectrum), AddTime = jewData.addTime, Creator = jewData.creator, Remark = jewData.remark, RealSign = ProcessArray.DoubleToString(jewData.realSign.ToArray()), UnRealSign = ProcessArray.DoubleToString(jewData.unRealSign.ToArray()) }); }
public static DataTable sqlFitting(double[] X1, double [] Y1, double minWave, double maxWave) { double[] x1Fixed = ProcessArray.getOneStepArrayDouble(minWave, maxWave); double[] y1Fixed = ProcessArray.FixArrayY(x1Fixed, X1, Y1); List <JewDataClass> sqlDataList = new List <Model.JewDataClass>(); System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); //stopwatch.Start(); //任务 1... string sqlstr = "select * from JewDataTable order by ID asc "; var datalst = SqliteHelper.ExecDataTable(sqlstr); datalst.Columns.Add("FittingResult"); foreach (DataRow dr in datalst.Rows) { double[] wave = ProcessArray.StringToDoubleEncryption((string)dr["wavelength"]); double[] spec = ProcessArray.StringToDoubleEncryption((string)dr["Spectrum"]); dr["FittingResult"] = (100 * fitting(x1Fixed, y1Fixed, wave, spec)).ToString("f2"); dr["wavelength"] = EncryptionHelper.Decrypt(dr["wavelength"].ToString()); dr["Spectrum"] = EncryptionHelper.Decrypt(dr["Spectrum"].ToString()); } //for(int i=7;i>2;i--) //{ // datalst.Columns[i]; //} return(datalst); //ProductSource.DataSource = datalst; //ProductSource.ResetBindings(false); //stopwatch.Stop(); //MessageBox.Show ( "<p>任务 1 用时:" + stopwatch.ElapsedMilliseconds + "。</p>"); }