/// <summary> /// Method Name:Page_Load /// Description: Get the name of user and Language From session and Display on Web page /// Author:Bhumi /// Created On:17/7/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { try { if (Session["LoginID"] != null) { if (Session["Language"].ToString() == "サブミット") { objconst = new ConstantMessages(); LblLoginID.Text = objconst.strwelcomemsg_ja + " <font color=blue>" + Session["LoginID"] + "</font>"; } else if (Session["Language"].ToString() == "Submit") { objconst = new ConstantMessages(); LblLoginID.Text = objconst.strwelcomemsg_en + " <font color=blue>" + Session["LoginID"] + "</font>"; } } else { objconst = new ConstantMessages(); Response.Redirect(objconst.strLogin_Ex12Page, false); } } catch (Exception) { objconst = new ConstantMessages(); Response.Redirect(objconst.strErrorPage, false); } finally { objconst = null; } }
/// <summary> /// Method Name:GetEnglish /// Description:Set English Language of Login Page & its Controls /// Author:Bhumi /// Created On:17/7/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void GetEnglish() { EnStrings = new ResourceManager("ADV_ASP_Day8_9.JapaneseToEnglish", typeof(JapaneseToEnglish).Assembly); try { LblHeader.Text = EnStrings.GetString("Header1"); LblInvalid.Text = EnStrings.GetString("LblInvalid"); LblLoginID.Text = EnStrings.GetString("LblLoginID"); LblPassword.Text = EnStrings.GetString("LblPassword"); RfvName.ErrorMessage = EnStrings.GetString("RfvName"); RfvPassword.ErrorMessage = EnStrings.GetString("RfvPassword"); BtnSubmit.Text = EnStrings.GetString("BtnSubmit"); BtnCancel.Text = EnStrings.GetString("BtnCancel"); BtnLanguage.Text = EnStrings.GetString("BtnLanguage"); } catch (Exception) { objconst = new ConstantMessages(); Response.Redirect(objconst.strErrorPage); } finally { EnStrings = null; objconst = null; } }
/// <summary> /// Method Name:BtnSubmit_Click /// Description: Redirection to the welcome page for authenticate user /// Author:Bhumi /// Created On:16/7/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmit_Click(object sender, EventArgs e) { try { objcommon = new CommonFunction(); //Existance in Employees_Temp Table strBrSelectQuery = new StringBuilder("SELECT FirstName,LastName "); strBrSelectQuery.Append(" FROM Employees_Temp"); strBrSelectQuery.Append(" WHERE FirstName='" + TxtLoginID.Text + "' COLLATE Latin1_General_CS_AS AND LastName='" + TxtPassword.Text + "' COLLATE Latin1_General_CS_AS ;"); UserName_Password_Exist = objcommon.ConnectionGenerate(strBrSelectQuery.ToString()); if (UserName_Password_Exist != null) { Session["LoginID"] = TxtLoginID.Text; objconst = new ConstantMessages(); Response.Redirect(objconst.strwelcomepage_en, false);//redirection } else { LblInvalid.Visible = true; } } catch (Exception) { objconst = new ConstantMessages(); Response.Redirect(objconst.strErrorPage); } finally { strBrSelectQuery = null; objcommon = null; objconst = null; } }
/// <summary> /// Method Name:Page_Load /// Description: Identify Culture of your System and Redirect To related Login Page /// Author:Bhumi /// Created On:16/7/2015 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { ConstantMessages objconst; try { string sLang, sLang1; //Get The Culture Info sLang = System.Threading.Thread.CurrentThread.CurrentCulture.EnglishName; //System.Threading.Thread.CurrentThread.CurrentUICulture; sLang1 = sLang.Substring(0, 2); objconst = new ConstantMessages(); // Redirect based on culture. switch (sLang1) { case "En": Response.Redirect(objconst.strLogin_en, false); break; case "Ja": Response.Redirect(objconst.strLogin_ja, false); break; default: Response.Redirect(objconst.strLogin_en, false); break; } } catch (Exception) { objconst = new ConstantMessages(); Response.Redirect(objconst.strErrorPage, false); } finally { objconst = null; } }
protected void Page_Load(object sender, EventArgs e) { objconst = new ConstantMessages(); Response.Write(objconst.strErrorMessage); }