コード例 #1
0
        public ActionResult Login(TBL_USER_D user)
        {
            PathologyEntities db = new PathologyEntities();
            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.org == "admin")
                {
                    FormsAuthentication.SetAuthCookie(usr.USER_NAME, false);
                    return(RedirectToAction("Index", "Home", new { user = user.USER_NAME }));
                }
                else if (usr.USER_NAME == "st")
                {
                    FormsAuthentication.SetAuthCookie(usr.USER_NAME.ToString(), 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());
            }
        }
コード例 #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 (PathologyEntities entities = new PathologyEntities())
            {
                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));
        }