Најавете се.
}}}
'''Додавање лични податоци за корисникот'''
{{{
#!c#
Addinfo.aspx.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace CoDBIS.Account
{
public partial class AddInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string korisnik = User.Identity.Name;
lblUserName.Text = korisnik;
}
protected void btnAdd_Click(object sender, EventArgs e)
{
string connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
SqlConnection conn = new SqlConnection(connString);
conn.Open();
string updateCommand = "UPDATE [Users] SET [PlaceOfBirth]=@PlaceOfBirth, [Gender]=@Gender, [DateOfBirth]=@DateOfBirth, [Position]=@Position, [FirstNameLastName]=@FirstNameLastName, [Employer]=@Employer, [EducationLevel]=@EducationLevel, [EducationInstitution]=@EducationInstitution WHERE ([UserName]=@UserName)";
SqlCommand cmd = new SqlCommand(updateCommand, conn);
cmd.Parameters.AddWithValue("@PlaceOfBirth", txtMesto.Text);
cmd.Parameters.AddWithValue("@Gender", rblPol.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@DateOfBirth", Convert.ToDateTime( txtDatum.Text));
cmd.Parameters.AddWithValue("@Position", txtPozicija.Text);
cmd.Parameters.AddWithValue("@FirstNameLastName", txtImePrezime.Text);
cmd.Parameters.AddWithValue("@Employer", txtVrabotenVo.Text);
cmd.Parameters.AddWithValue("@EducationLevel", txtObrazovanie.Text);
cmd.Parameters.AddWithValue("@EducationInstitution", txtInstitucija.Text);
cmd.Parameters.AddWithValue("@UserName", lblUserName.Text);
cmd.ExecuteNonQuery();
conn.Close();
lblMessage.Text = "Вашите податоци се успешно зачувани.";
txtImePrezime.Text = "";
txtMesto.Text = "";
txtDatum.Text = "";
txtObrazovanie.Text = "";
txtInstitucija.Text = "";
txtVrabotenVo.Text = "";
txtPozicija.Text = "";
}
protected void BirthCalendar_SelectionChanged(object sender, EventArgs e)
{
txtDatum.Text = BirthCalendar.SelectedDate.ToString("dd/MM/yyyy");
}
}
}
Addinfo.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AddInfo.aspx.cs" Inherits="CoDBIS.Account.AddInfo" %>