public ActionResult ViewSymptoms()
        {
            ViewBag.Title = "علامات ملاحظہ کريں";
            DB50Entities db = new DB50Entities();

            return(View(db.Symptoms));
        }
Example #2
0
        public async Task <ActionResult> Login(Login model)
        {
            Register     reg      = new Register();
            DB50Entities db       = new DB50Entities();
            string       Name     = null;
            string       Password = null;

            foreach (var per in db.Accounts)
            {
                if (per.Email == model.Name && per.Password == model.Password)
                {
                    if (per.Type == "مریض")
                    {
                        Name             = per.UserName;
                        Password         = per.Password;
                        Session["Email"] = per.Email;
                        Session["Type"]  = per.Type;
                        return(RedirectToAction("UserProfile", "Manage"));
                    }
                    else
                    {
                        Name             = per.UserName;
                        Password         = per.Password;
                        Session["Email"] = per.Email;
                        Session["Type"]  = per.Type;
                        return(RedirectToAction("AddDisease", "Disease"));
                    }
                }
            }
            return(View(model));
        }
        public ActionResult FindDisease(Symptoms model)
        {
            DB50Entities  db          = new DB50Entities();
            List <string> DiseaseName = new List <string>();
            List <Int32>  Id          = new List <int>();

            foreach (var sym in db.Symptoms)
            {
                if (sym.SymptomName == model.SymptomName)
                {
                    Id.Add(sym.SymptomID);
                }
            }
            foreach (int id in Id)
            {
                foreach (var i in db.Diseases)
                {
                    if (id == i.SymptomID)
                    {
                        DiseaseName.Add(i.Name);
                    }
                }
            }

            ViewBag.name = DiseaseName;
            return(View());
        }
        public ActionResult HomePage()
        {
            DB50Entities    db       = new DB50Entities();
            Register        reg      = new Register();
            List <Register> List_Reg = new List <Register>();

            foreach (var acc in db.Profiles)
            {
                foreach (var account in db.Accounts)
                {
                    if (acc.Email == account.Email)
                    {
                        if (acc.Type == "ڈاکٹر")
                        {
                            reg.Email           = acc.Email;
                            reg.Name            = account.UserName;
                            reg.ImagePath       = acc.ImagePath;
                            reg.Address         = acc.Address;
                            reg.Country         = acc.Country;
                            reg.TelephoneNumber = acc.TelephoneNumber;
                            reg.type            = acc.Type;
                            List_Reg.Add(reg);
                            ViewBag.Doctor = List_Reg;
                        }
                    }
                }
            }
            return(View());
        }
        public ActionResult ViewDisease()
        {
            ViewBag.Title = "بيمارياں ملاحظہ کريں";
            DB50Entities db = new DB50Entities();

            return(View(db.Diseases));
        }
Example #6
0
        public ActionResult ViewTreatment()
        {
            ViewBag.Title = "علاج ملاحظہ کريں";
            DB50Entities db = new DB50Entities();

            return(View(db.Treatments));
        }
