protected void login_Click(object sender, EventArgs e) { if (Verify()) { Entities.UserSystem oUser = (Entities.UserSystem)BLL.UserSystemBLL.getInstance().verify_User(txtUser.Text, txtPassword.Text); if (oUser.code == 0) { lblMessage.Text = "Nombre deusuario o Contraseña incorrectas"; } else { Session["User"] = oUser; addPermission(oUser.oRole.Role_Id); if (oUser.oProgram.code != 1) { getPeriod(); modalperiod(); if (oUser.setPassword == "0") { modalPassword(); } } else { Response.Redirect("index.aspx"); } } } else { lblMessage.Text = "Debe agregar la información correctamente"; } }
} // getNextCode End //Insert public Int32 insert(Entities.UserSystem oUser) { Encrypt en = new Encrypt(); String oSql = "SP_INSERTUSERSYSTEM"; try { SqlCommand oCommand = new SqlCommand(oSql); oCommand.CommandType = CommandType.StoredProcedure; oCommand.Parameters.AddWithValue("@USERSYSTEM_ID", oUser.code); oCommand.Parameters[0].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@ID", oUser.id); oCommand.Parameters[1].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@NAME", oUser.name); oCommand.Parameters[2].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@SURNAME", oUser.lastName); oCommand.Parameters[3].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@PHONE", oUser.homePhone); oCommand.Parameters[4].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@CELLPHONE", oUser.cellPhone); oCommand.Parameters[5].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@MAIL", oUser.email); oCommand.Parameters[6].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@PASSWORD", en.Encriptar(oUser.Password)); oCommand.Parameters[7].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@ROLE_ID", oUser.oRole.Role_Id); oCommand.Parameters[8].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@PROGRAM_ID", oUser.oProgram.code); oCommand.Parameters[9].Direction = ParameterDirection.Input; oCommand.Parameters.AddWithValue("@STATE", oUser.state); oCommand.Parameters[10].Direction = ParameterDirection.Input; return(DAO.getInstance().executeSQL(oCommand)); } catch (Exception ex) { throw ex; } finally { } } //Insert end