private void Awake() { if (instance == null) { instance = this; } }
private void ImportBloodService() { List <string> data = File.ReadLines(@"F:\ЯндексДиск\работяга\Четвёртый курс\Второй семак\WSR\WSR_Laboratory\ImportData\blood_service.txt").ToList(); data.ForEach((item) => { string[] itemData = item.Split('\t'); string AnalyzerName = itemData[6]; analyzer analyzer = Laboratory.GetContext().analyzer.Where(p => p.name == AnalyzerName).FirstOrDefault(); if (analyzer == null) { analyzer = new analyzer(); analyzer.name = AnalyzerName; Laboratory.GetContext().analyzer.Add(analyzer); Laboratory.GetContext().SaveChanges(); } blood_service blood_service = new blood_service(); decimal service_code = decimal.Parse(itemData[1]); blood_service.service = Laboratory.GetContext().service.Where(p => p.code == service_code).FirstOrDefault(); int IdBlood = int.Parse(itemData[0]); blood blood = Laboratory.GetContext().blood.Where(p => p.id_blood == IdBlood).FirstOrDefault(); if (blood == null) { return; } blood_service.blood = blood; blood_service.result = decimal.Parse(itemData[2]); blood_service.date_finished = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse(itemData[3])).DateTime; blood_service.accepted = bool.Parse(itemData[4]); blood_service.id_status = itemData[5] == "Finished" ? 1 : 2; int UserId = int.Parse(itemData[7]); blood_service.employee = Laboratory.GetContext().employee.Where(p => p.id_user == UserId).FirstOrDefault(); Laboratory.GetContext().blood_service.Add(blood_service); analyzer_blood_service analyzer_Blood = new analyzer_blood_service(); analyzer_Blood.analyzer = analyzer; analyzer_Blood.blood_service = blood_service; analyzer_Blood.date_reception = blood.date_create; analyzer_Blood.date_finished = blood_service.date_finished; Laboratory.GetContext().analyzer_blood_service.Add(analyzer_Blood); }); Laboratory.GetContext().SaveChanges(); }
private void ImportBlood() { List <string> data = File.ReadLines(@"F:\ЯндексДиск\работяга\Четвёртый курс\Второй семак\WSR\WSR_Laboratory\ImportData\blood.txt").ToList(); data.ForEach((item) => { string[] itemData = item.Split('\t'); blood blood = new blood(); blood.id_patient = int.Parse(itemData[1]); blood.barcode = decimal.Parse(itemData[2]); blood.date_create = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse(itemData[3].Replace("-", ""))).DateTime; blood.id_status = 1; Laboratory.GetContext().blood.Add(blood); }); Laboratory.GetContext().SaveChanges(); }
void Start() { _This = this; }