Example #7
0
        public ActionResult AddTreatment()
        {
            DB50Entities  dbo         = new DB50Entities();
            List <string> DiseaseName = new List <string>();
            List <int>    Ids         = new List <int>();

            foreach (Disease d in dbo.Diseases)
            {
                if (d.DiseaseID != null)
                {
                    Ids.Add(d.DiseaseID);
                    DiseaseName.Add(d.Name);
                }
            }
            ViewBag.DName = DiseaseName;
            ViewBag.Ids   = Ids;

            List <int>    CIds         = new List <int>();
            List <string> CategoryName = new List <string>();

            foreach (Category c in dbo.Categories)
            {
                if (c.CategoryID != null)
                {
                    CIds.Add(c.CategoryID);
                    CategoryName.Add(c.Type);
                }
            }
            ViewBag.CName = CategoryName;
            ViewBag.CIds  = CIds;

            return(View());
        }
        public ActionResult UserProfile(Register model)
        {
            string email = Session["UserName"].ToString();

            ViewBag.Email = email;
            DB50Entities db = new DB50Entities();

            foreach (var user in db.Accounts)
            {
                if (email == user.Email)
                {
                    foreach (var us in db.Profiles)
                    {
                        if (us.Email == email)
                        {
                            ViewBag.Country = us.Country;
                            ViewBag.Email   = us.Email;
                            ViewBag.Number  = us.ContactNumber;
                            break;
                        }
                    }
                }
            }
            return(View());
        }
        public ActionResult Registered(Register model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            DB50Entities dbo     = new DB50Entities();
            Account      account = new Account();
            Profile      profile = new Profile();

            account.UserName = model.Name;
            account.Email    = model.Email;
            account.Password = model.Password;
            dbo.Accounts.Add(account);
            dbo.SaveChanges();

            profile.Address         = model.Address;
            profile.ContactNumber   = model.TelephoneNumber;
            profile.Country         = model.Country;
            profile.Email           = model.Email;
            profile.LicenseNumber   = model.LicenseNumber;
            profile.TelephoneNumber = model.TelephoneNumber;
            profile.Type            = model.type;
            dbo.Profiles.Add(profile);
            dbo.SaveChanges();
            return(View(model));
        }
        public ActionResult AddDisease(Diseases model, int SymptomName)
        {
            DB50Entities dbo     = new DB50Entities();
            Disease      disease = new Disease();

            disease.SymptomID = SymptomName;
            disease.Name      = model.Name;
            disease.Detail    = model.Detail;

            dbo.Diseases.Add(disease);

            dbo.SaveChanges();
            DB50Entities  db       = new DB50Entities();
            List <string> SympName = new List <string>();
            List <int>    SIds     = new List <int>();

            foreach (Symptom d in db.Symptoms)
            {
                if (d.SymptomID != null)
                {
                    SIds.Add(d.SymptomID);
                    SympName.Add(d.SymptomName);
                }
            }
            ViewBag.SName = SympName;
            ViewBag.SIds  = SIds;

            return(View("AddDisease"));
        }
        public ActionResult DeleteSymptoms(int id)
        {
            ViewBag.Title = "اخراج";
            DB50Entities db = new DB50Entities();
            Symptom      c  = db.Symptoms.Find(id);

            return(View(c));
        }
        public ActionResult DeleteDisease(int id)
        {
            ViewBag.Title = "اخراج";
            DB50Entities db = new DB50Entities();
            Disease      c  = db.Diseases.Find(id);

            return(View(c));
        }
 public ActionResult UpdateSymptoms(int id)
 {
     ViewBag.Title = " درستگی ";
     using (DB50Entities db = new DB50Entities())
     {
         return(View(db.Symptoms.Where(x => x.SymptomID == id).Single()));
     }
 }
Example #14
0
 public ActionResult UpdateTreatment(int id)
 {
     ViewBag.Title = " درستگی ";
     using (DB50Entities db = new DB50Entities())
     {
         return(View(db.Treatments.Where(x => x.TreatmentID == id).Single()));
     }
 }
Example #15
0
        public ActionResult DeleteTreatment(int id)
        {
            ViewBag.Title = "اخراج";
            DB50Entities db = new DB50Entities();
            Treatment    t  = db.Treatments.Find(id);

            return(View());
        }
 public ActionResult UpdateDisease(int id)
 {
     ViewBag.Title = " درستگی ";
     using (DB50Entities db = new DB50Entities())
     {
         return(View(db.Diseases.Where(x => x.DiseaseID == id).Single()));
     }
 }
        public ActionResult AddSymptoms(Symptom model)
        {
            DB50Entities dbo     = new DB50Entities();
            Symptom      symptom = new Symptom();

            symptom.SymptomName = model.SymptomName;
            symptom.Detail      = model.Detail;
            symptom.Reason      = model.Reason;
            dbo.Symptoms.Add(symptom);
            dbo.SaveChanges();
            return(View());
        }
Example #18
0
        public ActionResult AddTreatment(Treatment model, int Name, int Type)
        {
            DB50Entities dbo       = new DB50Entities();
            Treatment    treatment = new Treatment();

            treatment.DiseaseID     = Name;
            treatment.CategoryID    = Type;
            treatment.TreatmentName = model.TreatmentName;
            treatment.Detail        = model.Detail;
            dbo.Treatments.Add(treatment);
            dbo.SaveChanges();
            return(RedirectToAction("AddTreatment"));
        }
        public ActionResult GenerateReport6()
        {
            DB50Entities db = new DB50Entities();

            var             c = db.Report11();
            CrystalReport11 r = new CrystalReport11();

            r.Load();

            Stream s = r.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            return(File(s, "application/pdf"));
        }
 public ActionResult DeleteSymptoms(int id, Symptom obj)
 {
     try
     {
         DB50Entities db       = new DB50Entities();
         var          ToDelete = db.Symptoms.Single(x => x.SymptomID == id);
         db.Symptoms.Remove(ToDelete);
         db.SaveChanges();
         return(View("AddSymptoms"));
     }
     catch
     {
         return(View());
     }
 }
