<%
@ Page Title="" Language="C#" MasterPageFile="~/UI/Home.Master" AutoEventWireup="true"
CodeBehind="Login.aspx.cs" Inherits="WebSearch.UI.Registration.Login" %>
<
asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</
asp:Content>
<
asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="loginPanel_DIV" LoadingPanelID="RadAjaxLoadingPanel1"/>
<telerik:AjaxUpdatedControl ControlID="pnlResetPass_DIV" LoadingPanelID="RadAjaxLoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnSave">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="loginPanel_DIV" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="hlForgotPassword">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="pnlResetPass_DIV" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<div runat="server" ID="loginPanel_DIV">
<asp:Panel ID="loginPanel" runat="server">
<div class="containerRegistration" runat="server" >
<div class="titleRegistration">
<div class="lblTitle">
<asp:Label runat="server" ID="lblTitle" /> <asp:Label ID="lblLogOfftext" runat="server" CssClass="logOff"></asp:Label> </div>
</div>
<div class="loginContainer">
<div class="labelLogin">
<asp:Label runat="server" ID="lblLoginId" /></div>
<div class="textBoxLogin">
<asp:TextBox runat="server" ID="txtloginId" MaxLength="50" Width="200px" />
<asp:RequiredFieldValidator CssClass="validator" ControlToValidate="txtloginId" runat="server"
ErrorMessage="*" ValidationGroup="Login"></asp:RequiredFieldValidator>
</div>
<div class="clear">
</div>
<div class="labelLogin">
<asp:Label runat="server" ID="lblPass" /></div>
<div class="textBoxLogin">
<asp:TextBox runat="server" AutoPostBack="true" AutoCompleteType="None" ID="txtPass" MaxLength="50" TextMode="Password" Width="200px" />
<asp:RequiredFieldValidator CssClass="validator" ControlToValidate="txtPass" runat="server"
ErrorMessage="*" ValidationGroup="Login"></asp:RequiredFieldValidator>
<div class="clear">
</div>
<asp:CustomValidator ID="cvLoginId" runat="server" Display="Dynamic" ControlToValidate="txtPass"
CssClass="validator" OnServerValidate="cvLoginId_ServerValidate" ValidationGroup="Login"></asp:CustomValidator></div>
<div class="remember">
<asp:CheckBox runat="server" ID="chkRemember"></asp:CheckBox>
<asp:LinkButton ID="hlForgotPassword" runat="server" OnClick="hlForgotPassword_Click" CausesValidation="true" ValidationGroup="Forgot"></asp:LinkButton>
</div>
<div class="buttonLogin" style="position: static">
<telerik:RadButton Width="40px" runat="server" ID="btnLogin" Skin="Vista" OnClick="btnLogin_Click" ValidationGroup="Login">
</telerik:RadButton>
<telerik:RadButton runat="server" Width="40px" ID="btnCancel" Skin="Vista">
</telerik:RadButton>
</div>
<div style="width: 100%; margin-left: 60%; margin-top:5%;">
<asp:Label ID="lblValidationText" Style="margin-top: 15px" CssClass="validator" runat="server"
Font-Italic="true"></asp:Label></div>
</div>
</div>
</asp:Panel>
</div>
<div id="pnlResetPass_DIV" runat="server">
<asp:Panel ID="pnlResetPass" runat="server">
<div class="containerRegistrationReset" runat="server" >
<div class="titleRegistration">
<div class="lblTitle">
<asp:Label runat="server" ID="lblReset" /></div>
</div>
<div style="width: 100%; margin-left: 10%">
<asp:Label ID="lblInformation" Style="margin-top: 15px" CssClass="validator" runat="server" Visible="false"
Font-Italic="true"></asp:Label></div>
<div class="loginContainer">
<div class="labelLogin">
<asp:Label runat="server" ID="lblUserId" /></div>
<div class="textBoxLogin">
<asp:TextBox runat="server" ID="txtUserId" MaxLength="50" Width="200px" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" CssClass="validator" ControlToValidate="txtUserId"
runat="server" ErrorMessage="*" ></asp:RequiredFieldValidator>
<br />
<asp:CustomValidator ID="cvExistLogin" runat="server" CssClass="validator" ControlToValidate="txtUserId"
OnServerValidate="cvExistLogin_ServerValidate" Display="Dynamic"></asp:CustomValidator>
</div>
<div class="clear"></div>
<div class="buttonLogin" style="position: static">
<telerik:RadButton Width="40px" runat="server" ID="btnReset" Skin="Vista" OnClick="btnReset_Click" >
</telerik:RadButton>
<telerik:RadButton runat="server" Width="40px" ID="btnCancelReset" Skin="Vista" OnClick="CancelReset_Click">
</telerik:RadButton>
</div>
</div><br />
<div style="width: 100%; margin-left: 60%">
<asp:Label ID="lblValidation" Style="margin-top: 15px" CssClass="validator" runat="server"
Font-Italic="true"></asp:Label></div>
<br />
</div>
</asp:Panel>
</div>
</
asp:Content>
using
System;
using
System.Globalization;
using
System.Resources;
using
System.Web;
using
WebSearch.Components;
using
WebSearch.SecurityModel;
 
