Esempio n. 1
0
        public ActionResult Login(TBL_USER_D user)
        {
            PathologyEntities1 db = new PathologyEntities1();

            var usr = db.TBL_USER_D.SingleOrDefault(x => x.USER_NAME == user.USER_NAME && x.USER_PASSWORD == user.USER_PASSWORD);

            if (usr != null)
            {
                if (usr.MAG_ACT == 1)
                {
                    FormsAuthentication.SetAuthCookie(usr.USER_NAME, false);
                    return(RedirectToAction("AdminDashboard", "Home", new { user = user.USER_NAME }));
                }
                else if (usr.MAG_ACT == 2)
                {
                    FormsAuthentication.SetAuthCookie(usr.USER_NAME, false);
                    return(RedirectToAction("StudentDashBaord", "Home"));
                }
                else
                {
                    FormsAuthentication.SetAuthCookie(usr.USER_NAME, false);
                    return(RedirectToAction("staffDashboard", "Home", new { id = usr.USER_NAME }));
                }
            }
            else
            {
                ViewBag.triedOnce = "yes";
                return(View());
            }
        }
Esempio n. 2
0
        public ActionResult reporting(int sub, string id)
        {
            LocalReport lr   = new LocalReport();
            String      path = Path.Combine(Server.MapPath("~/Report"), "Report_Patient.rdlc");

            if (System.IO.File.Exists(path))
            {
                lr.ReportPath = path;
            }
            else
            {
                return(View("index"));
            }
            List <View_Visit> att = new List <View_Visit>();

            using (PathologyEntities1 entities = new PathologyEntities1())
            {
                att = entities.View_Visit.Where(a => a.R_ID == sub).ToList();
            }
            ReportDataSource rds = new ReportDataSource("DataSet1", att);

            lr.DataSources.Add(rds);
            string reporttype = id;
            string minetype;
            string encoding;
            string filenameextension = id;
            string deviceinfo        =
                "<DeviceInfo>" +
                "<OutputFormat>DD</OutputFormat>" +
                "<PageWidth>8.5in</PageWidth>" +
                "<PageHeight>11in</PageHeight>" +
                "<MarginTop>0.5in</MarginTop>" +
                "<MarginLeft>11in</MarginLeft>" +
                "<MarginRight>11in</MarginRight>" +
                "<MarginBottom>0.5in</MarginBottom>" +
                "</DeviceInfo>";

            Warning[] warning;
            string[]  stream;
            byte[]    renderedbytes;
            renderedbytes = lr.Render("PDF", deviceinfo, out minetype, out encoding, out filenameextension, out stream, out warning);
            return(File(renderedbytes, minetype));
        }