public void InsertVerify(VerificationModel v) { string query = $@" insert into Verifications(IdResult, IdEmployee, DateOfVerification, Description, Positive) values({v.IdResult},{v.IdEmployee},{BaseDAO.SetDate(DateTime.Now)},{BaseDAO.SetString(v.Description)}, {BaseDAO.SetBool(v.Positive)}); "; BaseDAO.InsertOrUpdate(query, false); }
public void InsertSession(SessionModel s) { string query = $@" insert into Sessions(Token, ExpirationDate, IdUser, InUse) values({BaseDAO.SetString(s.Token)},{BaseDAO.SetDate(s.ExpirationDate)},{s.IdUser}, 1); "; BaseDAO.InsertOrUpdate(query, false); }
public long?InsertSample(SampleModel s) { string query = $@" insert into Samples(IdStudy, IdEmployee, DateOfCollection) output INSERTED.IdSample values({s.IdStudy}, {s.IdEmployee},{BaseDAO.SetDate(s.DateOfCollection)} ) ; "; return(BaseDAO.InsertOrUpdate(query, true)); }
public SessionModel ReadSessionByToken(string token) { string query = $@" select IdSession, Token, ExpirationDate, IdUser, InUse from Sessions where Token = {BaseDAO.SetString(token)} and ExpirationDate > {BaseDAO.SetDate(DateTime.Now)} and InUse = 1 "; return(BaseDAO.SelectFirst(query, ReadSessionModel)); }
public long?InsertResult(ResultModel r) { string query = $@" insert into Results(IdEmployee, IdStudy, DateOfResult, Description) output INSERTED.IdResult values({r.IdEmployee},{r.IdStudy},{BaseDAO.SetDate(DateTime.Now)}, {BaseDAO.SetString(r.Description)}); "; return(BaseDAO.InsertOrUpdate(query, true)); }
public long?InsertOrder(OrderModel o) { string query = $@" insert into Orders(IdPatient, IdEmployee, IdWard, Institution, Comment, DateOfOrder, IdStatus, IdPriority) output INSERTED.IdOrder values({o.IdPatient},{o.IdEmployee},{BaseDAO.SetNullableLong(o.IdWard)},{BaseDAO.SetString(o.Institution)}, {BaseDAO.SetString(o.Comment)},{BaseDAO.SetDate(DateTime.Now)}, 1, {o.IdPriority}); "; return(BaseDAO.InsertOrUpdate(query, true)); }
public void SetReorederDataOfStudy(StudyModel study) { string query = $@" update Studies set IdRepeatEmployee={study.IdRepeatEmployee}, IdStatus={(long)StatusTypeEnum.ReOrdered}, ReasonForRepeat={BaseDAO.SetString(study.ReasonForRepeat)}, Actual={BaseDAO.SetBool(false)}, DateOfEnd={BaseDAO.SetDate(DateTime.Now)} where IdStudy={study.IdStudy} "; BaseDAO.InsertOrUpdate(query, false); }
public void UpdateStudy(StudyModel study) { string query = $@" update Studies set IdEmployee={study.IdDoctor}, IdStatus={study.IdStatus}, DateOfStudy={BaseDAO.SetDate(study.DateOfStudy)}, ReasonForRepeat={BaseDAO.SetString(study.ReasonForRepeat)}, Actual={BaseDAO.SetBool(study.Actual)}, PreviousId={BaseDAO.SetNullableLong(study.PreviousId)}, DateOfEnd={BaseDAO.SetDate(study.DateOfEnd)}, IdRepeatEmployee={BaseDAO.SetNullableLong(study.IdRepeatEmployee)} where IdStudy={study.IdStudy} "; BaseDAO.InsertOrUpdate(query, false); }
public void InsertHistoryDataOfEmployee(EmployeeModel e, string user) { string query = $@" insert into HistoryPersonalData(FirstName, Surname, Pesel, Sex, Street, HouseNumber, City, PostalCode, Country, Phone, Email, LicenseNumber, IdEmployee, DateOfChange, UserOfChange) values({BaseDAO.SetString(e.FirstName)},{BaseDAO.SetString(e.Surname)},{BaseDAO.SetString(e.Pesel)},{BaseDAO.SetString(e.Sex)}, {BaseDAO.SetString(e.Street)},{BaseDAO.SetString(e.HouseNumber)},{BaseDAO.SetString(e.City)},{BaseDAO.SetString(e.PostalCode)}, {BaseDAO.SetString(e.Country)},{BaseDAO.SetString(e.Phone)}, {BaseDAO.SetString(e.Email)}, {BaseDAO.SetString(e.LicenseNumber)}, {e.IdEmployee}, {BaseDAO.SetDate(DateTime.Now)},{BaseDAO.SetString(user)}); "; BaseDAO.InsertOrUpdate(query, false); }
public long?InsertEmployee(EmployeeModel e) { string query = $@" insert into Employees(FirstName, Surname, Pesel, Sex, Street, HouseNumber, City, PostalCode, Country, Phone, IdPosition, Email, DateOfEmployment, LicenseNumber, IdWard) output INSERTED.IdEmployee values({BaseDAO.SetString(e.FirstName)},{BaseDAO.SetString(e.Surname)},{BaseDAO.SetString(e.Pesel)},{BaseDAO.SetString(e.Sex)}, {BaseDAO.SetString(e.Street)},{BaseDAO.SetString(e.HouseNumber)},{BaseDAO.SetString(e.City)},{BaseDAO.SetString(e.PostalCode)}, {BaseDAO.SetString(e.Country)},{BaseDAO.SetString(e.Phone)},{e.IdPosition},{BaseDAO.SetString(e.Email)}, {BaseDAO.SetDate(DateTime.Now)},{BaseDAO.SetString(e.LicenseNumber)},{BaseDAO.SetNullableLong(e.IdWard)}) ; "; return(BaseDAO.InsertOrUpdate(query, true)); }
public void InsertHistoryDataOfPatient(PatientModel p, string user) { string query = $@" insert into HistoryPersonalData(FirstName, Surname, Pesel, Sex, Street, HouseNumber, City, PostalCode, Country, Phone, IdCardNumber, ContactPersonFirstName, ContactPersonSurname, ContactPersonPesel, ContactPersonPhone, IdPatient, DateOfChange, UserOfChange) values({BaseDAO.SetString(p.FirstName)},{BaseDAO.SetString(p.Surname)},{BaseDAO.SetString(p.Pesel)},{BaseDAO.SetString(p.Sex)}, {BaseDAO.SetString(p.Street)},{BaseDAO.SetString(p.HouseNumber)},{BaseDAO.SetString(p.City)},{BaseDAO.SetString(p.PostalCode)}, {BaseDAO.SetString(p.Country)},{BaseDAO.SetString(p.Phone)},{BaseDAO.SetString(p.IdCardNumber)}, {BaseDAO.SetString(p.ContactPersonFirstName)},{BaseDAO.SetString(p.ContactPersonSurname)},{BaseDAO.SetString(p.ContactPersonPesel)}, {BaseDAO.SetString(p.ContactPersonPhone)},{p.IdPatient},{BaseDAO.SetDate(DateTime.Now)},{BaseDAO.SetString(user)}); "; BaseDAO.InsertOrUpdate(query, false); }
public void UpdateUser(UserModel u) { string query = $@" update Users set Password = {BaseDAO.SetString(u.Password)}, DateOfChange = {BaseDAO.SetDate(DateTime.Now)}, InUse = {BaseDAO.SetBool(u.InUse)} where IdUser = {u.IdUser}; "; BaseDAO.InsertOrUpdate(query, false); }
public void InsertUser(UserModel u) { string query = $@" insert into Users(IdEmployee, Login, Password, DateOfChange, InUse, IdPatient) values({BaseDAO.SetNullableLong(u.IdEmployee)},{BaseDAO.SetString(u.Login)},{BaseDAO.SetString(u.Password)},{BaseDAO.SetDate(DateTime.Now)},1,{BaseDAO.SetNullableLong(u.IdPatient)}); "; BaseDAO.InsertOrUpdate(query, false); }