Esempio n. 1
0
    protected void btn_CreatePDF_Click(object sender, EventArgs e)
    {
        string str_PdfFilename, str_mulu;
        string str_DocFilename;

        str_mulu = "./2015课题成果/研究报告/";
        string        str_MapPath = Server.MapPath(str_mulu);
        DirectoryInfo di          = new DirectoryInfo(str_MapPath);

        FileInfo[] dis = di.GetFiles();//取目录中所有内容
        for (int i = 0; i < dis.Length; i++)
        {
            str_DocFilename = dis[i].Name;
            str_PdfFilename = str_DocFilename.Substring(0, str_DocFilename.LastIndexOf(".")) + ".pdf";
            try
            {
                Microsoft.Office.Interop.Word.WdSaveFormat wdf = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF;
                WordToal.Word2Format(str_MapPath + str_DocFilename, str_MapPath + str_PdfFilename, wdf);
            }
            catch (Exception ee)
            {
                CommFun.error_record(Session["jsh"].ToString(), Session["jsm"].ToString(), ee.Message);
            }
        }
    }
Esempio n. 2
0
    protected void Button6_Click(object sender, EventArgs e)
    {
        str_sql = "select * from 表1";
        dv      = DBFun.GetDataView(str_sql);
        string str_name, str_py;

        for (int i = 0; i < dv.Table.Rows.Count; i++)
        {
            str_name = dv.Table.Rows[i]["姓名"].ToString();
            str_py   = WordToal.GetAllPYLetters(str_name);
            str_sql  = "update 表1 set 邮箱地址='" + str_py + "' where 姓名 ='" + str_name + "' ";
            DBFun.ExecuteSql(str_sql);
        }
    }
Esempio n. 3
0
    protected void bindData()
    {
        str_sql = "SELECT Status,sqr,xmbh,zqbg_dName,zqbg from t_teacher_list where appNo = '" + Session["appNo"].ToString() + "';";
        DataRow dr = DBFun.GetDataRow(str_sql);

        if (dr == null)
        {
            return;
        }

        string str_status = dr["Status"].ToString();

        cbx_1.Checked = (str_status == "6");

        string str_sqr = dr["sqr"].ToString();
        string str_xmbh = dr["xmbh"].ToString();
        string str_DocFilename = dr["zqbg"].ToString();
        string str_HtmlFilename, str_mulu;

        str_mulu = "./中期检查申请表/";
        if (str_DocFilename == "")
        {
            Response.Write("<script>alert('尚未上传期中检查申请表!');</script>");
            hl_1.ForeColor   = System.Drawing.Color.Red;
            hl_1.Text        = "尚未上传期中检查申请表";
            hl_1.NavigateUrl = "";
            return;
        }
        str_HtmlFilename = str_DocFilename.Substring(0, str_DocFilename.LastIndexOf(".")) + ".pdf";
        string str_MapPath = Server.MapPath(str_mulu);

        //if (!File.Exists(str_MapPath + str_filename))
        //{
        //    Response.Write("<script>alert('尚未上传期中检查申请表!');</script>");
        //    return;
        //}
        //File.Copy(str_MapPath + str_filename, str_MapPath + str_newfilename, true);
        hl_1.ForeColor = System.Drawing.Color.FromArgb(000066);
        hl_1.Text      = "查看中级检查申请表";
        //string str_oldfilename = Server.MapPath(str_filename + ".doc");
        try
        {
            word.WdSaveFormat wdf = word.WdSaveFormat.wdFormatPDF;
            WordToal.Word2Format(str_MapPath + str_DocFilename, str_MapPath + str_HtmlFilename, wdf);
        }
        catch
        { }
        hl_1.NavigateUrl = str_mulu + str_HtmlFilename;
    }