namespace
WebSearch.UI.Registration
{
public partial class Login : System.Web.UI.Page
{
#region
Properties&Variables
private string _culture;
private readonly smOrganization _organization = new smOrganization();
private ResourceManager _resources;
#endregion
#region
Events
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack) return;
LoadSettings();
LoadLogin();
}
protected void Page_Init(object sender, EventArgs e)
{
GetInfo();
}
protected void btnReset_Click (object sender, EventArgs e)
{
if (!Page.IsValid) return;
_organization.User = _organization.GetUser(_organization.GetUser(txtUserId.Text));
_organization.SendPasswordChangeEmail();
lblInformation.Visible =
true;
}
protected void btnLogin_Click(object sender, EventArgs e)
{
LoginUser();
}
protected void cvLoginId_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
_organization.User =
new smUser {Loginid = txtloginId.Text, Password = Encript.EncryptText(txtPass.Text)};
if (_organization.ExistLogin(txtloginId.Text, 0) == false || _organization.LoginUser() == false)
{
args.IsValid =
false;
}
else
{
args.IsValid =
true;
App.SetCurrentUserId(_organization.GetUser(txtloginId.Text));
}
}
 
protected void CancelReset_Click(object sender, EventArgs e)
{
cvExistLogin.Enabled =
false;
loginPanel.Visible =
true;
pnlResetPass.Visible =
false;
Response.Redirect(
"~/UI/Registration/Login.aspx");
}
protected void cvExistLogin_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
args.IsValid = _organization.ExistLogin(txtUserId.Text, 0);
}
protected void hlForgotPassword_Click(object sender, EventArgs e)
{
cvExistLogin.Enabled =
true;
loginPanel.Visible =
false;
pnlResetPass.Visible =
true;
LoadSettingForgot();
}
protected void txtPass_OnTextChanged(object sender, EventArgs e)
{
LoginUser();
}
#endregion
 
#region
Method
private void LoginUser()
{
Page.Validate(
"Login");
if (!ValidateFailedUser(txtloginId.Text))
{
lblLogOfftext.Text = _resources.GetString(
"errorUser" , new CultureInfo(_culture));
RadAjaxManager1.Alert(_resources.GetString(
"errorUser" , new CultureInfo(_culture)));
return;
}
 
if (!Page.IsValid) return;
if (chkRemember.Checked)
{
HttpCookie authUser = Request.Cookies.Get("authUser");
if (authUser== null)
{
authUser =
new HttpCookie("authUser");
Response.Cookies[
"authUser"].Expires = DateTime.Now.AddDays(App.GetExpireDays());
authUser.Values.Add(
"authUserName", txtloginId.Text);
Response.Cookies.Add(authUser);
}
}
else
{
HttpCookie authUser = new HttpCookie("authUser") {Expires = DateTime.Now.AddDays(-1d)};
Response.Cookies.Add(authUser);
}
App.GetControls();
App.GetPersistenceTable();
Response.Redirect(
"~/UI/DocumentsList.aspx");
}
 
