📄 personalinfo.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (SqlCommand command = new SqlCommand())
{
command.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
/* nametxt.Text = FNTextBox.Text + " " + MNTextBox.Text + " " + FamilyNTextBox1.Text;
// nationalitytxt.Text = NationalityTextBox.Text;
gendertxt.Text = GenderDropDownList1.SelectedItem.Text;
//dobtxt.Text = TextBox2.Text;
maritalstatustxt.Text = MaritalStatusDropDownList2.SelectedItem.Text;
addresstxt.Text = EmirateDropDownList1.SelectedItem.Text + ", " + CityTextBox2.Text;
emailtxt.Text = EmailTextBox3.Text;
mobiletxt.Text = MobileTextBox5.Text;
faxtxt.Text = FaxTextBox4.Text;
/// educationtxt.Text = CollegeTextBox1.Text + ", " + MajorTextBox2.Text;
/// skillstxt.Text = SkillTextBox3.Text;
/// rewardstxt.Text = HonorTextBox1.Text;
//intereststxt.Text = InterestTextBox2.Text;
careerobjectivestxt.Text = CareerTextBox.Text;
// workexperiencetxt.Text = WETextBox2.Text;
otherstxt.Text = OtherTextBox3.Text;
// referencestxt.Text = RefTextBox1.Text;*/
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
btnUploadFile.Click += new EventHandler(btnUploadFile_Click);
}
void btnUploadFile_Click(object sender, EventArgs e)
{
// exit if file-upload has no file
if (!ctrFile.HasFile) return;
// generate new fileId(Guid:"Globally Unique ID")
Guid fileId = Guid.NewGuid();
// Guid CVId = new Guid();
// create insert query
using (SqlCommand command = new SqlCommand())
{
command.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
command.CommandText = @"insert into [Files](CVId,FileId, FileName, FileType, FileSize, FileContent,FName)
values(IDENT_CURRENT('cvTable1'),@FileId, @FileName, @FileType, @FileSize, @FileContent, @FName)";
command.Parameters.Add("@FileId", SqlDbType.UniqueIdentifier).Value = fileId;
command.Parameters.Add("@FileName", SqlDbType.NVarChar, 100).Value = Path.GetFileName(ctrFile.PostedFile.FileName);
command.Parameters.Add("@FileType", SqlDbType.NVarChar, 100).Value = ctrFile.PostedFile.ContentType;
command.Parameters.Add("@FileSize", SqlDbType.Int).Value = ctrFile.PostedFile.ContentLength;
// filecontent, convert from stream to byte array
byte[] fileContent = new byte[ctrFile.PostedFile.ContentLength];
ctrFile.PostedFile.InputStream.Read(fileContent, 0, ctrFile.PostedFile.ContentLength);
command.Parameters.Add("@FileContent", SqlDbType.VarBinary, -1).Value = fileContent;
command.Parameters.Add("@FName", SqlDbType.NVarChar, 50).Value = TextBox1.Text;
//command.Parameters.Add("@CVId", SqlDbType.UniqueIdentifier).Value = CVId ;
command.Connection.Open();
command.ExecuteNonQuery();
TextBox1.Text = "";
}
// show result
ctrResult.NavigateUrl = "FileStream.ashx?FileId=" + fileId.ToString();
ctrResult.Text = "Click here to view the uploaded file";
}
/*System.Data.IDataReader getCVID() {
System.Data.IDbConnection dbConnection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
string queryString = @"SELECT MAX(CVId) FROM [cvTable1]where([cvTable1].[CVId]=@CVId)";
System.Data.IDbCommand dbCommand = new System.Data.SqlClient.SqlCommand();
dbCommand.CommandText = queryString;
dbCommand.Connection = dbConnection;
dbCommand.Parameters.Add(dbParam_ID);
dbConnection.Open();
System.Data.IDataReader dataReader = dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
return dataReader;
}*/
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
Response.Redirect("SeekerHome.aspx");
}
protected void FromDateTextBox_TextChanged(object sender, EventArgs e)
{
}
protected void ToDatetxt_TextChanged(object sender, EventArgs e)
{
}
protected void ToDateButton_Click(object sender, EventArgs e)
{
try
{
if (ToDateButton.Text.Trim() != "")
Calendar1.SelectedDate = Convert.ToDateTime(ToDateButton.Text);
}
catch
{ }
Calendar1.Visible = true; //showing the calendar.
}
protected void fromDtetxt_Click(object sender, EventArgs e)
{
try
{
if (fromDtetxt.Text.Trim() != "")
Calendar4.SelectedDate = Convert.ToDateTime(fromDtetxt.Text);
}
catch
{ }
Calendar4.Visible = true; //showing the calendar.
}
protected void EducationSubmit_Click(object sender, EventArgs e)
{
using (SqlCommand command = new SqlCommand())
{
command.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
command.CommandText = @"insert into [Education]( CVId,University,College,Major,StartDate, EndDate)
values(IDENT_CURRENT('cvTable1'),@University,@College,@Major,@StartDate, @EndDate)";
command.Parameters.Add("@University", SqlDbType.NChar, 60).Value = UniversityTextBox.Text;
command.Parameters.Add("@College", SqlDbType.NChar, 60).Value = CollegeTextBox.Text;
command.Parameters.Add("@Major", SqlDbType.NChar, 60).Value = MajorTextBox.Text;
command.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = FromDateTextBox.Text;
command.Parameters.Add("@EndDate", SqlDbType.DateTime).Value = ToDatetxt.Text;
command.Connection.Open();
command.ExecuteNonQuery();
/* UniversityTextBox.Text = "";
CollegeTextBox.Text = "";
MajorTextBox.Text = "";
FromDateTextBox.Text = "";
ToDatetxt.Text = "";
*/
}
}
protected void EducationResetButton_Click(object sender, EventArgs e)
{
UniversityTextBox.Text = "";
CollegeTextBox.Text = "";
MajorTextBox.Text = "";
FromDateTextBox.Text = "";
ToDatetxt.Text = "";
}
protected void DoBButton_Click(object sender, EventArgs e)
{
try
{
if (DoBButton.Text.Trim() != "")
Calendar2.SelectedDate = Convert.ToDateTime(DoBButton.Text);
}
catch
{ }
Calendar2.Visible = true; //showing the calendar.
}
protected void FromDateB_Click(object sender, EventArgs e)
{
try
{
if (FromDateB.Text.Trim() != "")
Calendar3.SelectedDate = Convert.ToDateTime(FromDateB.Text);
}
catch
{ }
Calendar3.Visible = true; //showing the calendar.
}
protected void Calendar3_SelectionChanged(object sender, EventArgs e)
{
fromDate.Text = Calendar3.SelectedDate.ToString();
Calendar3.Visible = false; //hiding the calendar.
}
protected void Calendar2_SelectionChanged(object sender, EventArgs e)
{
DoBTextBox.Text = Calendar2.SelectedDate.ToString();
Calendar2.Visible = false; //hiding the calendar.
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
ToDatetxt.Text = Calendar1.SelectedDate.ToString();
Calendar1.Visible = false; //hiding the calendar.
}
protected void Calendar4_SelectionChanged(object sender, EventArgs e)
{
FromDateTextBox.Text = Calendar4.SelectedDate.ToString();
Calendar4.Visible = false; //hiding the calendar.
}
protected void ToDateB_Click(object sender, EventArgs e)
{
try
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -