/// <summary> /// This method lists all automate datas. /// </summary> /// <returns>List<Table_AutomatData></returns> public List <Table_AutomatData> ListAll() { List <Table_AutomatData> automat_dataer; try { automat_dataer = (from ad in db.Table_AutomatDatas select ad).ToList(); } catch (Exception exception) { Table_AutomatData automat_data = new Table_AutomatData { automat_id = -1000, kunde_id = -1000, dato = new DateTime(0000, 01, 01, 00, 00, 00, 00), kr_ind = -1000, kr_ud = -1000, bsi = -1000 }; automat_dataer = new List <Table_AutomatData> { automat_data }; } return(automat_dataer); }
/// <summary> /// This method finds a list of automate datas where value of the bsi is equal or lower than the given bsi. /// </summary> /// <param name="bsi"></param> /// <returns>List<Table_AutomatData></returns> public List <Table_AutomatData> FindByBsiLower(int bsi) { List <Table_AutomatData> automat_dataer; try { automat_dataer = (from ad in db.Table_AutomatDatas where ad.bsi <= bsi select ad).ToList(); } catch (Exception exception) { Table_AutomatData automat_data = new Table_AutomatData { automat_id = -1000, kunde_id = -1000, dato = new DateTime(0000, 01, 01, 00, 00, 00, 00), kr_ind = -1000, kr_ud = -1000, bsi = -1000 }; automat_dataer = new List <Table_AutomatData> { automat_data }; Console.WriteLine(exception.Message); } return(automat_dataer); }
/// <summary> /// This method creates an automat data /// </summary> /// <param name="automat_id"></param> /// <param name="kunde_id"></param> /// <param name="dato"></param> /// <param name="kr_ind"></param> /// <param name="kr_ud"></param> /// <returns>string</returns> public string Create(int automat_id, int kunde_id, DateTime dato, int kr_ind, int kr_ud) { Table_AutomatData automat_data; string result; try { automat_data = new Table_AutomatData { automat_id = automat_id, kunde_id = kunde_id, dato = dato, kr_ind = kr_ind, kr_ud = kr_ud, bsi = CalculateBSI(kr_ind, kr_ud) }; db.SubmitChanges(); result = "Success"; } catch (Exception exception) { result = exception.Message; } return(result); }
/// <summary> /// This method finds an automate data by its data_id. /// </summary> /// <param name="data_id"></param> /// <returns>Table_AutomatData</returns> public Table_AutomatData FindByDataId(int data_id) { Table_AutomatData automat_data; try { automat_data = db.Table_AutomatDatas.First(ad => ad.data_id.Equals(data_id)); } catch (Exception exception) { automat_data = new Table_AutomatData { automat_id = -1000, kunde_id = -1000, dato = new DateTime(0000, 01, 01, 00, 00, 00, 00), kr_ind = -1000, kr_ud = -1000, bsi = -1000 }; Console.WriteLine(exception.Message); } return(automat_data); }
private void detach_Table_AutomatDatas(Table_AutomatData entity) { this.SendPropertyChanging(); entity.Table_Kunde = null; }
partial void DeleteTable_AutomatData(Table_AutomatData instance);
partial void UpdateTable_AutomatData(Table_AutomatData instance);
partial void InsertTable_AutomatData(Table_AutomatData instance);
private void attach_Table_AutomatDatas(Table_AutomatData entity) { this.SendPropertyChanging(); entity.Table_Automat = this; }