Esempio n. 1
0
        //public IPrincipal User { get; }
        public void create(MedicalCertificateModel med, int PatientId)//ss, int PatientId)
        {
            PatientRepository pp = new PatientRepository();

            /* RegisterRepository reg = new RegisterRepository();
             * string user= User.Identity.Name;
             * ApplicationUser getst = reg.GetAll().ToList().Find(x => x.UserName == user);
             * string stuffname = getst.FullName + " " + getst.Surname;*/

            DateTime da   = new DateTime();
            string   date = da.Day + "-" + da.Month + "-" + da.Year;
            var      dat  = DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;

            var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId);

            using (var medrep = new MedicalCertificateRepository())
            {
                //var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId);
                MedicalCertificate ee = new MedicalCertificate
                {
                    MedcertificateId = med.MedcertificateId,
                    Date             = DateTime.Now.Date,
                    PatintName       = Pname.FullName + " " + Pname.Surname,
                    OpinonIllness    = med.OpinonIllness,
                    Fitnessproblem   = med.Fitnessproblem,
                    StartingDate     = med.StartingDate,
                    Enddate          = med.Enddate,
                    Comment          = med.Comment,
                    //Doctorname =  med.Doctorname
                    // Address = med.Address,
                    PatientId = PatientId
                };
                medrep.Create(ee);
            }
        }
        public void create(MedicalCertificateModel med, int PatientId)//ss, int PatientId)
        {
            PatientRepository pp = new PatientRepository();

            var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId);

            using (var medrep = new MedicalCertificateRepository())
            {
                //var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId);
                MedicalCertificate ee = new MedicalCertificate
                {
                    MedcertificateId = med.MedcertificateId,
                    Date             = med.Date,
                    PatintName       = Pname.FullName + " " + Pname.Surname,
                    OpinonIllness    = med.OpinonIllness,
                    Fitnessproblem   = med.Fitnessproblem,
                    StartingDate     = med.StartingDate,
                    Enddate          = med.Enddate,
                    Comment          = med.Comment,
                    Doctorname       = med.Doctorname,
                    Address          = med.Address,
                    PatientId        = med.PatientId,
                    datecreated      = DateTime.Now.Date
                };
                medrep.Create(ee);
            }
        }
        public List <MedicalCertificateModel> GetallMedCert(int PatientId)
        {
            PatientRepository pr = new PatientRepository();

            using (var medrepo = new MedicalCertificateRepository())
            {
                return(medrepo.GetallCertificate().FindAll(med => med.PatientId == PatientId).Select(x => new MedicalCertificateModel()
                {
                    MedcertificateId = x.MedcertificateId,
                    Date = x.Date,
                    PatintName = x.PatintName.ToUpper(),
                    OpinonIllness = x.OpinonIllness,
                    Fitnessproblem = x.Fitnessproblem,
                    StartingDate = x.StartingDate,
                    Enddate = x.Enddate,
                    Comment = x.Comment,
                    Doctorname = x.Doctorname,
                    Address = x.Address,
                    PatientId = x.PatientId,
                    resultFile = pr.GetById(x.PatientId).File,
                    FileName = pr.GetById(x.PatientId).FileName,
                    FileType = GlenwoodMed.Model.ViewModels.FileType.Avatar,
                    datecreated = x.datecreated
                }).ToList());
            }
        }
Esempio n. 4
0
 public MedicalCertificateModel GetbyId(int?id)
 {
     //MedicalCertificateModel ee = new MedicalCertificateModel();
     using (var medrep = new MedicalCertificateRepository())
     {
         MedicalCertificate med = medrep.GetById(id.Value);
         ee.MedcertificateId = med.MedcertificateId;
         return(ee);
     }
 }
Esempio n. 5
0
 public void PostDelete(int del)
 {
     using (var medrep = new MedicalCertificateRepository())
     {
         if (del != 0)
         {
             MedicalCertificate md = medrep.GetById(del);
             medrep.delete(md);
         }
     }
 }
        public int CountCertificates()
        {
            int count = 0;

            var medrepo = new MedicalCertificateRepository();

            foreach (var c in medrepo.GetallCertificate())
            {
                count++;
            }

            return(count);
        }
Esempio n. 7
0
 public List <MedicalCertificateModel> GetallMedCert()
 {
     using (var medrepo = new MedicalCertificateRepository())
     {
         return(medrepo.GetallCertificate().Select(x => new MedicalCertificateModel()
         {
             MedcertificateId = x.MedcertificateId,
             Date = x.Date,
             PatintName = x.PatintName.ToUpper(),
             OpinonIllness = x.OpinonIllness,
             Fitnessproblem = x.Fitnessproblem,
             StartingDate = x.StartingDate,
             Enddate = x.Enddate,
             Comment = x.Comment,
             //Doctorname = x.Doctorname,
             // Address = x.Address,
             PatientId = x.PatientId
         }).ToList());
     }
 }
