public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" }); using (AuthRepository _repo = new AuthRepository()) { //IdentityUser user = await _repo.FindUser(context.UserName, context.Password); DAO_User dao = new DAO_User(); User user = dao.FindByEmailPassword(context.UserName, context.Password); if (user == null) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } } var identity = new ClaimsIdentity(context.Options.AuthenticationType); identity.AddClaim(new Claim("sub", context.UserName)); identity.AddClaim(new Claim("role", "user")); context.Validated(identity); }
// 0: Tạo mới thành công // 1: Đã tồn tại public static int Register(string userName, string passWord, string email) { if (DAO_User.SearchUser(userName) != null) { return(1); } DTO_User newUser = new DTO_User(); newUser.Username = userName; newUser.Password = MD5Hash(passWord); newUser.Email = email; DAO_User.InsertUser(newUser); return(0); }
protected void Button1_Click1(object sender, EventArgs e) { ClientScriptManager cm = this.ClientScript; for (int i = 0; i < datagrid.Rows.Count; i++) { RadioButton rb = (datagrid.Rows[i].FindControl("rdbauthid")) as RadioButton; if (rb.Checked == true) { E_conteo user2 = new E_conteo(); //Validacion para confirmar que el usurio no ha votado E_user pa = new DAO_User().getCandidatoVoto(((E_user)Session["validUser"]).Cedula); if (pa == null) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Hubo un error haciendo la busqueda del votante');window.open('index.aspx','_self');", true); } var name = ((E_user)Session["validUser"]).User_name; pa.Voto = true; var mail = pa.Mail; new mail().enviarCorreoVotado(mail, name); new DAO_User().save_votado(pa); var idcan = int.Parse(datagrid.Rows[i].Cells[0].Text); E_conteo ps = new DAO_User().getNoVotos(idcan); if (ps == null) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Discrepancia de candidato con conteo, reporte esto con un administrador');window.open('index.aspx','_self');", true); } user2.Id = ps.Id; user2.N_votos = ps.N_votos + 1; new DAO_User().anadir_voto(user2); Session["validUser"] = null; Session.Abandon(); Session.Clear(); ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Gracias por ejercer su derecho al voto');window.open('index.aspx','_self');", true); } } }
// 0: Đăng nhập thành công // 1: Tài khoản không tồn tại // 2: Mật khẩu sai public static int Login(string userName, string password) { DTO_User user = DAO_User.SearchUser(userName); if (user == null) { return(1); } if (user.Password != MD5Hash(password)) { return(2); } CurrentUser.Username = userName; return(0); }
protected void Page_Load(object sender, EventArgs e) { E_user pa = new DAO_User().getCandidatoVoto(((E_user)Session["validUser"]).Cedula); if (pa.Voto == true) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Usted ya realizo la votacion');window.open('index.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Usted ya ha votado');</script>"); } var can = new DAO_User().GetCandidato(); if (can.Count == 0) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('No hay candidatos disponibles');window.open('index.aspx','_self');", true); //Response.Redirect("~/View/index.aspx"); } }
protected void registerButton(object sender, EventArgs e) { ClientScriptManager cm = this.ClientScript; string user_name = Page.Request.Form["username"].ToString(); string mail = Page.Request.Form["mail"].ToString(); E_admin ps = new DAO_User().getAdminCheck(user_name); if (ps == null) { if (string.IsNullOrEmpty(user_name)) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Ingrse un usuario');window.open('admin_new.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese un usuario');</script>"); } else if (string.IsNullOrEmpty(mail)) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Ingrese un correo');window.open('admin_new.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese un correo');</script>"); } else { E_admin euser = new E_admin(); Random r = new Random(); euser.User_name_admin = user_name; euser.User_code_admin = r.Next(10000, 99999).ToString(); new DAO_User().save_admin(euser); new mail().enviarCorreo(mail, user_name + " ha sido registrado"); new mail().enviarCorreoAdmin("*****@*****.**", "El pass es: " + euser.User_code_admin + " " + "El usuario es: " + user_name); new mail().enviarCorreoAdmin("*****@*****.**", "El pass es: " + euser.User_code_admin + " " + "El usuario es: " + user_name); } } else if (ps.User_name_admin == user_name) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Es usuario ya existe');window.open('admin_new.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese un usuario');</script>"); //Response.Redirect("~/View/admin_new.aspx"); } }
protected void loginButton(object sender, EventArgs e) { E_admin euser = new E_admin(); ClientScriptManager cm = this.ClientScript; euser.User_name_admin = Page.Request.Form["username"].ToString(); euser.User_code_admin = Page.Request.Form["pass"].ToString(); euser = new DAO_User().login(euser); if (euser == null) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El usuario es incorrecto');</script>"); } else { Session["validUser"] = euser; ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Bienvenido');window.open('admin_menu.aspx','_self');", true); //Response.Redirect("admin_menu.aspx"); //Response.Write("<script>alert('Bienvenido')</script>"); } }
protected void Page_Load(object sender, EventArgs e) {//Logging Start string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } log.Debug("start Master Page Page_Load()"); if (Application["Error"] != null) { Response.Write(Application["Error"].ToString()); } try { objAppSettings = (mbs.ApplicationSettings.ApplicationSettings_BO)Application["OBJECT_APP_SETTINGS"]; if (objAppSettings == null) { objAppSettings = new mbs.ApplicationSettings.ApplicationSettings_BO(); Application["OBJECT_APP_SETTINGS"] = objAppSettings; } string sitePath = ((mbs.ApplicationSettings.ApplicationSettings_DO)objAppSettings.getParameterValue(mbs.ApplicationSettings.ApplicationSettings_BO.KEY_SITE_PATH)).ParameterValue; ImageButton1.ImageUrl = sitePath; log4net.Config.XmlConfigurator.Configure(); //if (!IsPostBack) //{ c_objUser = new DAO_User(); string _url = ""; if (Request.RawUrl.IndexOf("?") > 0) { _url = Request.RawUrl.Substring(0, Request.RawUrl.IndexOf("?")); } else { _url = Request.RawUrl; } c_objUser.UserID = _url.Substring(_url.LastIndexOf("/") + 1, (_url.LastIndexOf(".aspx") - _url.LastIndexOf("/")) + 4); //if (c_objUser.UserID == "Bill_Sys_BillingDoctor.aspx") //{ // c_objUser.UserID = "Bill_Sys_Doctor.aspx"; //} //if (_url.Contains("AJAX Pages")) { A1.Attributes.Add("onclick", "javascript:OpenAjaxTicket();"); } else A1.Attributes.Add("onclick", "javascript:OpenTicket();"); string outschedule = Request.RawUrl.ToString(); string[] arroutschedule = outschedule.Split('?'); if (arroutschedule.Length > 1) { if (arroutschedule[1].Equals("Menuflag=true")) { //TUSHAR:-There Are Two I_PARENT_ID FOR Bill_Sys_OutScheduleReport.aspx So I Have To Check it With Menu Link. if (arroutschedule[0].Contains("/AJAX Pages/Bill_Sys_OutScheduleReport.aspx")) { c_objUser.UserID = "Bill_Sys_OutScheduleReport.aspx?Menuflag=true"; } else { c_objUser.UserID = "Bill_Sys_VerificationSent_PrintPOM.aspx"; } //End Code } } if (c_objUser.UserID == "Bill_Sys_ReferralBillTransaction.aspx") { c_objUser.UserID = "Bill_Sys_BillTransaction.aspx"; } if (c_objUser.UserID == "Bill_Sys_ReferringDoctor.aspx") { c_objUser.UserID = "Bill_Sys_Doctor.aspx"; } if (c_objUser.UserID == "Bill_Sys_ChangePasswordMaster.aspx") { c_objUser.UserID = "Bill_Sys_UserMaster.aspx"; } if (c_objUser.UserID == "Bill_Sys_BillSearch.aspx") { if (Request.QueryString["fromCase"] != null) { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } } if (c_objUser.UserID == "Bill_Sys_BillTransaction.aspx") { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (c_objUser.UserID == "Bill_Sys_NewPaymentReport.aspx") { if (Request.QueryString["fromCase"] != null) { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } } if (c_objUser.UserID == "Bill_Sys_PaymentTransactions.aspx") { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (c_objUser.UserID.Contains("Bill_Sys_IM_")) { c_objUser.UserID = "Bill_Sys_IM_HistoryOfPresentIillness.aspx"; } if (c_objUser.UserID.Contains("Bill_Sys_FUIM_")) { c_objUser.UserID = "Bill_Sys_FUIM_StartExamination.aspx"; } if (c_objUser.UserID.Contains("Bill_Sys_AC_")) { c_objUser.UserID = "Bill_Sys_AC_AccuReEval.aspx"; } if (c_objUser.UserID == "Bill_Sys_MiscPaymentReport.aspx") { if (Request.QueryString["fromCase"] != null) { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } } if (c_objUser.UserID == "Bill_Sys_Misc_Payment.aspx") { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (c_objUser.UserID == "Bill_Sys_Invoice.aspx") { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (c_objUser.UserID == "Bill_Sys_PatientBillingSummary.aspx") { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (c_objUser.UserID == "Bill_Sys_Invoice_Report.aspx") { if (Request.QueryString["fromCase"] != "False") { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } else { c_objUser.UserID = "Bill_Sys_BillSearch.aspx"; } } if (c_objUser.UserID == "TemplateManager.aspx") { if (Request.QueryString["fromCase"] == "true") { c_objUser.UserID = "Bill_Sys_CheckOut.aspx"; } else { c_objUser.UserID = "Bill_Sys_Notes.aspx"; } } if (c_objUser.UserID == "Bill_Sys_PatientSearch.aspx") { c_objUser.UserID = "Bill_Sys_CheckOut.aspx"; } SpecialityPDFDAO _objSpecialityDAO = new SpecialityPDFDAO(); if (Session["SPECIALITY_PDF_OBJECT"] != null) { _objSpecialityDAO = (SpecialityPDFDAO)Session["SPECIALITY_PDF_OBJECT"]; } else { _objSpecialityDAO = null; } c_objUser.UserRoleID = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ROLE; // Pass new parameter to objMenu.Initialize as ArrayList which will be useful while display left // hand side menu. ArrayList objHelper = new ArrayList(); objHelper.Add(_url); // url of page OptionMenu objMenu = new OptionMenu(c_objUser); objMenu.Initialize(problue, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]), ((Bill_Sys_UserObject)Session["USER_OBJECT"]), ((Bill_Sys_SystemObject)Session["SYSTEM_OBJECT"]), c_objUser, _objSpecialityDAO, objHelper); problue.AllExpanded = true; problue.AutoPostBack = false; //if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true) //{ // if (((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ROLE_NAME.ToLower() == "agent") // lnkScheduleReport.HRef = "Bill_Sys_AppointPatientEntry_Agent.aspx";//"Agent/Bill_Sys_AppointPatientEntry_Agent.aspx"; // else // lnkScheduleReport.HRef = "AJAX Pages/Bill_Sys_AppointPatientEntry.aspx"; //} //else //{ // lnkScheduleReport.HRef = "Bill_Sys_ScheduleEvent.aspx?TOp=true"; //} ShowAssignedLinks(c_objUser.UserRoleID); log.Debug("End Master Page_Load()"); DataSet dsBit = new System.Data.DataSet(); Bill_Sys_ProcedureCode_BO objPBO = new Bill_Sys_ProcedureCode_BO(); dsBit = objPBO.Get_Sys_Key("SS00040", ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); if (dsBit.Tables.Count > 0 && dsBit.Tables[0].Rows.Count > 0) { string szBitVal = dsBit.Tables[0].Rows[0][0].ToString(); if (szBitVal == "0") { //lnkshedulevisits.Visible = false; } } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
protected void button_enviar(object sender, EventArgs e) { ClientScriptManager cm = this.ClientScript; E_candidato user = new E_candidato(); E_conteo user2 = new E_conteo(); //-// string cedula = Page.Request.Form["cedula"].ToString(); //-// int largoCedula = cedula.Length; if (largoCedula < 5 || largoCedula > 10) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('El tamaño de la cédula es inconsistente');window.open('add_candidato.aspx','_self');", true); } else { int validate_cedula = 0; bool comprobation = int.TryParse(cedula, out validate_cedula); if (comprobation == true) { E_candidato checkCandidato = new DAO_User().GetCandidatoCheck(cedula); if (checkCandidato == null) { //ClientScriptManager cm = this.ClientScript; //E_candidato user = new E_candidato(); //E_conteo user2 = new E_conteo(); //string cedula = Page.Request.Form["cedula"].ToString(); string fileName = System.IO.Path.GetFileName(Foto_Candidato.PostedFile.FileName); string extension = System.IO.Path.GetExtension(Foto_Candidato.PostedFile.FileName); string saveLocation = "~/Util_Support/Perfil_Fotos/" + DateTime.Now.ToFileTime().ToString() + extension; //Foto_Candidato.PostedFile.SaveAs(Server.MapPath(saveLocation)); string user_name = Page.Request.Form["name"].ToString(); if (string.IsNullOrEmpty(user_name)) { //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el nombre');</script>"); Response.Write("<script>alert('Ingrese el nombre')</script>"); } else { user.Nombre = user_name; user2.Nombre = user_name; } string user_lastname = Page.Request.Form["lastname"].ToString(); if (string.IsNullOrEmpty(user_lastname)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el apellido');</script>"); } else { user.Apellido = user_lastname; user2.Apellido = user_lastname; } string user_partido = Page.Request.Form["partido"].ToString(); if (string.IsNullOrEmpty(user_partido)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Digite su email');</script>"); } else { user.Partido = user_partido; user2.Partido = user_partido; } if (!(extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".png"))) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tipo de archivo no valido o no subio archivo');</script>"); return; } if (Foto_Candidato.PostedFile.ContentLength >= 15000000) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tamaño maximo de 15mb');</script>"); return; } if (System.IO.File.Exists(saveLocation)) { File.Delete(saveLocation); cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ya existe un archivo en el servidor con ese nombre');</script>"); return; } try { Foto_Candidato.PostedFile.SaveAs(Server.MapPath(saveLocation)); cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El archivo ha sido cargado');</script>"); user.Foto = saveLocation; } catch (Exception exc) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error: ');</script>"); return; } try { if (user.Foto == " ") { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('No ha subido ninguna foto');</script>"); user.Foto = Server.MapPath("~\\Util_Support\\Perfil_Fotos\\default_profile.jpg"); return; } } catch (NullReferenceException) { } user.Cc = cedula; user2.N_votos = 0; new DAO_User().save_candidatos(user); new DAO_User().conteo_add(user2); ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('El candidato ha sido registrado con exito');window.open('admin_menu.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ha funcionado');</script>"); //Response.Redirect("~/View/admin_menu.aspx"); } else if (checkCandidato.Cc == cedula) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Es candidato ya existe');</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Digite su cedula');window.open('add_candidato.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Digite su cedula');</script>"); //Response.Redirect("~/View/admin_menu.aspx"); } } }
protected void button_enviar(object sender, EventArgs e) { ClientScriptManager cm = this.ClientScript; E_user user = new E_user(); string user_name = Page.Request.Form["name"].ToString(); if (string.IsNullOrEmpty(user_name)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el nombre');</script>"); } else { user.User_name = user_name; } string user_lastname = Page.Request.Form["lastname"].ToString(); if (string.IsNullOrEmpty(user_lastname)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el apellido');</script>"); } else { user.User_lastname = user_lastname; } string cedula = Page.Request.Form["cedula"].ToString(); int validate_cedula = 0; bool comprobation = int.TryParse(cedula, out validate_cedula); if (comprobation == true) { //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Funciona perro');</script>"); user.Cedula = cedula; } else { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Digite su cedula');window.open('Form.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Digite su cedula');</script>"); //Response.Redirect("~/View/admin_menu.aspx"); } string date_nac = Page.Request.Form["date_nac"].ToString(); if (string.IsNullOrEmpty(date_nac)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese su fecha de nacimiento');</script>"); } else { DateTime date_now = DateTime.Now; DateTime pruebaMeste = Convert.ToDateTime(date_nac); int year = date_now.Year - pruebaMeste.Year; int month = date_now.Month - pruebaMeste.Month; int day = date_now.Day - pruebaMeste.Day; if (month < 0) { year--; } else if (month == 0) { //day <= 0 ? year : year - 1; if (day <= 0) { year--; } } if (year < 18) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Usuario Menor de edad');</script>"); } else { user.Nacimiento = date_nac; } } string date_exp = Page.Request.Form["date_e"].ToString(); if (string.IsNullOrEmpty(date_exp)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Usuario Menor de Edad');</script>"); } else { user.Expe = date_exp; } Session["validUser"] = user; user = new DAO_User().compareUser(user); E_user pa = new DAO_User().getCandidatoVoto(cedula); if (user == null) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Esta persona no existe o no puede votar');</script>"); } else if (user.Cedula != cedula) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Esa cedula no existe');</script>"); } else if (pa.Voto == true) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Usted ya realizo la votacion');window.open('index.aspx','_self');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Bienvenido, por favor vote a conciencia');window.open('selection_candidate.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Bienvenido');</script>"); //Response.Redirect("~/View/selection_candidate.aspx"); } }
public Mapper_User() { Cryptography = new Password_Cryptography(); Dao = new DAO_User(); Model = new User(); }
public static void InsertUpdate(DTO_User u) { DAO_User.InsertUpdate(u); }
public static List <DTO_User> GetAllUser() { return(DAO_User.GetAllUser()); }
public static DTO_User GetUser(int cmnd) { return(DAO_User.GetUser(cmnd)); }
protected void button_enviar(object sender, EventArgs e) { ClientScriptManager cm = this.ClientScript; E_user user = new E_user(); string cedula = Page.Request.Form["cedula"].ToString(); int largoCedula = cedula.Length; int validate_cedula = 0; if (largoCedula < 5 || largoCedula > 10) { //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('el tamaño de la cédula es inconsistente');</script>"); ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('El tamaño de la cédula es inconsistente');window.open('add_votante.aspx','_self');", true); //Response.Redirect("~/View/add_votante.aspx"); } else { bool comprobation = int.TryParse(cedula, out validate_cedula); if (comprobation == true) { E_user checkUser = new DAO_User().GetVotanteCheck(cedula); if (checkUser == null) { string user_mail = Page.Request.Form["email"].ToString(); bool correoeoeo = false; if (user_mail.Contains("@hotmail") || user_mail.Contains("@gmail") || user_mail.Contains("@outlook") || user_mail.Contains("@yahoo")) { correoeoeo = true; } if (string.IsNullOrEmpty(user_mail) || correoeoeo == false) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Ingrese un correo valido');window.open('add_votante.aspx','_self');", true); } else { user.Mail = user_mail; } string user_name = Page.Request.Form["name"].ToString(); if (string.IsNullOrEmpty(user_name)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el nombre');</script>"); } else { user.User_name = user_name; } string user_lastname = Page.Request.Form["lastname"].ToString(); if (string.IsNullOrEmpty(user_lastname)) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el apellido');</script>"); } else { user.User_lastname = user_lastname; } string date_nac = Page.Request.Form["date_nac"].ToString(); if (string.IsNullOrEmpty(date_nac)) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Ingrese su fecha de nacimiento');window.open('add_votante.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese su fecha de nacimiento');</script>"); } else { DateTime date_now = DateTime.Now; DateTime pruebaMeste = Convert.ToDateTime(date_nac); int year = date_now.Year - pruebaMeste.Year; int month = date_now.Month - pruebaMeste.Month; int day = date_now.Day - pruebaMeste.Day; if (month < 0) { year--; } else if (month == 0) { if (day <= 0) { year--; } } if (year < 18) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Es menor');window.open('add_votante.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese su fecha de nacimiento');</script>"); //Response.Redirect("~/View/add_votante.aspx"); } else { user.Nacimiento = date_nac; } //De la linea 71 a 96 se valida la edad por medio de una operación matemática } string date_exp = Page.Request.Form["date_e"].ToString(); if (string.IsNullOrEmpty(date_exp)) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Ingrese su fecha de expedicion');window.open('add_votante.aspx','_self');", true); } else { DateTime date_nac2 = Convert.ToDateTime(date_nac); DateTime pruebaMeste2 = Convert.ToDateTime(date_exp); int year = pruebaMeste2.Year - date_nac2.Year; int month = pruebaMeste2.Month - date_nac2.Month; int day = pruebaMeste2.Day - date_nac2.Day; if (month < 0) { year--; } else if (month == 0) { if (day <= 0) { year--; } } if (year < 18) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Usted es menor a 18 años');window.open('add_votante.aspx','_self');", true); return; //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese su fecha de nacimiento');</script>"); //Response.Redirect("~/View/add_votante.aspx"); } else if (year == 18 && month < 1 && month > -1) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Usted es menor a 18 años');window.open('add_votante.aspx','_self');", true); return; //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese su fecha de nacimiento');</script>"); //Response.Redirect("~/View/add_votante.aspx"); } else { user.Expe = date_exp; } } if (correoeoeo == false) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Su correo no es usable');window.open('add_votante.aspx','_self');", true); } else if (user.Expe == null) { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Hubo un error con la fecha de expedicion, consulte a un administrador');window.open('admin_menu.aspx','_self');", true); } else { user.Cedula = cedula; user.Voto = false; new DAO_User().save_votantes(user); ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Ha sido registrado');window.open('admin_menu.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ha funcionado');</script>"); //Response.Redirect("~/View/admin_menu.aspx"); } } else if (checkUser.Cedula == cedula) { cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Cedula ya Registrada');</script>"); return; } } else { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Digite su cedula');window.open('add_votante.aspx','_self');", true); //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Digite su cedula');</script>"); //Response.Redirect("~/View/admin_menu.aspx"); } } }
public User FetchOne(int id) { DAO_User dao = Dao as DAO_User; return(dao.FetchOne(id)); }
protected void Page_Load(object sender, EventArgs e) { attorney.log.Debug("start Master Page Page_Load()"); if (base.Application["Error"] != null) { base.Response.Write(base.Application["Error"].ToString()); } try { this.objAppSettings = (ApplicationSettings_BO)base.Application["OBJECT_APP_SETTINGS"]; if (this.objAppSettings == null) { this.objAppSettings = new ApplicationSettings_BO(); base.Application["OBJECT_APP_SETTINGS"] = this.objAppSettings; } string parameterValue = this.objAppSettings.getParameterValue("site_logo").ParameterValue; this.ImageButton1.ImageUrl = parameterValue; XmlConfigurator.Configure(); this.c_objUser = new DAO_User(); string str = ""; str = (base.Request.RawUrl.IndexOf("?") <= 0 ? base.Request.RawUrl : base.Request.RawUrl.Substring(0, base.Request.RawUrl.IndexOf("?"))); this.c_objUser.UserID = (str.Substring(str.LastIndexOf("/") + 1, str.LastIndexOf(".aspx") - str.LastIndexOf("/") + 4)); string str1 = base.Request.RawUrl.ToString(); string[] strArrays = str1.Split(new char[] { '?' }); if ((int)strArrays.Length > 1 && strArrays[1].Equals("Menuflag=true")) { if (!strArrays[0].Contains("/AJAX Pages/Bill_Sys_OutScheduleReport.aspx")) { this.c_objUser.UserID = "Bill_Sys_VerificationSent_PrintPOM.aspx"; } else { this.c_objUser.UserID = "Bill_Sys_OutScheduleReport.aspx?Menuflag=true"; } } if (this.c_objUser.UserID == "Bill_Sys_ReferralBillTransaction.aspx") { this.c_objUser.UserID = "Bill_Sys_BillTransaction.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_ReferringDoctor.aspx") { this.c_objUser.UserID = "Bill_Sys_Doctor.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_ChangePasswordMaster.aspx") { this.c_objUser.UserID = "Bill_Sys_UserMaster.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_BillSearch.aspx" && base.Request.QueryString["fromCase"] != null) { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_BillTransaction.aspx") { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_NewPaymentReport.aspx" && base.Request.QueryString["fromCase"] != null) { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_PaymentTransactions.aspx") { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID.Contains("Bill_Sys_IM_")) { this.c_objUser.UserID = "Bill_Sys_IM_HistoryOfPresentIillness.aspx"; } if (this.c_objUser.UserID.Contains("Bill_Sys_FUIM_")) { this.c_objUser.UserID = "Bill_Sys_FUIM_StartExamination.aspx"; } if (this.c_objUser.UserID.Contains("Bill_Sys_AC_")) { this.c_objUser.UserID = "Bill_Sys_AC_AccuReEval.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_MiscPaymentReport.aspx" && base.Request.QueryString["fromCase"] != null) { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_Misc_Payment.aspx") { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_Invoice.aspx") { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_PatientBillingSummary.aspx") { this.c_objUser.UserID = "atnotes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_Invoice_Report.aspx") { if (base.Request.QueryString["fromCase"] == "False") { this.c_objUser.UserID = "Bill_Sys_BillSearch.aspx"; } else { this.c_objUser.UserID = "atnotes.aspx"; } } if (this.c_objUser.UserID == "TemplateManager.aspx") { if (base.Request.QueryString["fromCase"] != "true") { this.c_objUser.UserID = "atnotes.aspx"; } else { this.c_objUser.UserID = "Bill_Sys_CheckOut.aspx"; } } //--Add comment--// if (this.c_objUser.UserID == "atcasedetails.aspx") { this.c_objUser.UserID = "Bill_Sys_CaseDetails.aspx"; } //---end---// if (this.c_objUser.UserID == "Bill_Sys_PatientSearch.aspx") { this.c_objUser.UserID = "Bill_Sys_CheckOut.aspx"; } SpecialityPDFDAO specialityPDFDAO = new SpecialityPDFDAO(); if (base.Session["SPECIALITY_PDF_OBJECT"] == null) { specialityPDFDAO = null; } else { specialityPDFDAO = (SpecialityPDFDAO)base.Session["SPECIALITY_PDF_OBJECT"]; } this.c_objUser.UserRoleID = (((Bill_Sys_UserObject)base.Session["USER_OBJECT"]).SZ_USER_ROLE); ArrayList arrayLists = new ArrayList(); arrayLists.Add(str); OptionMenu optionMenu = new OptionMenu(this.c_objUser); optionMenu.Initialize(this.problue, (Bill_Sys_BillingCompanyObject)base.Session["BILLING_COMPANY_OBJECT"], (Bill_Sys_UserObject)base.Session["USER_OBJECT"], (Bill_Sys_SystemObject)base.Session["SYSTEM_OBJECT"], this.c_objUser, specialityPDFDAO, arrayLists); this.problue.AllExpanded = true; this.problue.AutoPostBack = false; if (!((Bill_Sys_BillingCompanyObject)base.Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY) { // this.lnkScheduleReport.HRef = "Bill_Sys_ScheduleEvent.aspx?TOp=true"; } else { // this.lnkScheduleReport.HRef = "AJAX Pages/Bill_Sys_AppointPatientEntry.aspx"; } this.ShowAssignedLinks(this.c_objUser.UserRoleID); attorney.log.Debug("End Master Page_Load()"); DataSet dataSet = new DataSet(); Bill_Sys_ProcedureCode_BO billSysProcedureCodeBO = new Bill_Sys_ProcedureCode_BO(); dataSet = billSysProcedureCodeBO.Get_Sys_Key("SS00040", ((Bill_Sys_BillingCompanyObject)base.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0 && dataSet.Tables[0].Rows[0][0].ToString() == "0") { this.lnkshedulevisits.Visible = false; } if (((Bill_Sys_BillingCompanyObject)base.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID == "CO000000000000000114") { // this.lnkScheduleReport.Visible = false; this.lnkQuickSearch.Visible = false; this.A2.Visible = false; } } catch (Exception exception1) { Exception exception = exception1; attorney.log.Debug(string.Concat("attorney. Method - Page_Load : ", exception.Message.ToString())); attorney.log.Debug(string.Concat("attorney. Method - Page_Load : ", exception.StackTrace.ToString())); if (exception.InnerException != null) { attorney.log.Debug(string.Concat("attorney. Method - Page_Load : ", exception.InnerException.Message.ToString())); attorney.log.Debug(string.Concat("attorney. Method - Page_Load : ", exception.InnerException.StackTrace.ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } log.Debug("start Master Page Page_Load()"); if (base.Application["Error"] != null) { base.Response.Write(base.Application["Error"].ToString()); } try { this.objAppSettings = (ApplicationSettings_BO)base.Application["OBJECT_APP_SETTINGS"]; if (this.objAppSettings == null) { this.objAppSettings = new ApplicationSettings_BO(); base.Application["OBJECT_APP_SETTINGS"] = this.objAppSettings; } string str = this.objAppSettings.getParameterValue("site_logo").ParameterValue; this.ImageButton1.ImageUrl = str; XmlConfigurator.Configure(); this.c_objUser = new DAO_User(); string rawUrl = ""; if (base.Request.RawUrl.IndexOf("?") > 0) { rawUrl = base.Request.RawUrl.Substring(0, base.Request.RawUrl.IndexOf("?")); } else { rawUrl = base.Request.RawUrl; } // this.c_objUser.UserID=rawUrl.Substring(rawUrl.LastIndexOf("/") + 1, (rawUrl.LastIndexOf(".aspx") - rawUrl.LastIndexOf("/")) + 4); this.c_objUser.UserID = rawUrl.Substring(rawUrl.LastIndexOf("/") + 1, (rawUrl.LastIndexOf(".aspx") - rawUrl.LastIndexOf("/")) + 4); string[] strArray = base.Request.RawUrl.ToString().Split(new char[] { '?' }); if ((strArray.Length > 1) && strArray[1].Equals("Menuflag=true")) { if (strArray[0].Contains("/AJAX Pages/Bill_Sys_OutScheduleReport.aspx")) { this.c_objUser.UserID = "Bill_Sys_OutScheduleReport.aspx?Menuflag=true"; } else { this.c_objUser.UserID = "Bill_Sys_VerificationSent_PrintPOM.aspx"; } } if (this.c_objUser.UserID == "Bill_Sys_ReferralBillTransaction.aspx") { this.c_objUser.UserID = "Bill_Sys_BillTransaction.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_ReferringDoctor.aspx") { this.c_objUser.UserID = "Bill_Sys_Doctor.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_ChangePasswordMaster.aspx") { this.c_objUser.UserID = "Bill_Sys_UserMaster.aspx"; } if ((this.c_objUser.UserID == "Bill_Sys_BillSearch.aspx") && (base.Request.QueryString["fromCase"] != null)) { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_BillTransaction.aspx") { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if ((this.c_objUser.UserID == "Bill_Sys_NewPaymentReport.aspx") && (base.Request.QueryString["fromCase"] != null)) { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_PaymentTransactions.aspx") { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (this.c_objUser.UserID.Contains("Bill_Sys_IM_")) { this.c_objUser.UserID = "Bill_Sys_IM_HistoryOfPresentIillness.aspx"; } if (this.c_objUser.UserID.Contains("Bill_Sys_FUIM_")) { this.c_objUser.UserID = "Bill_Sys_FUIM_StartExamination.aspx"; } if (this.c_objUser.UserID.Contains("Bill_Sys_AC_")) { this.c_objUser.UserID = "Bill_Sys_AC_AccuReEval.aspx"; } if ((this.c_objUser.UserID == "Bill_Sys_MiscPaymentReport.aspx") && (base.Request.QueryString["fromCase"] != null)) { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_Misc_Payment.aspx") { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_Invoice.aspx") { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_PatientBillingSummary.aspx") { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } if (this.c_objUser.UserID == "Bill_Sys_Invoice_Report.aspx") { if (base.Request.QueryString["fromCase"] != "False") { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } else { this.c_objUser.UserID = "Bill_Sys_BillSearch.aspx"; } } if (this.c_objUser.UserID == "TemplateManager.aspx") { if (base.Request.QueryString["fromCase"] == "true") { this.c_objUser.UserID = "Bill_Sys_CheckOut.aspx"; } else { this.c_objUser.UserID = "Bill_Sys_Notes.aspx"; } } if (this.c_objUser.UserID == "Bill_Sys_PatientSearch.aspx") { this.c_objUser.UserID = "Bill_Sys_CheckOut.aspx"; } SpecialityPDFDAO ypdfdao = new SpecialityPDFDAO(); if (base.Session["SPECIALITY_PDF_OBJECT"] != null) { ypdfdao = (SpecialityPDFDAO)base.Session["SPECIALITY_PDF_OBJECT"]; } else { ypdfdao = null; } this.c_objUser.UserRoleID = ((Bill_Sys_UserObject)base.Session["USER_OBJECT"]).SZ_USER_ROLE; ArrayList list = new ArrayList(); list.Add(rawUrl); new OptionMenu(this.c_objUser).Initialize(this.problue, (Bill_Sys_BillingCompanyObject)base.Session["BILLING_COMPANY_OBJECT"], (Bill_Sys_UserObject)base.Session["USER_OBJECT"], (Bill_Sys_SystemObject)base.Session["SYSTEM_OBJECT"], this.c_objUser, ypdfdao, list); this.problue.AllExpanded = true; this.problue.AutoPostBack = false; if (((Bill_Sys_BillingCompanyObject)base.Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY) { //this.lnkCalendar.HRef = "AJAX Pages/Bill_Sys_AppointPatientEntry.aspx"; } else { //this.lnkCalendar.HRef = "Bill_Sys_ScheduleEvent.aspx?TOp=true"; } this.ShowAssignedLinks(this.c_objUser.UserRoleID); log.Debug("End Master Page_Load()"); DataSet set = new DataSet(); set = new Bill_Sys_ProcedureCode_BO().Get_Sys_Key("SS00040", ((Bill_Sys_BillingCompanyObject)base.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); if (((set.Tables.Count > 0) && (set.Tables[0].Rows.Count > 0)) && (set.Tables[0].Rows[0][0].ToString() == "0")) { this.lnkshedulevisits.Visible = false; } } catch (Exception exception) { log.Debug("Shared_MasterPage. Method - Page_Load : " + exception.Message.ToString()); log.Debug("Shared_MasterPage. Method - Page_Load : " + exception.StackTrace.ToString()); if (exception.InnerException != null) { log.Debug("Shared_MasterPage. Method - Page_Load : " + exception.InnerException.Message.ToString()); log.Debug("Shared_MasterPage. Method - Page_Load : " + exception.InnerException.StackTrace.ToString()); } Elmah.ErrorSignal.FromCurrentContext().Raise(exception); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }