public long Insert(ReadRecord model) { using (var con = WriteConnection()) { return(con.ExecuteScalar <long>("INSERT INTO ReadRecords(Type, AccountId, TargetId) VALUES(@Type, @AccountId, @TargetId); SELECT SCOPE_IDENTITY()", model)); } }
private void RecognizeBank() { var threeColumnString = string.Join(",", header.Take(3)); switch (threeColumnString) { // Swedbank LT case "Data,Gavėjas,Gavėjo sąskaita": _readRecord = new ReadRecord(SwedbankLtReadRecord); break; // Luminor EN case "Date,Time,Amount": _readRecord = new ReadRecord(LuminorEnReadRecord); break; // Luminor LT case "Data,Laikas,Suma": _readRecord = new ReadRecord(LuminorLtReadRecord); break; // Seb EN case "INSTRUCTION ID,DATE,CURRENCY": _readRecord = new ReadRecord(SebEnReadRecord); break; // Seb LT case "DOK NR.,DATA,VALIUTA": _readRecord = new ReadRecord(SebLtReadRecord); break; } }
public bool Exists(ReadRecord model) { using (var con = ReadConnection()) { return(con.ExecuteScalar <int>("SELECT * FROM ReadRecords WHERE Type = @Type AND AccountId = @AccountId AND TargetId = @TargetId", model) > 0); } }
public CardHandler(ICard cardOwner) { this.card = cardOwner as IISO7816Card; context = new CardContext(); context.CurFile = card.MasterFile; commandMap[0x0044] = new ActivateFile(); commandMap[0x00e2] = new AppendRecord(); commandMap[0x9024] = new ChangeKeyData(); commandMap[0x0024] = new ChangeReferenceData(); commandMap[0x00e0] = new CreateFile(); commandMap[0x0004] = new DeactivateFile(); commandMap[0x0082] = new ExternalAuthenticate(); commandMap[0x0046] = new GenerateKeyPair(); commandMap[0x0084] = new GetChallenge(); commandMap[0x8086] = new GiveRandom(); commandMap[0x0022] = new ManageSecurityEnvironment(); commandMap[0x002a] = new PerformSecurityOperation(); commandMap[0x00da] = new PutData(); commandMap[0x00b0] = new ReadBinary(); commandMap[0x00b2] = new ReadRecord(); commandMap[0x002c] = new ResetRetryCounter(); commandMap[0x00a4] = new Select(); commandMap[0x00d6] = new UpdateBinary(); commandMap[0x00dc] = new UpdateRecord(); commandMap[0x0020] = new Verify(); foreach (var v in commandMap.Values) { v.Card = card; v.Handler = this; } }
public BsonValue InsertReadRecord(ReadRecord record) { using (var db = this.GetLiteDatabase()) { var collection = db.GetCollection <ReadRecord>("readrecord"); return(collection.Insert(record)); } }
public vReadRecord(ReadRecord model) { this.ID = model.ID; this.EBookID = model.EBookID; this.EBook = model.EBook; this.UserID = model.UserID; this.User = model.User; this.Time = Helpers.Time.ToTimeTip(model.Time); }
//Background worker to monitor all sensor valuess and switch states on the still and keep global variables and the UI updated //The idea here is to imtermittently check all variables and write to a local variable in memory to minimize commands sent to the arduino //This is also convienent as it minimizes the amount of long of code required to message the arduino in the control loop public static BackgroundWorker InitializeSystemMonitor(Dispatcher MainDispatcher) { SystemMonitor = new BackgroundWorker(); SystemMonitor.WorkerSupportsCancellation = true; SystemMonitor.DoWork += new DoWorkEventHandler((state, args) => { do { if (Main.CurrentState.Run != true) { break; } Thread.Sleep(1000); bool success = false; while (success == false) { try { DI2008Data = DI2008.Functions.ReadData(); while (!DI2008Data.Analog0.HasValue) { Thread.Sleep(100); } MainDispatcher.Invoke(new Action(() => { Main.CurrentState.ColumnTemp = Math.Round(DI2008Data.Analog0.Value.Value, 2); //Main.CurrentState.ColumnTemp = Math.Round((DI2008Data.Analog0.Value.Value / (10M / 1000M)), 2); Main.CurrentState.StillFluidTemp = Math.Round(DI2008Data.Analog1.Value.Value, 2); Main.CurrentState.RefluxTemp = Math.Round(DI2008Data.Analog2.Value.Value, 2); Main.CurrentState.Pressure = Math.Round(((DI2008Data.Analog4.Value.Value / (5M / 306816.7M)) / 1000), 2); //Converts to Pascals and Divides by 1000 for Kilo Pascals -- 306816.7 is 44.5PSI converted Pascals which is the range measurable by the transducer //Main.CurrentState.Pressure = Math.Round((DI2008Data.Analog1.Value.Value / (10M / 306816.7M)) / 1000, 2); Main.CurrentState.SystemAmperage = DI2008Data.Analog5.Value.Value; Main.CurrentState.StillFull = DI2008Data.Digital0.Value == DigtitalState.High ? true : false; Main.CurrentState.StillEmpty = DI2008Data.Digital1.Value == DigtitalState.Low ? true : false; Main.CurrentState.RVEmpty = DI2008Data.Digital2.Value == DigtitalState.Low ? true : false; Main.CurrentState.RVFull = DI2008Data.Digital3.Value == DigtitalState.Low ? true : false; })); success = true; } catch { } } if (Main.CurrentState.Phase == -1) { Main.CurrentState.Phase = 0; } } while (true); }); return(SystemMonitor); }
public void OnekeyRead(Guid AccountId) { var list = new ArticleDAC().AllList(ArticleAccountType.FiiiPay, AccountId); list.ForEach(data => { var model = new ReadRecord { AccountId = AccountId, TargetId = data.Id, Type = (ReadRecordType)(int)data.Type }; new ReadRecordDAC().Insert(model); }); }
public void Read(string TargetId, Guid AccountId, ReadRecordType Type) { var model = new ReadRecord { AccountId = AccountId, TargetId = TargetId, Type = Type }; if (new ReadRecordDAC().Exists(model)) { return; } new ReadRecordDAC().Insert(model); }
//Background worker to monitor all sensor valuess and switch states on the still and keep global variables and the UI updated //The idea here is to imtermittently check all variables and write to a local variable in memory to minimize commands sent to the arduino //This is also convienent as it minimizes the amount of long of code required to message the arduino in the control loop public static BackgroundWorker InitializeSystemMonitor(Dispatcher MainDispatcher) { SystemMonitor = new BackgroundWorker(); SystemMonitor.WorkerSupportsCancellation = true; SystemMonitor.DoWork += new DoWorkEventHandler((state, args) => { do { if (StillController.CurrentState.Run != true) { break; } Thread.Sleep(1000); bool success = false; while (success == false) { try { DI2008Data = DI2008.Functions.ReadData(); while (!DI2008Data.Analog0.HasValue) { Thread.Sleep(100); } decimal PressureVoltage = DI2008Data.Analog4.Value.Value; decimal CalibrationCorrection = (-55.3M * PressureVoltage) + 118M; //Determined via getting voltage at max vacuum and atmospheric pressure then plugging the Voltage / Actual values into this link https://www.symbolab.com/solver/slope-intercept-form-calculator/slope%20intercept%20%28-1%2C1%29%2C%28-2%2C-3%29?or=ex decimal PresureInKPa = PressureVoltage / (CalibrationCorrection / 1000); MainDispatcher.Invoke(new Action(() => { StillController.CurrentState.ColumnTemp = Math.Round(DI2008Data.Analog0.Value.Value, 2); //StillController.CurrentState.ColumnTemp = Math.Round((DI2008Data.Analog0.Value.Value / (10 / 1000M)), 2); StillController.CurrentState.StillFluidTemp = Math.Round(DI2008Data.Analog1.Value.Value, 2); StillController.CurrentState.RefluxTemp = Math.Round(DI2008Data.Analog2.Value.Value, 2); StillController.CurrentState.Pressure = Math.Round(PresureInKPa, 2); //StillController.CurrentState.Pressure = Math.Round(((DI2008Data.Analog1.Value.Value / (10 / 306816.7M)) / 1000), 2); //Converts to Pascals and Divides by 1000 for Kilo Pascals -- 306816.7 is 44.5PSI converted Pascals which is the range measurable by the transducer StillController.CurrentState.SystemAmperage = DI2008Data.Analog5.Value.Value; StillController.CurrentState.StillFull = DI2008Data.Digital0.Value == DigtitalState.High ? true : false; StillController.CurrentState.StillEmpty = DI2008Data.Digital1.Value == DigtitalState.Low ? true : false; StillController.CurrentState.RVEmpty = DI2008Data.Digital2.Value == DigtitalState.Low ? true : false; StillController.CurrentState.RVFull = DI2008Data.Digital3.Value == DigtitalState.Low ? true : false; })); success = true; } catch { } } if (StillController.CurrentState.Phase == -1) { StillController.CurrentState.Phase = 0; } } while (true); }); return(SystemMonitor); }
private static Thread ColorChanger; //Continuously changes the led color public static void Main() { var Dataq = new DI2008(); Dataq.Channels.Analog0 = ChannelConfiguration._10v; Dataq.Channels.Analog1 = ChannelConfiguration._10v; Dataq.Channels.Analog2 = ChannelConfiguration.KTypeTC; Dataq.Channels.Analog3 = ChannelConfiguration._50v; Dataq.Channels.Analog4 = ChannelConfiguration._50v; Dataq.Channels.Analog5 = ChannelConfiguration._50v; Dataq.Channels.Analog6 = ChannelConfiguration._50v; Dataq.Channels.Analog7 = ChannelConfiguration._50v; Dataq.Channels.Digital0 = ChannelConfiguration.DigitalInput; Dataq.Channels.Digital1 = ChannelConfiguration.DigitalOutput; Dataq.Channels.Digital2 = ChannelConfiguration.DigitalOutput; Dataq.Channels.Digital3 = ChannelConfiguration.DigitalOutput; Dataq.Channels.Digital4 = ChannelConfiguration.DigitalOutput; Dataq.Channels.Digital5 = ChannelConfiguration.DigitalOutput; Dataq.Channels.Digital6 = ChannelConfiguration.DigitalOutput; Dataq.ConfigureChannels(); var ResponseFromDataq = Dataq.Functions.Write("stop"); Dataq.Functions.StartAcquiringData(); DI2008Controller.ReadRecord InstantaneousRead = new ReadRecord(); Reader = new Thread(() => { while (true) { var Data = Dataq.Functions.ReadData(); lock (Dataq) { InstantaneousRead = Data; } } }); Reader.Start(); ColorChanger = new Thread(() => { while (true) { foreach (LEDColor color in (LEDColor[])Enum.GetValues(typeof(LEDColor))) { //Dataq.Functions.EnableChannel(ChannelID.Digital6); Dataq.Functions.SetLedColor(color); Thread.Sleep(1000); //Dataq.Functions.DisableChannel(ChannelID.Digital6); Thread.Sleep(1000); //Dataq.Functions.Write("dout 64"); } } }); while (InstantaneousRead.Analog0 == null) { Thread.Sleep(100); } ColorChanger.Start(); Console.CursorVisible = false; while (true) { try { Console.SetCursorPosition(0, 0); Console.ForegroundColor = ConsoleColor.Red; Console.Write(Math.Round(InstantaneousRead.Analog0.Value.Value, 2).ToString("0.00") + " "); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write(Math.Round(InstantaneousRead.Analog1.Value.Value, 4) + " "); Console.ForegroundColor = ConsoleColor.White; Console.Write(" 1:" + InstantaneousRead.Digital0 + " 2:" + InstantaneousRead.Digital1 + " 3:" + InstantaneousRead.Digital2 + " 4:" + InstantaneousRead.Digital3 + " \r\n"); Console.WriteLine(DateTime.Now); Debug.WriteLine(Math.Round(InstantaneousRead.Analog0.Value.Value, 2).ToString("0.00") + " " + Math.Round(InstantaneousRead.Analog2.Value.Value, 4) + " " + " 1:" + InstantaneousRead.Digital0 + " 2:" + InstantaneousRead.Digital1 + " 3:" + InstantaneousRead.Digital2 + " 4:" + InstantaneousRead.Digital3); Thread.Sleep(100); } catch { } //Thread.Sleep(100); } }