|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
//using Entities;
using System.Data;
using Utils;
public partial class PhotoDetail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (SessionManager.PageIndex != string.Empty)
{
this.hfKeyId.Value = SessionManager.KeyPrimary;
this.hfPageIndex.Value = SessionManager.PageIndex;
}
var qry = Request.QueryString["id"];
var userId = qry;
this.lblName.Text = "The XP-Team";
//this.lblRemarks.Text = firstName + " " + lastName;
// Display the image from the database
Image1.ImageUrl = "~/ShowFullSizeImg.ashx?id=" + userId;
//Get user info
User user = new User();
user = GetUserInfo(userId);
this.lblRemarks.Text = user.FirstName + " " + user.LastName + " " + user.MiddleName.Substring(0, 1);
}
}
private User GetUserInfo(string userId)
{
string sqlConnection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection conn;
SqlCommand cmd;
User lst = new User();
try
{
using (conn = new SqlConnection(sqlConnection))
{
conn.Open();
StringBuilder sbQry = new StringBuilder();
sbQry.Append("select * FROM dbo.[User] where UserId = " + userId);
using (cmd = new SqlCommand(sbQry.ToString(), conn))
{
cmd.CommandType = CommandType.Text;
using (SqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
User temp = new User();
temp.UserID = Tools.Tools.IifInt(dr["UserID"]);
temp.Username = Tools.Tools.IifStr(dr["Username"]);
temp.Password = Tools.Tools.IifStr(dr["Password"]);
temp.LastName = Tools.Tools.IifStr(dr["LastName"]);
temp.FirstName = Tools.Tools.IifStr(dr["FirstName"]);
temp.MiddleName = Tools.Tools.IifStr(dr["MiddleName"]);
temp.WorksiteCode = Tools.Tools.IifStr(dr["WorksiteCode"]);
temp.AccessLevel = Tools.Tools.IifInt(dr["AccessLevel"]);
temp.Active = Tools.Tools.IifStr(dr["Active"]);
temp.DateCreated = Tools.Tools.IifDT(dr["DateCreated"]);
//temp.DateUpdated = Tools.Tools.IifDate(dr["DateUpdated"]);
temp.WorksiteCode = Tools.Tools.IifStr(dr["Worksitedesc"]);
lst = temp;
}
}
}
}
}
catch (Exception ex)
{
lst.Username = "Error in retrieving record";
}
return lst;
}
protected void btnBack_Click(object sender, EventArgs e)
{
SessionManager.PageIndex = this.hfKeyId.Value;
SessionManager.PageIndex = this.hfPageIndex.Value;
Response.Redirect("~/DisplayRecord.aspx");
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
MCTS - Microsoft Certified Technology Specialist.
An Accountant.
Had been developed Payroll Accounting System Application
Live in: Quezon City, Metro Manila Philippines
Could reached at email address: ag_mojedo@live.com