Esempio n. 4
0
    protected void bindData()
    {
        str_sql = "SELECT sqr,xmbh,rws_dName,rws from t_teacher_list where xmbh = '" + Session["xmbh"].ToString() + "';";
        DataRow dr = DBFun.GetDataRow(str_sql);

        if (dr == null)
        {
            return;
        }
        string str_sqr = dr["sqr"].ToString();
        string str_xmbh = dr["xmbh"].ToString();
        string str_DocFilename = dr["rws"].ToString();
        string str_HtmlFilename, str_mulu;

        str_mulu = "./任务书/";
        if (str_DocFilename == "")
        {
            Response.Write("<script>alert('尚未上传期任务书!');</script>");
            hl_1.ForeColor   = System.Drawing.Color.Tomato;
            hl_1.Text        = "尚未上传期任务书";
            hl_1.NavigateUrl = "";
            return;
        }
        str_HtmlFilename = str_DocFilename.Substring(0, str_DocFilename.LastIndexOf(".")) + ".pdf";
        string str_MapPath = Server.MapPath(str_mulu);

        hl_1.ForeColor = System.Drawing.Color.FromArgb(000066);
        hl_1.Text      = "查看任务书";
        try
        {
            word.WdSaveFormat wdf = word.WdSaveFormat.wdFormatPDF;
            WordToal.Word2Format(str_MapPath + str_DocFilename, str_MapPath + str_HtmlFilename, wdf);
        }
        catch (Exception e)
        {
            CommFun.error_record(Session["jsh"].ToString(), Session["jsm"].ToString(), e.Message);
            return;
        }
        hl_1.NavigateUrl = str_mulu + str_HtmlFilename;
    }
Esempio n. 5
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     TextBox2.Text = WordToal.GetAllPYLetters(TextBox1.Text);
 }
    protected void btn_confirm_Click(object sender, EventArgs e)
    {
        string str_sql = "select url from t_dict where flm = 8 and bm = 15";

        if (DBFun.ExecuteScalar(str_sql) == null)
        {
            tbx_InitPwd.Text = "";
        }
        else
        {
            tbx_InitPwd.Text = DBFun.ExecuteScalar(str_sql).ToString();
        }
        string str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_csmm.Text, "MD5");

        if (cbx_InitPwd.Checked)
        {
            str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_InitPwd.Text, "MD5");
        }
        //新增
        if (lbl_editflag.Text == "insert")
        {
            string str_spm = "";
            try
            {
                str_spm = WordToal.GetFirstPYLetter(tbx_username.Text.Trim()).Trim();
            }
            catch
            {
                str_spm = "";
            }
            //判断身份证号是否重复
            str_sql = "select count(*) from t_teacher where jsh = '" + tbx_sfzh.Text + "'";
            if (DBFun.ExecuteScalar(str_sql).ToString() == "1")
            {
                Response.Write(@"<script>alert('一个教师号只能注册一次,该教师号已经注册过了!');</script>");
                return;
            }
            str_sql = string.Format("insert into t_teacher (jsm, pwd, jsh,xsh,dept,spm) values ( '{0}',  '{1}', '{2}','{3}','{4}','{5}')",
                                    tbx_username.Text.Trim(), str_pwd, tbx_sfzh.Text.Trim(), ddlist_dept.SelectedValue, ddlist_dept.SelectedItem.Text, str_spm);
        }
        //修改密码
        else
        {
            //判断密码是否为空
            if (tbx_csmm.Text == null || tbx_csmm.Text == "" || tbx_qrmm.Text == null || tbx_qrmm.Text == "")
            {
                str_sql = string.Format(" update t_teacher set jsm = '{0}',xsh = '{1}',dept = '{2}' where jsh = '{3}'",
                                        tbx_username.Text, ddlist_dept.SelectedValue, ddlist_dept.SelectedItem.Text, tbx_sfzh.Text);
            }
            else
            {
                str_sql = string.Format("update t_teacher set jsm = '{0}',pwd = '{1}',xsh = '{2}' ,dept = '{3}' where jsh = '{4}'",
                                        tbx_username.Text, str_pwd, ddlist_dept.SelectedValue, ddlist_dept.SelectedItem.Text, tbx_sfzh.Text);
            }
        }

        if (DBFun.ExecuteUpdate(str_sql))
        {
            Response.Write("<script>alert('用户信息保存成功!');</script>");
            bindData();
            TD_AddUser.Visible = false;
        }
        else
        {
            Response.Write("<script>alert('用户信息保存失败!');</script>");
        }
    }