private bool ValidateFailedUser(string loginId)
{
return _organization.ValidateFailedUser(loginId);
}
 
private void LoadSettingForgot()
{
lblReset.Text = _resources.GetString(lblReset.ID,
new CultureInfo(_culture));
lblUserId.Text = _resources.GetString(lblLoginId.ID,
new CultureInfo(_culture));
}
private void LoadLogin()
{
HttpCookie authUser = Request.Cookies.Get("authUser");
if (authUser != null)
{
txtloginId.Text = authUser.Values[
"authUserName"];
}
}
private void LoadSettings()
{
lblTitle.Text = _resources.GetString(lblTitle.ID,
new CultureInfo(_culture));
lblLoginId.Text = _resources.GetString(lblLoginId.ID,
new CultureInfo(_culture));
lblPass.Text = _resources.GetString(lblPass.ID,
new CultureInfo(_culture));
btnLogin.Text = _resources.GetString(btnLogin.ID,
new CultureInfo(_culture));
btnCancel.Text = _resources.GetString(btnCancel.ID,
new CultureInfo(_culture));
chkRemember.Text = _resources.GetString(chkRemember.ID,
new CultureInfo(_culture));
cvLoginId.ErrorMessage = _resources.GetString(cvLoginId.ID,
new CultureInfo(_culture));
hlForgotPassword.Text = _resources.GetString(hlForgotPassword.ID,
new CultureInfo(_culture));
lblInformation.Text = _resources.GetString(lblInformation.ID,
new CultureInfo(_culture));
lblValidationText.Text = _resources.GetString(lblValidationText.ID,
new CultureInfo(_culture));
lblValidation.Text = _resources.GetString(lblValidationText.ID,
new CultureInfo(_culture));
cvExistLogin.ErrorMessage = _resources.GetString(cvExistLogin.ID,
new CultureInfo(_culture));
btnReset.Text = _resources.GetString(btnReset.ID,
new CultureInfo(_culture));
btnCancelReset.Text = _resources.GetString(btnCancelReset.ID,
new CultureInfo(_culture));
cvExistLogin.Enabled =
false;
pnlResetPass.Visible =
false;
if ( (Request.Cookies["authUser"] != null)) chkRemember.Checked = true;
if (Request.QueryString["L"] == "Off")
{
lblLogOfftext.Text = _resources.GetString(lblLogOfftext.ID,
new CultureInfo(_culture));
}
 
}
private void GetInfo()
{
_culture =
App.CurrentCulture();
_resources =
App.GetRegistrationResources("Login");
}
 
