/// <summary> /// ��������б� /// </summary> public List<WebProject.Model.BaseData.ZT_COM_RenCai> DataTableToList(DataTable dt) { List<WebProject.Model.BaseData.ZT_COM_RenCai> modelList = new List<WebProject.Model.BaseData.ZT_COM_RenCai>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { WebProject.Model.BaseData.ZT_COM_RenCai model; for (int n = 0; n < rowsCount; n++) { model = new WebProject.Model.BaseData.ZT_COM_RenCai(); if(dt.Rows[n]["RenCaiID"].ToString()!="") { model.RenCaiID=int.Parse(dt.Rows[n]["RenCaiID"].ToString()); } model.Position=dt.Rows[n]["Position"].ToString(); model.Name=dt.Rows[n]["Name"].ToString(); model.Sex=dt.Rows[n]["Sex"].ToString(); if(dt.Rows[n]["Birthday"].ToString()!="") { model.Birthday=DateTime.Parse(dt.Rows[n]["Birthday"].ToString()); } model.Address=dt.Rows[n]["Address"].ToString(); model.Telephone=dt.Rows[n]["Telephone"].ToString(); model.Mobile=dt.Rows[n]["Mobile"].ToString(); model.Email=dt.Rows[n]["Email"].ToString(); model.School=dt.Rows[n]["School"].ToString(); model.Resume=dt.Rows[n]["Resume"].ToString(); model.CreateBy=dt.Rows[n]["CreateBy"].ToString(); if(dt.Rows[n]["CreateDate"].ToString()!="") { model.CreateDate=DateTime.Parse(dt.Rows[n]["CreateDate"].ToString()); } model.LastUpdateBy=dt.Rows[n]["LastUpdateBy"].ToString(); if(dt.Rows[n]["LastUpdateDate"].ToString()!="") { model.LastUpdateDate=DateTime.Parse(dt.Rows[n]["LastUpdateDate"].ToString()); } model.Remark=dt.Rows[n]["Remark"].ToString(); modelList.Add(model); } } return modelList; }
protected void btnSubmit_Click(object sender, EventArgs e) { if (this.txtPosition.Text.Trim() == "") { MessageBox.Show(this, "请输入你要应聘的职位!"); return; } else { if (this.txtName.Text.Trim() == "") { MessageBox.Show(this, "请输入你的姓名!"); return; } else { string sex = "1"; if (this.sex1.Checked == false && this.sex2.Checked == false) { MessageBox.Show(this, "请选择性别!"); return; } if (this.sex2.Checked) { sex = "0"; } else { if (this.txtBirthday.Text.Trim() == "") { MessageBox.Show(this, "请输入你的出生年月!"); return; } else { if (this.txtAddress.Text.Trim() == "") { MessageBox.Show(this, "请输入你的现居地址!"); return; } else { if (this.txtMobile.Text.Trim() == "") { MessageBox.Show(this, "请填写您的手机号码!"); return; } else { double u; if (!double.TryParse(this.txtMobile.Text, out u)) { MessageBox.Show(this, "手机号码必须为数字!"); return; } if (u <= 13000000000 || u >= 19000000000) { MessageBox.Show(this, "请输入正确的手机号码!");//判断输入框中的值是否为数字和是否溢出 return; } else { if (CheckString.CheckSqlKeyWord(this.txtAddress.Text) == true || CheckString.CheckSqlKeyWord(this.txtBirthday.Text) == true || CheckString.CheckSqlKeyWord(this.txtEmail.Text) == true || CheckString.CheckSqlKeyWord(this.txtMobile.Text) == true || CheckString.CheckSqlKeyWord(this.txtName.Text) == true || CheckString.CheckSqlKeyWord(this.txtPosition.Text) == true || CheckString.CheckSqlKeyWord(this.txtTelephone.Text) == true) { MessageBox.Show(this, "应聘信息内请不要包含非法字符!"); return; } WebProject.Model.BaseData.ZT_COM_RenCai model_RenCai = new WebProject.Model.BaseData.ZT_COM_RenCai(); model_RenCai.Address = this.txtAddress.Text.Trim(); model_RenCai.Birthday = Convert.ToDateTime(this.txtBirthday.Text.Trim()); model_RenCai.CreateDate = DateTime.Now; model_RenCai.Email = this.txtEmail.Text.Trim(); model_RenCai.Mobile = this.txtMobile.Text.Trim(); model_RenCai.Name = this.txtName.Text.Trim(); model_RenCai.Position = this.txtPosition.Text.Trim(); model_RenCai.Sex = sex.ToString(); model_RenCai.Telephone = this.txtTelephone.Text.Trim(); WebProject.BLL.BaseData.ZT_COM_RenCai bll_RenCai = new WebProject.BLL.BaseData.ZT_COM_RenCai(); bll_RenCai.Add(model_RenCai); if (Request["ZhaoPinID"] != "") { try { int ZhaoPinID = Convert.ToInt32(Request.QueryString["ZhaoPinID"].ToString()); WebProject.BLL.BaseData.ZT_COM_ZhaoPin bll_ZhaoPin = new WebProject.BLL.BaseData.ZT_COM_ZhaoPin(); WebProject.Model.BaseData.ZT_COM_ZhaoPin model_ZhaoPin = bll_ZhaoPin.GetModel(ZhaoPinID); model_ZhaoPin.Number += 1; bll_ZhaoPin.Update(model_ZhaoPin); MessageBox.ShowAndRedirect(this, "应聘信息填写成功!", "ZhaoPin.aspx"); } catch { Response.Redirect("ErrorPage.aspx"); } } } } } } } } } }