Exemple #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 MedicalCertificateModel GetbyId(int?PatientId)
        {
            MedicalCertificateModel ee = new MedicalCertificateModel();

            using (var medrep = new MedicalCertificateRepository())
            {
                MedicalCertificate med = medrep.GetById(PatientId.Value);
                ee.MedcertificateId = med.MedcertificateId;
                return(ee);
            }
        }
 public ActionResult modifycontents(int id, MedicalCertificateModel med, int?nothing)
 {
     try
     {
         //int PatientId = Convert.ToInt32(Session["newpatientid"]);
         // var hmm = ee.GetallMedCert().Find(x => x.MedcertificateId == id);
         ee.PostEdit(med);
         return(RedirectToAction("Index", new { PatientId = med.PatientId }));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult CreateMedCertificate(MedicalCertificateModel med)
 {
     try
     {
         // TODO: Add insert logic here
         var ee        = new MedCertificateBusiness();
         int PatientId = Convert.ToInt32(System.Web.HttpContext.Current.Session["PId"]);
         ee.create(med, PatientId);
         return(RedirectToAction("Index", new { PatientId = PatientId }));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult DeleteCertificate(int id, MedicalCertificateModel med, int?da)
 {
     try
     {
         med = (MedicalCertificateModel)TempData["data"];
         // TODO: Add delete logic here
         // var medCert = ee.GetallMedCert().Find(x => x.MedcertificateId== id);
         ee.PostDelete(id);
         return(RedirectToAction("Index", new { PatientId = med.PatientId }));
     }
     catch
     {
         return(View());
     }
 }
Exemple #7
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 ActionResult CreateMedCertificate(int?PatientId)
        {
            var ee = new MedCertificateBusiness();
            var Pb = new PatientBusiness();

            if (PatientId.HasValue)
            {
                var Pname = Pb.GetPatients().Find(x => x.PatientId == PatientId.Value);
                var model = new MedicalCertificateModel
                {
                    PatintName = Pname.FullName + " " + Pname.Surname,
                    PatientId  = PatientId.Value,
                    FileName   = Pname.FileName,
                    FileType   = Pname.FileType,
                    resultFile = Pname.File
                };
                System.Web.HttpContext.Current.Session["PId"] = PatientId;
                return(View(model));
            }
            return(View());
        }
        public ActionResult CreateMedCertificate(int?PatientId12)
        {
            var ee        = new MedCertificateBusiness();
            var Pb        = new PatientBusiness();
            int PatientId = Convert.ToInt32(Session["newpatientid"]);

            if (PatientId != 0)
            {
                var Pname = Pb.GetPatients().Find(x => x.PatientId == PatientId);
                var model = new MedicalCertificateModel
                {
                    PatintName = Pname.FullName.ToUpper() + " " + Pname.Surname.ToUpper(),
                    PatientId  = PatientId,
                    FileName   = Pname.FileName,
                    FileType   = Pname.FileType,
                    resultFile = Pname.File
                };
                System.Web.HttpContext.Current.Session["PId"] = PatientId;
                return(View(model));
            }
            return(View());
        }
Exemple #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);
     }
 }
Exemple #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);
            }
        }
 public ActionResult DeleteCertificate(int id, MedicalCertificateModel med)
 {
     TempData["data"] = med;
     return(View(ee.GetDelete(id, med)));
 }