#endregion
}
}
<
telerik:RadGrid
ID
=
"RadGrid1"
>
<
MasterTableView
>
<
NestedViewTemplate
>
<
telerik:RadMultiPage
>
<
telerik:RadPageView
>
<
telerik:RadGrid
ID
=
"RadGrid2"
>
<
MasterTableView
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Label1"
/>
</
ItemTemplate
>
<
Columns
>
some code here..
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
NestedViewTemplate
>
<
Columns
>
some code here..
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
if
(item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem)
{
if
(item.BackColor == Color.FromArgb(Int32.Parse(
"C7EAC7"
, System.Globalization.NumberStyles.HexNumber)))
//GREEN
{
item.ChildItem.NestedTableViews[0].CssClass =
"altDrawInfo build"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"C7EAC7"
;
}
else
if
(item.BackColor == Color.FromArgb(Int32.Parse(
"FCB9B8"
, System.Globalization.NumberStyles.HexNumber)))
//RED
{
item.ChildItem.NestedTableViews[0].CssClass =
"altDrawInfo asBuilt"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"FCB9B8"
;
}
else
if
(item.BackColor == Color.FromArgb(Int32.Parse(
"FFFFCC"
, System.Globalization.NumberStyles.HexNumber)))
//ORANGE
{
item.ChildItem.NestedTableViews[0].CssClass =
"altDrawInfo approval"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"FFFFCC"
;
}
else
//DEFAULT
{
item.ChildItem.NestedTableViews[0].CssClass =
"altDrawInfo"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"EEEEEE"
;
}
}
else
{
if
(item.BackColor == Color.FromArgb(Int32.Parse(
"C7EAC7"
, System.Globalization.NumberStyles.HexNumber)))
//GREEN
{
item.ChildItem.NestedTableViews[0].CssClass =
"DrawInfo build"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"C7EAC7"
;
}
else
if
(item.BackColor == Color.FromArgb(Int32.Parse(
"FCB9B8"
, System.Globalization.NumberStyles.HexNumber)))
//RED
{
item.ChildItem.NestedTableViews[0].CssClass =
"DrawInfo asBuilt"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"FCB9B8"
;
}
else
if
(item.BackColor == Color.FromArgb(Int32.Parse(
"FFFFCC"
, System.Globalization.NumberStyles.HexNumber)))
//ORANGE
{
item.ChildItem.NestedTableViews[0].CssClass =
"DrawInfo approval"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"FFFFCC"
;
}
else
//DEFAULT
{
item.ChildItem.NestedTableViews[0].CssClass =
"DrawInfo"
;
item.ChildItem.NestedTableViews[0].Style[
"background-color"
] =
"D8D8D8"
;
}
}
/* NON-ALTERNATING ROW */
.drawInfo
/* */
{
background-color
:
#D8D8D8
!important
;
border-style
:
solid
!important
;
border-color
:
#000000
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.drawInfo td
/* */
{
background-color
:
#D8D8D8
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}
.drawInfo.build
/* GREEN */
{
background-color
:
#C7EAC7
!important
;
border-style
:
solid
!important
;
border-color
:
#000000
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.drawInfo.build td
/* GREEN */
{
background-color
:
#C7EAC7
!important
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}
.drawInfo.asBuilt
/* RED */
{
background-color
:
#FCB9B8
!important
;
border-style
:
solid
!important
;
border-color
:
#000000
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.drawInfo.asBuilt td
/* RED */
{
background-color
:
#FCB9B8
!important
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}
.drawInfo.approval
/* ORANGE */
{
background-color
:
#FFFFCC
!important
;
border-style
:
solid
!important
;
border-color
:
#000000
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.drawInfo.approval td
/* ORANGE */
{
background-color
:
#FFFFCC
!important
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}
/* ALTERNATING ROW */
.altDrawInfo
/* */
{
background-color
:
#EEEEEE
!important
;
border-style
:
solid
!important
;
border-color
:
#F7F7F7
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.altDrawInfo td
/* */
{
background-color
:
#EEEEEE
!important
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}
.altDrawInfo.build
/* GREEN */
{
background-color
:
#C7EAC7
!important
;
border-style
:
solid
!important
;
border-color
:
#F7F7F7
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.altDrawInfo.build td
/* GREEN */
{
background-color
:
#C7EAC7
!important
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}
.altDrawInfo.asBuilt
/* RED */
{
background-color
:
#FCB9B8
!important
;
border-style
:
solid
!important
;
border-color
:
#F7F7F7
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.altDrawInfo.asBuilt td
/* RED */
{
background-color
:
#FCB9B8
!important
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}
.altDrawInfo.approval
/* ORANGE */
{
background-color
:
#FFFFCC
!important
;
border-style
:
solid
!important
;
border-color
:
#F7F7F7
!important
;
border-width
:
0
2px
0
0
!important
;
/*top right bottom left*/
}
.altDrawInfo.approval td
/* ORANGE */
{
background-color
:
#FFFFCC
!important
;
border-style
:
solid
!important
;
border-color
:
#EDDA74
!important
;
border-width
:
0
0
0
0
!important
;
/*top right bottom left*/
}