コード例 #1
0
 /// <summary>
 /// Name:BtnSubmit_Click
 /// Description:If User Id and password is correct then redirected to  welcome.aspx page.
 /// Author:Monal Shah
 /// created date:2010/11/19
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     dtUsers = new DataTable();
     try
     {
         objcl.GetSqlStmt = objcl.SelectQuery("TblLogin", "UserId", TxtName.Text, "PasswordValue", TxtPwd.Text);
         dtUsers          = objcl.DataTables();
         if (dtUsers.Rows.Count > 0)
         {
             if (dtUsers.Rows[0]["UserId"].ToString() == TxtName.Text && dtUsers.Rows[0]["PasswordValue"].ToString() == TxtPwd.Text)
             {
                 Response.Redirect("Welcome.aspx?id=" + TxtName.Text + "," + QuerystringValue, false);
             }
         }
         else
         {
             LblMsg.Visible = true;
             LblMsg.Text    = (string)GetGlobalResourceObject(QuerystringValue, "LblMsg");
         }
     }
     catch (Exception)
     { Response.Redirect("Error.aspx", false); }
     finally
     {
         dtUsers.Dispose();
         objcl = null;
     }
 }
コード例 #2
0
 /// <summary>
 /// Name:BtnSubmit_Click
 /// Description:If User Id and password is correct then redirected to  welcome.aspx page.
 /// Author:Monal Shah
 /// created date:2010/11/22
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     lang    = Convert.ToString(Session["Culture"]);
     dtUsers = new DataTable();
     if (lang == "en-US")
     {
         lang = "English.ResourceFile";
     }
     else if (lang == "ja-JP")
     {
         lang = "Japanees.ResourceFile";
     }
     try
     {
         objcl.GetSqlStmt = objcl.SelectQuery("TblLogin", "UserId", TxtName.Text, "PasswordValue", TxtPwd.Text);
         dtUsers          = objcl.DataTables();
         if (dtUsers.Rows.Count > 0)
         {
             if (dtUsers.Rows[0]["UserId"].ToString() == TxtName.Text && dtUsers.Rows[0]["PasswordValue"].ToString() == TxtPwd.Text)
             {
                 Response.Redirect("Welcome.aspx?id=" + TxtName.Text + "," + lang, false);
             }
         }
         else
         {
             LblMsg.Visible = true;
             string lang1 = Convert.ToString(Session["Culture"]);
             gStrings = ResourceManager.CreateFileBasedResourceManager("Strings", Server.MapPath("Resources") +
                                                                       Path.DirectorySeparatorChar, null);
             objCultureInfo = new CultureInfo(lang1);
             LblMsg.Text    = gStrings.GetString("LblMsg", objCultureInfo);
         }
     }
     catch (Exception)
     { Response.Redirect("Error.aspx", false); }
     finally
     {
         dtUsers.Dispose();
         objcl = null;
     }
 }