Example #21
0
 public ActionResult DeleteTreatment(int id, Treatment model)
 {
     try
     {
         DB50Entities db       = new DB50Entities();
         var          ToDelete = db.Treatments.Single(x => x.TreatmentID == id);
         db.Treatments.Remove(ToDelete);
         db.SaveChanges();
         return(View("~/Views/Disease/AddDisease.cshtml"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult DeleteDisease(int id, Disease obj)
 {
     try
     {
         DB50Entities db       = new DB50Entities();
         var          ToDelete = db.Diseases.Single(x => x.DiseaseID == id);
         db.Diseases.Remove(ToDelete);
         db.SaveChanges();
         return(View("AddDisease"));
     }
     catch
     {
         return(View());
     }
 }
Example #23
0
 public ActionResult UpdateTreatment(Treatment model, int id)
 {
     try
     {
         using (DB50Entities db = new DB50Entities())
         {
             db.Treatments.Find(id).TreatmentName = model.TreatmentName;
             db.Treatments.Find(id).Detail        = model.Detail;
             db.SaveChanges();
         }
         return(View("~/Views/Disease/AddDisease.cshtml"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult UpdateDisease(Disease obj, int id)
 {
     try
     {
         using (DB50Entities db = new DB50Entities())
         {
             db.Diseases.Find(id).Name   = obj.Name;
             db.Diseases.Find(id).Detail = obj.Detail;
             db.SaveChanges();
         }
         return(View("AddDisease"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult UpdateSymptoms(Symptom obj, int id)
 {
     try
     {
         using (DB50Entities db = new DB50Entities())
         {
             db.Symptoms.Find(id).SymptomName = obj.SymptomName;
             db.Symptoms.Find(id).Detail      = obj.Detail;
             db.Symptoms.Find(id).Reason      = obj.Reason;
             db.SaveChanges();
         }
         return(View("AddSymptoms"));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult AddDisease()
        {
            DB50Entities  db       = new DB50Entities();
            List <string> SympName = new List <string>();
            List <int>    SIds     = new List <int>();

            foreach (Symptom d in db.Symptoms)
            {
                if (d.SymptomID != null)
                {
                    SIds.Add(d.SymptomID);
                    SympName.Add(d.SymptomName);
                }
            }
            ViewBag.SName = SympName;
            ViewBag.SIds  = SIds;
            return(View());
        }
        public ActionResult CreatePassword(CreatePassword model)
        {
            DB50Entities db = new DB50Entities();

            foreach (var person in db.Accounts.ToList())
            {
                if (person.Email == model.Email)
                {
                    if (model.NewPassword == model.ConfirmPassword)
                    {
                        person.Password = model.NewPassword;
                        db.Accounts.Find(person.Id).Password = person.Password;
                        db.SaveChanges();
                        return(RedirectToAction("Login", "Account"));
                    }
                }
            }

            return(View());
        }
Example #28
0
        public ActionResult ChangePassword(Password pass)
        {
            DB50Entities db = new DB50Entities();

            foreach (var user in db.Accounts.ToList())
            {
                if (user.Email == Session["Email"].ToString())
                {
                    if (user.Password == pass.OldPassword)
                    {
                        if (pass.NewPassword == pass.ConfirmPassword)
                        {
                            db.Accounts.Find(user.Id).Password = pass.NewPassword;
                            db.SaveChanges();
                            return(RedirectToAction("UserProfile", "Manage"));
                        }
                    }
                }
            }
            return(View());
        }
Example #29
0
        public async Task <ActionResult> Register(Register model)
        {
            string fileName  = Path.GetFileNameWithoutExtension(model.ImageFile.FileName);
            string extension = Path.GetExtension(model.ImageFile.FileName);

            fileName        = fileName + DateTime.Now.ToString("yymmssff") + extension;
            model.ImagePath = "~/img/" + fileName;
            fileName        = Path.Combine(Server.MapPath("~/img/"), fileName);
            model.ImageFile.SaveAs(fileName);
            var ImageFile = model.ImageFile;
            var ImagePath = model.ImagePath;

            DB50Entities dbo     = new DB50Entities();
            Account      account = new Account();

            account.UserName = model.Name;
            account.Email    = model.Email;
            account.Password = model.Password;
            account.Type     = model.type;
            dbo.Accounts.Add(account);
            dbo.SaveChanges();


            Profile profile = new Profile();

            profile.Address         = model.Address;
            profile.ContactNumber   = model.TelephoneNumber;
            profile.Country         = model.Country;
            profile.Email           = model.Email;
            profile.LicenseNumber   = model.LicenseNumber;
            profile.TelephoneNumber = model.TelephoneNumber;
            profile.Type            = model.type;
            profile.ImagePath       = ImagePath;
            dbo.Profiles.Add(profile);
            dbo.SaveChanges();
            return(RedirectToAction("HomePage", "Home"));

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        public ActionResult ForgotPassword(ForgotPasswordViewModel model)
        {
            bool         isValidEmail = false;
            DB50Entities db           = new DB50Entities();

            foreach (var asp in db.Accounts)
            {
                if (asp.Email == model.Email)
                {
                    isValidEmail = true;
                    break;
                }
            }
            if (isValidEmail == true)
            {
                string body;
                body = "Click on the link below to Reset Password \n http://localhost:1192/Manage/CreatePassword";
                SendEmail(model.Email, "Forget Password", body);
                return(RedirectToAction("Login", "Account"));
            }
            return(View());
        }