Added ISL - infrastructure layer to later add data into the database

This commit is contained in:
ismail 2018-06-13 21:24:05 +02:00
parent e01aab8bb5
commit 27b3dfdacf
5 changed files with 293 additions and 1 deletions

View File

@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerWebApplication", "ServerWebApplication\ServerWebApplication\ServerWebApplication.csproj", "{78D3B3D9-5CEC-42D5-B3D1-C480E688FDE1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web_Server_EHEC", "Web_Server_EHEC\Web_Server_EHEC\Web_Server_EHEC.csproj", "{B5DDA21F-D9CA-4D70-B631-CFEBBB647998}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -24,11 +26,15 @@ Global
{78D3B3D9-5CEC-42D5-B3D1-C480E688FDE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78D3B3D9-5CEC-42D5-B3D1-C480E688FDE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78D3B3D9-5CEC-42D5-B3D1-C480E688FDE1}.Release|Any CPU.Build.0 = Release|Any CPU
{B5DDA21F-D9CA-4D70-B631-CFEBBB647998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5DDA21F-D9CA-4D70-B631-CFEBBB647998}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5DDA21F-D9CA-4D70-B631-CFEBBB647998}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5DDA21F-D9CA-4D70-B631-CFEBBB647998}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BC7FC314-8898-4C47-A506-72C37C97B0E5}
SolutionGuid = {075C6F0D-EA23-4CF6-B8FB-D41D83A60A19}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Web_Server_EHEC.Model;
using Web_Server_EHEC.DAL;
namespace Web_Server_EHEC.ISL
{
public class DoctorISL
{
public List<Doctor> GetAllDoctors()
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
return ctx.DoctorSet.ToList();
}
}
public bool CreateDoctor(Doctor doctor)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.DoctorSet.Add(doctor);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool UpdateDoctor(Doctor doctor)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.DoctorSet.Attach(doctor);
ctx.Entry(doctor).State = System.Data.Entity.EntityState.Modified;
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool DeleteDoctor(Doctor doctor)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.DoctorSet.Attach(doctor);
ctx.DoctorSet.Remove(doctor);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
}
}

View File

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Web_Server_EHEC.Model;
namespace Web_Server_EHEC.ISL
{
public class ExamISL
{
public List<Exam> GetAllExams()
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
return ctx.ExamSet.ToList();
}
}
public bool CreateExam(Exam exam)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.ExamSet.Add(exam);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool UpdateExam(Exam exam)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.ExamSet.Attach(exam);
ctx.Entry(exam).State = System.Data.Entity.EntityState.Modified;
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool DeleteExam(Exam exam)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.ExamSet.Attach(exam);
ctx.ExamSet.Remove(exam);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
}
}

View File

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Web_Server_EHEC.Model;
namespace Web_Server_EHEC.ISL
{
public class PatientISL
{
public List<Patient> GetAllPatients()
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
return ctx.PatientSet.ToList();
}
}
public bool CreatePatient(Patient patient)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.PatientSet.Add(patient);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool UpdatePatient(Patient patient)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.PatientSet.Attach(patient);
ctx.Entry(patient).State = System.Data.Entity.EntityState.Modified;
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool DeletePatient(Patient patient)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.PatientSet.Attach(patient);
ctx.PatientSet.Remove(patient);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
}
}

View File

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Web_Server_EHEC.Model;
namespace Web_Server_EHEC.ISL
{
public class ResultISL
{
public List<Result> GetAllResults()
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
return ctx.ResultSet.ToList();
}
}
public bool CreateResult(Result result)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.ResultSet.Add(result);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool UpdateResult(Result result)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.ResultSet.Attach(result);
ctx.Entry(result).State = System.Data.Entity.EntityState.Modified;
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
public bool DeleteResult(Result result)
{
try
{
using (EHEC_DB_ModelContainer ctx = new EHEC_DB_ModelContainer())
{
ctx.ResultSet.Attach(result);
ctx.ResultSet.Remove(result);
ctx.SaveChanges();
}
return true;
}
catch (Exception)
{
return false;
}
}
}
}