public UserAccount_data UserGetInformation(int id) { UserAccount_data ds = new UserAccount_data(); try { SqlConnection con = new SqlConnection(dataaccess.configsql.strcon); con.Open(); SqlCommand command = new SqlCommand("w_user_select_infor_account", con); command.CommandType = CommandType.StoredProcedure; SqlParameterCollection prmcols = command.Parameters; prmcols.Add(new SqlParameter("@id", SqlDbType.Int, 4)); prmcols["@id"].Value = id; sqlda.SelectCommand = command; sqlda.Fill(ds, UserAccount_data._table); con.Close(); } catch (Exception ex) { Console.Write(ex.ToString()); } return(ds); }
protected void Page_Load(object sender, EventArgs e) { if (Session["infoUser"] == null) { Response.Redirect("Default.aspx"); } try { Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()]; currentAccess = hash["currentpage"].ToString(); thome = hash["home"].ToString(); tblchange = hash["facount"].ToString(); currentAccess += ": <a href='?menu=home'>" + thome + "</a> » " + tblchange; if (!IsPostBack) { string[] arrstr = (string[])Session["infoUser"]; UserAccount_data userInfo = Users.GetUserInformation(int.Parse(arrstr[0])); if (userInfo.Tables.Count > 0) { if (userInfo.Tables[0].Rows.Count > 0) { txtusername.Value = userInfo.Tables[0].Rows[0][UserAccount_data._UserName].ToString(); txtname.Value = userInfo.Tables[0].Rows[0][UserAccount_data._ContactName].ToString(); txtcompany.Value = userInfo.Tables[0].Rows[0][UserAccount_data._Company].ToString(); txtjob.Value = userInfo.Tables[0].Rows[0][UserAccount_data._JobTitle].ToString(); txtmobile.Value = userInfo.Tables[0].Rows[0][UserAccount_data._MobilePhone].ToString(); txtoffice.Value = userInfo.Tables[0].Rows[0][UserAccount_data._OfficePhone].ToString(); txthome.Value = userInfo.Tables[0].Rows[0][UserAccount_data._HomePhone].ToString(); txtemail1.Value = userInfo.Tables[0].Rows[0][UserAccount_data._Email1].ToString(); txtemail2.Value = userInfo.Tables[0].Rows[0][UserAccount_data._Email2].ToString(); txtfax.Value = userInfo.Tables[0].Rows[0][UserAccount_data._FaxNumber].ToString(); txttax.Value = userInfo.Tables[0].Rows[0][UserAccount_data._TaxCode].ToString(); txtwebsite.Value = userInfo.Tables[0].Rows[0][UserAccount_data._Website].ToString(); txtaddressbill.Value = userInfo.Tables[0].Rows[0][UserAccount_data._BillingAddress].ToString(); txtcitybill.Value = userInfo.Tables[0].Rows[0][UserAccount_data._BillingCity].ToString(); txtzipcodebill.Value = userInfo.Tables[0].Rows[0][UserAccount_data._BillingZipCode].ToString(); txtcountrybill.Value = userInfo.Tables[0].Rows[0][UserAccount_data._BillingCountry].ToString(); txtaddressship.Value = userInfo.Tables[0].Rows[0][UserAccount_data._ShippingAddress].ToString(); txtcityship.Value = userInfo.Tables[0].Rows[0][UserAccount_data._ShippingCity].ToString(); txtzipcodeship.Value = userInfo.Tables[0].Rows[0][UserAccount_data._ShippingZipCode].ToString(); txtcountryship.Value = userInfo.Tables[0].Rows[0][UserAccount_data._ShippingCountry].ToString(); } else { Session["infoUser"] = null; Response.Redirect("Default.aspx"); } } else { Session["infoUser"] = null; Response.Redirect("Default.aspx"); } } diverror1.Visible = false; diverror2.Visible = false; diverror3.Visible = false; diverror4.Visible = false; tblchange = "Thay đổi thông tin khách hàng"; taccount = "Tài khoản đăng nhập"; tusername = "******"; tpass1 = "Mật khẩu"; tpass2 = "Xác nhận mật khẩu"; taccountinfo = "Thông tin khách hàng"; tname = "Họ và tên"; tcompany = "Tên công ty"; tjob = "Nghề nghiệp"; tmobile = "Số đt di động"; toffice = "Số đt cơ quan"; thomephone = "Số đt nhà riêng"; temail1 = "Địa chỉ mail1"; temail2 = "Địa chỉ mail2"; tfax = "Số Fax"; ttax = "Mã số thuế"; twebsite = "Website"; tbilling = "Địa chỉ thanh toán"; taddress = "Địa chỉ"; tcity = "Thành Phố"; tcountry = "Quốc Gia"; tzipcode = "Mã bưu điện"; tshipping = "Địa chỉ giao hàng"; tbutton = "Chỉnh sửa"; terrUpdate = "Lỗi kết nối SQL. Không thể chỉnh sửa. Xin hãy thử lại"; tyestochange = "Thông tin đã được thay đổi"; terrlengpass = "******"; terrpass = "******"; terrcommon = "Xin hãy nhập thông tin cần thiết"; terremail = "Địa chỉ email không hợp lệ"; buttonpass.Value = tbutton; buttoninfor.Value = tbutton; buttonbilling.Value = tbutton; buttonship.Value = tbutton; } catch { } }