using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
public partial class WebMain_Product_product : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.databind();
        }
    }
    public void databind()
    {
        Doadmin.ddldatabind(DropDownList1, "select * from jobmag where isfp='y'", "jobtitle","id");
        this.DropDownList1.SelectedValue = Request.QueryString["id"].ToString();
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        string sqlstr="";
        sqlstr = "select * from jobmag where isfp='y' order by jobaddtime";
        SqlCommand smd = new SqlCommand(sqlstr, conn);
        SqlDataReader sdr=smd.ExecuteReader();
        sdr.Read();



        sdr.Close();
        conn.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sex="";
        if (isv.Checked)
        {
            sex = "男";
        }
        else
        {
            sex = "女";
        }
        string stpt1 = "";
        string filename = "";
        string stfilename1 = "";
        string hzf = this.File2.PostedFile.FileName;
        if (hzf != "")
        {
            string U_f = (hzf.Substring(hzf.LastIndexOf(".") + 1)).ToLower().Trim();

            if (U_f == "doc" || U_f == "xls" || U_f == "txt")
            {
                stfilename1 = DateTime.Now.ToString("yyyyMMddHHmmssffffMM");
                stpt1 = Server.MapPath("~/upfile/upload/") + stfilename1 + "." + U_f;
                File2.SaveAs(stpt1);
                filename = stfilename1 + "." + U_f;
            }
            else
            {
                Response.Write("<script language='javascript'>alert('上传格式有误，请确认后再上传!')</script>");
            }
        }
        string sqltxt = "insert into jobHRadd(jobname,jobid,jobtitle,age,jobage,jcd,gcd,tel,email,address,sex,addtime,jobck,zt,fj) values (";
        sqltxt += "'" + jobname.Text + "','" + DropDownList1.SelectedValue.ToString() + "','" + this.DropDownList1.SelectedItem.Text+"',"+age.Text+","+jobage.Text+",'"+jcd.Text+"'";
        sqltxt += ",'"+gcd.Text+"','"+tel.Text+"','"+email.Text+"','"+address.Text+"','"+sex+"','"+DateTime.Now.ToString()+"','未查看','0','"+filename+"')";
        if (Doadmin.Exec(sqltxt))
        {
            Response.Write("<script>alert('提交成功，我们会认真审核您的简历!');window.location.href='job.aspx'</script>");

        }
        else
        {
            Response.Write("<script>alert('提交失败；请认真填写');window.location.href='jobadd.aspx?id=" + Request.QueryString["id"] + "'</script>");
        }
    }
}
