Esempio n. 1
0
 public Guid GetInstallID(int id)
 {
     using (var db = new ArtelusDbContext())
     {
         return(db.Database.SqlQuery <Guid>("Select InstallID From Users Where Id={0}", id).Single());;
     }
 }
Esempio n. 2
0
 public string GetToken(int id)
 {
     using (var db = new ArtelusDbContext())
     {
         return(db.Database.SqlQuery <string>("Select Token From Users Where Id={0}", id).Single());;
     }
 }
Esempio n. 3
0
 public UserEntity Get(int id)
 {
     using (var db = new ArtelusDbContext())
     {
         return(db.Database.SqlQuery <UserEntity>("Select * From Users Where Id={0}", id).First());;
     }
 }
 public List <PatientReport> GetAllReport(int id)
 {
     using (var db = new ArtelusDbContext())
     {
         return(db.Database.SqlQuery <PatientReport>("Select * from PatientReport Where PatientId={0}", id).ToList());
     }
 }
 public PatientReport GetLastestReport(int id)
 {
     using (var db = new ArtelusDbContext())
     {
         return(db.Database.SqlQuery <PatientReport>("select top(1)* from patientreport where patientid={0} order by Id desc;", id).FirstOrDefault());
     }
 }
 public void UpdateReportData(int reportDataId, string prediction)
 {
     using (var db = new ArtelusDbContext())
     {
         db.Database.ExecuteSqlCommand("Update ReportData Set Prediction={1} Where Id={0}", reportDataId, prediction);
     }
 }
 public void UpdatePatientId(int id, int patientId)
 {
     using (var db = new ArtelusDbContext())
     {
         string sql = "UPDATE [Patient] SET [PatientId]={1} Where p_id={0}";
         db.Database.ExecuteSqlCommand(sql, id, patientId);
         db.SaveChanges();
     }
 }
 public void UpdateSyncStatus(int reportId)
 {
     using (var db = new ArtelusDbContext())
     {
         string sql = "UPDATE [PatientReport] SET Sync=1 Where Id={0}";
         db.Database.ExecuteSqlCommand(sql, reportId);
         db.SaveChanges();
     }
 }
 public void Update(PatientEntity model)
 {
     using (var db = new ArtelusDbContext())
     {
         string sql = "UPDATE [Patient] SET name={1},pMName={2},pLName={3},ifResidentOfM={4},IcNumber={5},otherOption={6},othersID={7},doctosName={8},hospitalName={9},hospitalID={10},hospitaScreening={11},p_email={12},marital_status={13},age={14},[sex]={15},[permanent_address]={16},[area]={17},[phone_res]={18},[mobile]={19},[occupation]={20},[working_at]={21},[currentMedications]={22},[laser_reatment]={23},have_cataract={24},have_hypertension={25},allergy_to_drugs={26},have_diabetes={27},additional_info={28},emg_contact_name={29},emg_phone={30},name_of_the_stated_onsent={31},relation_with_patient={32},update_at={33},allergy_drugs_details={34},MedicalInsurance={35} Where p_id={0}";
         db.Database.ExecuteSqlCommand(sql, model.Id, model.Nm, model.MNm, model.LNm, model.IfResidentOfM, model.IcNumber, model.OtherOption, model.OthersID, model.DocNm, model.HospitalNm, model.HospitalID, model.HospitalScreening, model.Email, model.MaritalStatus == "Married" ? "Yes" : "No", model.Age, model.Sex == "Male" ? "m" : "f", model.PerAdr, model.Area, model.ResidentPh, model.Mob, model.Occupation, model.WorkingAt, model.CurrentMedications, model.LaserTreatment, model.Cataract, model.Hypertension, model.AllergyDrugs, model.Diabetic, model.Info, model.EmergContactNm, model.EmergPh, model.StatedConsentPerson, model.Relation, model.MDt, model.AllergyDrugsDtl, model.MedicalInsurance);
         db.SaveChanges();
     }
 }
Esempio n. 10
0
        public bool Update(UserEntity user)
        {
            int count = 0;

            using (var db = new ArtelusDbContext())
            {
                count = db.Database.ExecuteSqlCommand("Update [Users] SET IsConfigured={0},InstallID={1},Location={2},PinCode={3},Token={5},Address={6}, Email={7} Where Id={4}", user.IsConfigured, user.InstallID, user.Location, user.PinCode, user.Id, user.Token, user.Address, user.Email);
                db.SaveChanges();
            }
            return(count > 0);
        }
        public int AddReport(PatientReport model)
        {
            int reportId = 0;

            using (var db = new ArtelusDbContext())
            {
                db.Database.ExecuteSqlCommand("INSERT INTO PatientReport(PatientId,Dt,Location,InstallID,UniqueID) VALUES({0},{1},{2},{3},{4})", model.PatientId, model.Dt, model.Location, model.InstallID, model.UniqueID);
                reportId = db.Database.SqlQuery <int>("SELECT MAX(Id) FROM PatientReport").SingleOrDefault();
            }
            return(reportId);
        }
 public int Add(PatientEntity model)
 {
     using (var db = new ArtelusDbContext())
     {
         string sql = "INSERT INTO [Patient] ([name],[pMName],[pLName],[notResident],[ifResidentOfM],[IcNumber],[otherOption],[othersID],[doctosName],[hospitalName],[hospitalID],[hospitaScreening],[p_email],[marital_status],[age],[sex],[permanent_address],[area],[phone_res],[mobile],[occupation],[working_at],[currentMedications],[laser_reatment],[have_cataract],[have_hypertension],[allergy_to_drugs],[have_diabetes],[additional_info],[emg_contact_name],[emg_phone],[name_of_the_stated_onsent],[relation_with_patient],[term_conditation],[collection_id],[install_id],[update_at],[create_at],[UniqueID],[allergy_drugs_details],[MedicalInsurance])" +
                      " VALUES({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},{38},{39},{40}); ";
         db.Database.ExecuteSqlCommand(sql, model.Nm, model.MNm, model.LNm, model.NotResident, model.IfResidentOfM, model.IcNumber, model.OtherOption, model.OthersID, model.DocNm, model.HospitalNm, model.HospitalID, model.HospitalScreening, model.Email, model.MaritalStatus == "Married" ? "Yes" : "No", model.Age, model.Sex == "Male" ? "m" : "f", model.PerAdr, model.Area, model.ResidentPh, model.Mob, model.Occupation, model.WorkingAt, model.CurrentMedications, model.LaserTreatment, model.Cataract, model.Hypertension, model.AllergyDrugs, model.Diabetic, model.Info, model.EmergContactNm, model.EmergPh, model.StatedConsentPerson, model.Relation, model.TermsCondition, model.CollectionID, model.InstallID, model.MDt, model.CDt, model.UniqueID, model.AllergyDrugsDtl, model.MedicalInsurance);
         model.Id = db.Database.SqlQuery <int>("SELECT MAX(p_id) FROM Patient").SingleOrDefault();
     }
     return(model.Id);
 }
        public int AddReportData(int reportId, string mode, string eye, string img, string prediction, string size, int patientId)
        {
            int reportDataId = 0;

            using (var db = new ArtelusDbContext())
            {
                db.Database.ExecuteSqlCommand("INSERT INTO ReportData(PatientReportId,Mode,Img,Eye,Prediction,Size,PatientId) VALUES({0},{1},{2},{3},{4},{5},{6})", reportId, mode, img, eye, prediction, size, patientId);
                db.SaveChanges();
                reportDataId = db.Database.SqlQuery <int>("SELECT MAX(Id) FROM ReportData").SingleOrDefault();
            }
            return(reportDataId);
        }