Ejemplo n.º 1
0
 protected ServiceBase(MedContext dbContext, UserManager <User> userManager, RoleManager <IdentityRole> roleManager, SignInManager <User> signInManager)
 {
     DbContext     = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     UserManager   = userManager ?? throw new ArgumentNullException(nameof(userManager));
     RoleManager   = roleManager ?? throw new ArgumentNullException(nameof(roleManager));
     SignInManager = signInManager ?? throw new ArgumentNullException(nameof(signInManager));
     Mapper        = new Mapper(new MapperConfiguration(cfg => cfg.AddProfile <AutoMapperProfile>()));
 }
Ejemplo n.º 2
0
        public void Count_Starts_At_Zero()
        {
            var db        = new MedContext();
            var underTest = new IRepository(db);

            var count = underTest.Count();

            Assert.Equal(1, count);
        }
Ejemplo n.º 3
0
        public ActionResult MedicineSearch()
        {
            ViewBag.MedicineSearch = "active";
            List <MedicineInformation> info;

            using (var ctx = new MedContext())
            {
                info = ctx.MedicineInformations.ToList();
            }
            return(View(info));
        }
Ejemplo n.º 4
0
 public ActionResult Contact(Contact contact)
 {
     ViewBag.Contact = "active";
     using (var ctx = new MedContext())
     {
         ctx.ContactInfo.Add(contact);
         ctx.SaveChanges();
     }
     ViewBag.Yes = '1';
     return(View());
 }
        public ActionResult Notification()
        {
            ViewBag.Notification = "active";
            List <Contact> noti = new List <Contact>();

            using (var db = new MedContext())
            {
                noti = db.ContactInfo.ToList();
            }

            return(View(noti));
        }
        public ActionResult CustomerOrderList()
        {
            ViewBag.CustomerOrderList = "active";
            List <OrderList> noti = new List <OrderList>();

            using (var db = new MedContext())
            {
                noti = db.Orderinfo.ToList();
            }

            return(View(noti));
        }
Ejemplo n.º 7
0
        //suggetion
        public ActionResult MedicineSuggestion()
        {
            ViewBag.MedicineSuggestion = "active";
            List <Problems> pro = new List <Problems>();

            using (var ctx = new MedContext())
            {
                pro = ctx.Problemses.ToList();
                ViewBag.Problems = pro;
            }

            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult AddMedicine(PharmacyMedicine medicine)
        {
            ViewBag.AddMedicine = "active";
            int id = Convert.ToInt32(Session["PharmacyId"]);

            using (var ctx = new MedContext())
            {
                medicine.PharmacyId = id;
                ctx.PharmacyMedicines.Add(medicine);
                ctx.SaveChanges();
            }
            ViewBag.Yes = '1';
            return(View());
        }
Ejemplo n.º 9
0
        public ActionResult Order(OrderList orderList)
        {
            string a = (orderList.MedicineAmount * Convert.ToInt32(orderList.Price)).ToString();

            ViewBag.Order = "active";
            using (var ctx = new MedContext())
            {
                orderList.TotalPrice = a + " " + "BDT";
                ctx.Orderinfo.Add(orderList);
                ctx.SaveChanges();
            }
            ViewBag.Yes = '1';
            return(View());
        }
        public ActionResult Graph(string dt)
        {
            string ll = dt + "/01/20";
            string hl = dt + "/31/20";

            int[] ar = new int[32];
            for (int i = 1; i <= 31; i++)
            {
                ar[i] = 0;
            }



            using (var ctx = new MedContext())
            {
                string sql = "SELECT Count(a.Id) as val,a.Date FROM OrderLists as a " +
                             "WHERE a.Date>='" + ll + "' AND a.Date<='" + hl + "' GROUP BY a.Date";
                SqlConnection cn      = new SqlConnection(ctx.Database.Connection.ConnectionString);
                SqlCommand    command = new SqlCommand(sql, cn);

                cn.Open();


                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        int    a  = Convert.ToInt32(reader["val"]);
                        string b  = reader["Date"].ToString();
                        string kl = b[3].ToString() + b[4].ToString();
                        int    dd = Convert.ToInt32(kl);
                        ar[dd - 1] = a;
                    }
                }
                cn.Close();
            }

            string dataStr = JsonConvert.SerializeObject(ar, Formatting.None);

            ViewBag.Data = dataStr;
            ViewBag.mon  = dt;
            return(View());
        }
Ejemplo n.º 11
0
        public ActionResult Profile()
        {
            ViewBag.Profile = "active";
            Register pharmacyuser = new Register();
            int      pharmacyid   = Convert.ToInt32(Session["PharmacyId"]);

            using (var db = new MedContext())
            {
                var u = db.Registers.Where(k => k.Id == pharmacyid).Select(c => new { c.PharmacyName, c.Address, c.PhoneNo });
                foreach (var j in u)
                {
                    pharmacyuser.PharmacyName = security.Decrypt(j.PharmacyName);
                    pharmacyuser.Address      = security.Decrypt(j.Address);

                    pharmacyuser.PhoneNo = security.Decrypt(j.PhoneNo);
                }
                ViewBag.Patient = pharmacyuser;
                return(View());
            }
        }
