protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Response.Cookies[Constants.UserName].Expires = DateTime.Now; if (Convert.ToString(Response.Cookies[Constants.SessionExpired].Value) == "SessionExpired") { // Display the alert in login page, if the session has expired Response.Write(@"<script language='javascript'>alert('The current session of 20 mins has been Expired. \n Kindly Login Again');</script>"); Response.Cookies[Constants.SessionExpired].Expires = DateTime.Now; } DataSet ds = oLogin.GetCompanyDetails(); ddlCompany.DataSource = ds; ddlCompany.DataTextField = "Name"; ddlCompany.DataValueField = "Code"; ddlCompany.DataBind(); } } catch (Exception ex) { lblError.Visible = true; lblError.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { lblerror.Text = string.Empty; lblSuccess.Text = string.Empty; //txtPassword.ReadOnly = false; //txtConfirmPass.ReadOnly = false; Response.Cookies[Constants.ScreenName].Value = "User Registration"; Response.Cookies[Constants.Update].Value = string.Empty; if (!IsPostBack) { ddlUserRole.DataSource = oUser.GetUserRole(); ddlUserRole.DataTextField = "Name"; ddlUserRole.DataValueField = "Code"; ddlUserRole.DataBind(); txtCompanyName.Text = Convert.ToString(Request.Cookies[Constants.CompanyName].Value); txtCompanyCode.Text = Convert.ToString(Request.Cookies[Constants.CompanyCode].Value); chkActive.Checked = true; string sUserRoleName = Convert.ToString(Request.Cookies[Constants.UserRoleName].Value); string sRole1 = System.Configuration.ConfigurationManager.AppSettings["Role1"].ToString(); string sRole2 = System.Configuration.ConfigurationManager.AppSettings["Role2"].ToString(); if (sUserRoleName.ToUpper() == sRole1.ToString().ToUpper() || sUserRoleName.ToUpper() == sRole2.ToString().ToUpper()) { txtCompanyName.Visible = false; ddlCompany.Visible = true; DataSet ds = oDataObject.GetCompanyDetails(); ddlCompany.DataSource = ds; ddlCompany.DataTextField = "Name"; ddlCompany.DataValueField = "Code"; ddlCompany.DataBind(); } else { txtCompanyName.Visible = true; ddlCompany.Visible = false; } } } catch (Exception ex) { lblerror.Visible = true; lblerror.Text = ex.Message.ToString(); } }