public ActionResult LogOn() { string username = Request.QueryString["username"]; string otp = Request.QueryString["password"]; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(otp)) { return(View()); } else { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { DateTime dateNow = Utility.GetServerDateTime(); mst_user_otp mdo = cdc.mst_user_otps.Where(x => x.mst_user_type.mut_username == username).FirstOrDefault(); if (mdo != null && mdo.mut_otp == otp && mdo.mut_expire >= dateNow) { mdo.mut_expire = dateNow; cdc.SubmitChanges(); Session["username"] = username; return(RedirectToAction("PatientSearch", "BookViewer")); } else { return(View(new LogOnModel() { strMsg = "Invalid Log in. Please try again." })); } } } }
private void linkApproveToolStripMenuItem_Click(object sender, EventArgs e) { if (Program.CurrentUser.mut_type == 'D') { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { string urlDoctorApprove = cdc.mst_project_configs.Where(x => x.mpc_code == "urlDoctorApprove").Select(x => x.mpc_value).FirstOrDefault(); string OTP = new RandomCls.RandomAlphanumeric().RandomString(20); mst_user_otp mdo = cdc.mst_user_otps.Where(x => x.mut_id == Program.CurrentUser.mut_id).FirstOrDefault(); if (mdo == null) { mdo = new mst_user_otp(); mdo.mut_id = Program.CurrentUser.mut_id; cdc.mst_user_otps.InsertOnSubmit(mdo); } mdo.mut_otp = OTP; mdo.mut_expire = Program.GetServerDateTime().AddMinutes(10); cdc.SubmitChanges(); string url = string.Format(urlDoctorApprove, Program.CurrentUser.mut_username, OTP); Program.OpenLink(url); } } }