Esempio n. 8
0
 public MedicalCertificateModel PostEdit(MedicalCertificateModel id)
 {
     using (var medrep = new MedicalCertificateRepository())
     {
         if (id.MedcertificateId == 0)
         {
             MedicalCertificate md = new MedicalCertificate
             {
                 MedcertificateId = id.MedcertificateId,
                 Date             = id.Date,
                 PatintName       = id.PatintName,
                 OpinonIllness    = id.OpinonIllness,
                 Fitnessproblem   = id.Fitnessproblem,
                 StartingDate     = id.StartingDate,
                 Enddate          = id.Enddate,
                 Comment          = id.Comment,
                 //Doctorname = id.Doctorname,
                 // Address = id.Address,
                 PatientId = id.PatientId
             };
             medrep.Create(md);
         }
         else
         {
             MedicalCertificate med = medrep.GetById(id.MedcertificateId);
             med.MedcertificateId = id.MedcertificateId;
             med.Date             = id.Date;
             med.PatintName       = id.PatintName;
             med.OpinonIllness    = id.OpinonIllness;
             med.Fitnessproblem   = id.Fitnessproblem;
             med.StartingDate     = id.StartingDate;
             med.Enddate          = id.Enddate;
             med.Comment          = id.Comment;
             //med.Doctorname = id.Doctorname;
             // med.Address = id.Address;
             med.PatientId = id.PatientId;
             medrep.Upadte(med);
         }
         return(id);
     }
 }
 public List <MedicalCertificateModel> GetAllCertificates()
 {
     using (var medrepo = new MedicalCertificateRepository())
     {
         return(medrepo.GetallCertificate().Select(x => new MedicalCertificateModel()
         {
             MedcertificateId = x.MedcertificateId,
             Date = x.Date,
             PatintName = x.PatintName.ToUpper(),
             OpinonIllness = x.OpinonIllness,
             Fitnessproblem = x.Fitnessproblem,
             StartingDate = x.StartingDate,
             Enddate = x.Enddate,
             Comment = x.Comment,
             PatientId = x.PatientId,
             resultFile = pr.GetById(x.PatientId).File,
             FileName = pr.GetById(x.PatientId).FileName,
             FileType = GlenwoodMed.Model.ViewModels.FileType.Avatar
         }).ToList());
     }
 }
Esempio n. 10
0
 public MedicalCertificateModel GetDelete(int?id, MedicalCertificateModel medi)
 {
     using (var medrep = new MedicalCertificateRepository())
     {
         if (id != 0)
         {
             MedicalCertificate med = medrep.GetById(id.Value);
             medi.MedcertificateId = med.MedcertificateId;
             medi.Date             = med.Date;
             medi.PatintName       = med.PatintName;
             medi.OpinonIllness    = med.OpinonIllness;
             medi.Fitnessproblem   = med.Fitnessproblem;
             medi.StartingDate     = med.StartingDate;
             medi.Enddate          = med.Enddate;
             medi.Comment          = med.Comment;
             //medi.Doctorname = med.Doctorname;
             //ee.Address = med.Address;
             medi.PatientId = med.PatientId;
         }
         return(medi);
     }
 }
Esempio n. 11
0
        public MedicalCertificateModel GetEdit(int?id)
        {
            MedicalCertificateModel ee = new MedicalCertificateModel();

            using (var medcert = new MedicalCertificateRepository())
            {
                if (id.HasValue)
                {
                    MedicalCertificate med = medcert.GetById(id.Value);
                    ee.MedcertificateId = med.MedcertificateId;
                    ee.Date             = med.Date;
                    ee.PatintName       = med.PatintName;
                    ee.OpinonIllness    = med.OpinonIllness;
                    ee.Fitnessproblem   = med.Fitnessproblem;
                    ee.StartingDate     = med.StartingDate;
                    ee.Enddate          = med.Enddate;
                    ee.Comment          = med.Comment;
                    //ee.Doctorname = med.Doctorname;
                    //ee.Address = med.Address;
                    ee.PatientId = med.PatientId;
                }
                return(ee);
            }
        }
Esempio n. 12
0
        public MedicalCertificate GetMedId(int id)
        {
            var medrep = new MedicalCertificateRepository();

            return(medrep.GetById(id));
        }