Ejemplo n.º 12
0
        public ActionResult Update(Register pharmacyuser)
        {
            int    id        = Convert.ToInt32(Session["PharmacyId"]);
            string useremail = security.Encrypt(pharmacyuser.Email);

            using (var db = new MedContext())
            {
                Register pa = db.Registers.Single(e => e.Id == id);
                if (pa.Email == useremail)
                {
                    pa.PharmacyName = security.Encrypt(pharmacyuser.PharmacyName);
                    pa.Address      = security.Encrypt(pharmacyuser.Address);
                    pa.PhoneNo      = security.Encrypt(pharmacyuser.PhoneNo);
                    db.SaveChanges();
                    return(RedirectToAction("Profile", "Medicine"));
                }

                return(RedirectToAction("Profile", "Medicine"));
            }
        }
Ejemplo n.º 13
0
 public ActionResult Registration(Register register)
 {
     using (var db = new MedContext())
     {
         register.Email = security.Encrypt(register.Email);
         var e = db.Registers.Where(c => c.Email == register.Email).ToList().Count;
         if (e == 0)
         {
             register.Password     = EncodePassword(register.Password);
             register.PharmacyName = security.Encrypt(register.PharmacyName);
             register.Address      = security.Encrypt(register.Address);
             register.PhoneNo      = security.Encrypt(register.PhoneNo);
             db.Registers.Add(register);
             db.SaveChanges();
         }
         else
         {
             ViewBag.Error = "Already Registered";
         }
     }
     ViewBag.Yes = '1';
     return(View());
 }
Ejemplo n.º 14
0
        public ActionResult AdminLogin(Admin admin)
        {
            string password = EncodePassword(admin.Password);
            string email    = security.Encrypt(admin.Email);

            using (var ctx = new MedContext())
            {
                var p = ctx.Admins.Where(c => c.Email == email && c.Password == password).Select(c => new { c.Id, c.Email }).ToList();
                if (p.Any())
                {
                    foreach (var k in p)
                    {
                        Session["AdminId"]    = k.Id;
                        Session["AdminEmail"] = k.Email;
                    }
                    return(RedirectToAction("HomeIndex", "Medicine"));
                }
                else
                {
                    ViewBag.Error = "Login Failed";
                }
            }
            return(View());
        }
Ejemplo n.º 15
0
 public DoctorFacilityService(MedContext dbContext, UserManager <User> userManager, RoleManager <IdentityRole> roleManager, SignInManager <User> signInManager) : base(dbContext, userManager, roleManager, signInManager)
 {
 }
Ejemplo n.º 16
0
 public CategoryController(MedContext context)
 {
     _context = context;
 }
 public LoginController(MedContext context)
 {
     _context = context;
 }
Ejemplo n.º 18
0
 public AdminQualificationService(MedContext dbContext, UserManager <User> userManager, RoleManager <IdentityRole> roleManager, SignInManager <User> signInManager) : base(dbContext, userManager, roleManager, signInManager)
 {
 }
Ejemplo n.º 19
0
 public MedicineController(MedContext context, IWebHostEnvironment env)
 {
     _context = context;
     _env     = env;
 }
Ejemplo n.º 20
0
 public AdminFacilityService(MedContext dbContext, UserManager <User> userManager, RoleManager <IdentityRole> roleManager, SignInManager <User> signInManager, IServerNewsService newsService) : base(dbContext, userManager, roleManager, signInManager) => this.newsService = newsService;
Ejemplo n.º 21
0
 public IRepository(MedContext db)
 {
     this.db = db;
 }
Ejemplo n.º 22
0
 public OrderController(MedContext context)
 {
     _context = context;
 }
 public ServerVisitStatusService(MedContext dbContext, UserManager <User> userManager, RoleManager <IdentityRole> roleManager, SignInManager <User> signInManager) : base(dbContext, userManager, roleManager, signInManager)
 {
 }
Ejemplo n.º 24
0
 public PatientRegController(MedContext context)
 {
     _context = context;
 }
Ejemplo n.º 25
0
 public DoctorController(MedContext context)
 {
     _context = context;
 }
 public StateController(MedContext context)
 {
     _context = context;
 }
 public PatCareerController(MedContext context)
 {
     _context = context;
 }
Ejemplo n.º 28
0
 public AboutUsController(MedContext context)
 {
     _context = context;
 }
Ejemplo n.º 29
0
 public HomeController(MedContext Db)
 {
     _Db = Db;
 }
 public PatMedicineController(MedContext context1)
 {
     // _context = context;
     _context1 = context1;
 }