1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| protected void Button_LogIn_Click(object sender, EventArgs e)
{
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Data Source=vdw-nexfi-004;Persist Security Info=True;User ID=gao_s;Password=***********"].ToString()))
{
try
{
SqlCommand cmd = new SqlCommand("select Role from Table_Login where login_windows='" + this.TextBox_LogIn.Text + "'", cn);
cn.Open();
SqlDataReader sdr = cmd.ExecuteReader();
switch (sdr["Role"].ToString())
{
case "G": Response.Redirect("ShowGerant.aspx"); break;
case "A": Response.Redirect("ShowAnalyste.aspx"); break;
case "T": Response.Redirect("ShowTrader.aspx"); break;
case "CO": Response.Redirect("ShowCompliance.aspx"); break;
case "CFO": Response.Redirect("ShowCFO.aspx"); break;
case "IT": Response.Redirect("ShowIT.aspx"); break;
case "AG": Response.Redirect("ShowAssistantGestion.aspx"); break;
case "RT": Response.Redirect("ShowResponsableTrader.aspx"); break;
default: Response.Write("Le log in est incorrect,Veuillez réessayer!"); break;
}
}
catch (System.Exception ee)
{
Response.Write(ee.Message.ToString());
}
finally
{
cn.Close();
}
}
} |
Partager