protected void btnChange_Click(object sender, ImageClickEventArgs e) { try { if (Session["isTesting"] == null)//如果没有输入序列号,则禁止访问此页面 { Response.Redirect("Tlogin.aspx"); } TesterInfo testerInfo = new TesterInfo(); int activityId = guidbll.GetActivityId(Request["guid"].ToString()); DataSet dsEnterInfo = activitybll.GetEUsrInfoByActivityId(activityId); if (dsEnterInfo != null) { testerInfo.Tester_enterpriseid = int.Parse(dsEnterInfo.Tables[0].Rows[0]["activity_enterpriseuid"].ToString()); testerInfo.Tester_enterprise = dsEnterInfo.Tables[0].Rows[0]["users_incname"].ToString(); enterpriseUserbll.UpdateFirstTimeLogon(testerInfo.Tester_enterpriseid.ToString(), DateTime.Now); } if (Request["guid"] != null) { testerInfo.Tester_sn = Request["guid"].ToString(); testerInfo.Tester_name = txtbUserName.Text.Trim(); testerInfo.Tester_sex = ddlSex.SelectedValue; testerInfo.Tester_mobile = txtbMobile.Text.Trim(); testerInfo.Tester_experience = ddlExperience.SelectedValue; testerInfo.Tester_experienceinner = ddlExperienceInner.SelectedValue; testerInfo.Tester_email = txtbEmail.Text.Trim(); testerInfo.Tester_department = txtbDepartment.Text.Trim(); testerInfo.Tester_education = ddlEducation.SelectedValue; testerInfo.Tester_dealer = txtbDealer.Text.Trim(); testerInfo.Tester_birthdate = DateTime.Parse(txtBirthday.Value); testerInfo.Tester_application = txtbApplication.Text.Trim(); testerInfobll.Add(testerInfo); Response.Redirect("QuestionRepeat.aspx?guid=" + Request["guid"].ToString() + "&logopath=" + Request.QueryString["logopath"].Replace("\\","/")); /* string _guid = Request["guid"].ToString(); string _logopath = Request.QueryString["logopath"].ToString().Replace("\\","/"); StringBuilder sb = new StringBuilder(); sb.Append("<script language='javascript'>"); sb.Append("ShowDlg('" + _guid + "'," + "'" + _logopath + "')"); sb.Append("</script>"); ClientScript.RegisterStartupScript(GetType(), "", sb.ToString()); */ } else { return; } } catch (Exception ex) { MessageBox.ShowAndRedirect(this, ex.Message, "Tlogin.aspx"); } }
//public DataSet GetEnter /// <summary> /// 更新一条数据 /// </summary> public void Update(TesterInfo model) { TesterInfoDAL.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TesterInfo model) { //TODO: ADD return EnterpriseUserDAL.Add(model); return TesterInfoDAL.Add(model); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(TesterInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ExamDB.dbo.tb_Tester_Info set "); strSql.Append("tester_name=@tester_name,"); strSql.Append("tester_email=@tester_email,"); strSql.Append("tester_sex=@tester_sex,"); strSql.Append("tester_birthdate=@tester_birthdate,"); strSql.Append("tester_education=@tester_education,"); strSql.Append("tester_enterprise=@tester_enterprise,"); strSql.Append("tester_mobile=@tester_mobile,"); strSql.Append("tester_experience=@tester_experience,"); strSql.Append("tester_application=@tester_application,"); strSql.Append("tester_matching=@tester_matching,"); strSql.Append("tester_consistencyscore=@tester_consistencyscore,"); strSql.Append("tester_teststarttime=@tester_teststarttime"); strSql.Append("tester_testendtime=@tester_testendtime"); strSql.Append("tester_experienceinner=@tester_experienceinner"); strSql.Append("tester_dealer=@tester_dealer"); strSql.Append("tester_department=@tester_department"); strSql.Append("tester_enterpriseid=@tester_enterpriseid"); strSql.Append(" where tester_sn=@tester_sn "); SqlParameter[] parameters = { new SqlParameter("@tester_name", SqlDbType.NVarChar,255), new SqlParameter("@tester_email", SqlDbType.NVarChar,255), new SqlParameter("@tester_sex", SqlDbType.NVarChar,8), new SqlParameter("@tester_birthdate", SqlDbType.DateTime), new SqlParameter("@tester_education", SqlDbType.NVarChar,50), new SqlParameter("@tester_enterprise", SqlDbType.NVarChar,255), new SqlParameter("@tester_mobile", SqlDbType.NVarChar,255), new SqlParameter("@tester_experience", SqlDbType.NVarChar,50), new SqlParameter("@tester_application", SqlDbType.NVarChar,50), new SqlParameter("@tester_matching", SqlDbType.Float), new SqlParameter("@tester_consistencyscore", SqlDbType.Float), new SqlParameter("@tester_teststarttime", SqlDbType.DateTime), new SqlParameter("@tester_testendtime", SqlDbType.DateTime), new SqlParameter("@tester_experienceinner", SqlDbType.NVarChar,50), new SqlParameter("@tester_dealer", SqlDbType.NVarChar,50), new SqlParameter("@tester_department", SqlDbType.NVarChar,50), new SqlParameter("@tester_enterpriseid", SqlDbType.NVarChar,50), new SqlParameter("@tester_sn", SqlDbType.NVarChar,255) }; parameters[0].Value = model.Tester_name; parameters[1].Value = model.Tester_email; parameters[2].Value = model.Tester_sex; parameters[3].Value = model.Tester_birthdate; parameters[4].Value = model.Tester_education; parameters[5].Value = model.Tester_enterprise; parameters[6].Value = model.Tester_mobile; parameters[7].Value = model.Tester_experience; parameters[8].Value = model.Tester_application; parameters[9].Value = model.Tester_matching; parameters[10].Value = model.Tester_consistencyscore; parameters[11].Value = model.Tester_teststarttime; parameters[12].Value = model.Tester_testendtime; parameters[13].Value = model.Tester_experienceinner; parameters[14].Value = model.Tester_dealer; parameters[15].Value = model.Tester_department ; parameters[16].Value = model.Tester_enterpriseid; parameters[17].Value = model.Tester_sn; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(TesterInfo model) { int n = Delete(model.Tester_sn); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ExamDB.dbo.tb_Tester_Info("); strSql.Append(@"tester_sn, tester_name, tester_email, tester_sex, tester_birthdate, tester_education, tester_enterprise, tester_mobile, tester_experience, tester_application, tester_matching, tester_consistencyscore, tester_teststarttime, tester_testendtime, tester_experienceinner, tester_dealer, tester_department, tester_enterpriseid)"); strSql.Append(" values ("); strSql.Append(@"@tester_sn, @tester_name, @tester_email, @tester_sex, @tester_birthdate, @tester_education, @tester_enterprise, @tester_mobile, @tester_experience, @tester_application, @tester_matching, @tester_consistencyscore, @tester_teststarttime, @tester_testendtime, @tester_experienceinner, @tester_dealer, @tester_department, @tester_enterpriseid)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@tester_sn",SqlDbType.NVarChar,255), new SqlParameter("@tester_name", SqlDbType.NVarChar,255), new SqlParameter("@tester_email", SqlDbType.NVarChar,255), new SqlParameter("@tester_sex", SqlDbType.NVarChar,8), new SqlParameter("@tester_birthdate",SqlDbType.DateTime), new SqlParameter("@tester_education", SqlDbType.NVarChar,50), new SqlParameter("@tester_enterprise", SqlDbType.NVarChar,255), new SqlParameter("@tester_mobile", SqlDbType.NVarChar,50), new SqlParameter("@tester_experience", SqlDbType.NVarChar ,255), new SqlParameter("@tester_application", SqlDbType.NVarChar,50), new SqlParameter("@tester_matching",SqlDbType.Float), new SqlParameter("@tester_consistencyscore",SqlDbType.Float), new SqlParameter("@tester_teststarttime",SqlDbType.DateTime), new SqlParameter("@tester_testendtime",SqlDbType.DateTime), new SqlParameter("@tester_experienceinner", SqlDbType.NVarChar,50), new SqlParameter("@tester_dealer", SqlDbType.NVarChar,255), new SqlParameter("@tester_department", SqlDbType.NVarChar,50), new SqlParameter("@tester_enterpriseid", SqlDbType.Int,4) }; parameters[0].Value = model.Tester_sn; parameters[1].Value = model.Tester_name; parameters[2].Value = model.Tester_email; parameters[3].Value = model.Tester_sex; parameters[4].Value = model.Tester_birthdate; parameters[5].Value = model.Tester_education; parameters[6].Value = model.Tester_enterprise; parameters[7].Value = model.Tester_mobile; parameters[8].Value = model.Tester_experience; parameters[9].Value = model.Tester_application; parameters[10].Value = model.Tester_matching; parameters[11].Value = model.Tester_consistencyscore; parameters[12].Value = model.Tester_teststarttime; parameters[13].Value = model.Tester_testendtime; parameters[14].Value = model.Tester_experienceinner; parameters[15].Value = model.Tester_dealer; parameters[16].Value = model.Tester_department; parameters[17].Value = model.Tester_enterpriseid; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return -1; } else { return Convert.ToInt32(obj); } }