Ejemplo n.º 1
0
    protected void GridViewEdit(int RowIndex)
    {
        DataView dv;

        if (Table2.Visible)
        {
            dv          = (DataView)Session["yxxwlw_ll"];
            lbl_id.Text = dv.Table.Rows[RowIndex]["id"].ToString();
            Txt2_1.Focus();

            try { Txt2_1.Value = dv.Table.Rows[RowIndex]["qzsj"].ToString().Substring(0, dv.Table.Rows[RowIndex]["qzsj"].ToString().IndexOf("~")); }
            catch { }
            try { Txt2_2.Value = dv.Table.Rows[RowIndex]["qzsj"].ToString().Substring(dv.Table.Rows[RowIndex]["qzsj"].ToString().IndexOf("~") + 1); }
            catch { }
            tbx2_gzjl.Text = dv.Table.Rows[RowIndex]["jl"].ToString();

            imgbtn_save.ImageUrl = "./img/save.gif";
        }
        else if (Table4.Visible)
        {
            dv          = (DataView)Session["yxxwlw_lw"];
            lbl_id.Text = dv.Table.Rows[RowIndex]["id"].ToString();
            tbx4_tm.Focus();

            tbx4_tm.Text               = dv.Table.Rows[RowIndex]["tm"].ToString();
            tbx4_kwmc.Text             = dv.Table.Rows[RowIndex]["kwmc"].ToString();
            tbx4_kwqh.Text             = dv.Table.Rows[RowIndex]["kwqh"].ToString();
            txt4_fbsj.Value            = dv.Table.Rows[RowIndex]["fbsj"].ToString();
            tbx4_pm.Text               = dv.Table.Rows[RowIndex]["pm"].ToString();
            ddlist4_slqk.SelectedValue = dv.Table.Rows[RowIndex]["slqk"].ToString();

            imgbtn_save.ImageUrl = "./img/save.gif";
        }
        else if (Table5.Visible)
        {
            dv          = (DataView)Session["yxxwlw_zz"];
            lbl_id.Text = dv.Table.Rows[RowIndex]["id"].ToString();
            tbx5_zzmc.Focus();

            tbx5_zzmc.Text  = dv.Table.Rows[RowIndex]["zzmc"].ToString();
            tbx5_cbs.Text   = dv.Table.Rows[RowIndex]["cbs"].ToString();
            txt5_cbsj.Value = dv.Table.Rows[RowIndex]["cbsj"].ToString();
            tbx5_pm.Text    = dv.Table.Rows[RowIndex]["pm"].ToString();

            imgbtn_save.ImageUrl = "./img/save.gif";
        }
        else if (Table6.Visible)
        {
            dv          = (DataView)Session["yxxwlw_cg"];
            lbl_id.Text = dv.Table.Rows[RowIndex]["id"].ToString();
            tbx6_cgmc.Focus();
            try
            {
                tbx6_cgmc.Text             = dv.Table.Rows[RowIndex]["cgmc"].ToString();
                tbx6_jlmc.Text             = dv.Table.Rows[RowIndex]["jlmc"].ToString();
                ddlist6_jldj.SelectedValue = dv.Table.Rows[RowIndex]["hjdj"].ToString();
                txt6_hjsj.Value            = dv.Table.Rows[RowIndex]["hjsj"].ToString();
                tbx6_pm.Text = dv.Table.Rows[RowIndex]["pm"].ToString();
            }
            catch { }
            imgbtn_save.ImageUrl = "./img/save.gif";
        }
    }
Ejemplo n.º 2
0
    protected int Save()
    {
        string str_sql = "";

        //lbl_id.Text = "";
        if (Table1.Visible)
        {
            //判断入学日期 论文答辩日期 获学位日期 关系
            try
            {
                if (Convert.ToDateTime(txt_rxny.Value) > Convert.ToDateTime(txt_dbrq.Value))
                {
                    Response.Write("<script>alert('入学日期应早于论文答辩日期!');</script>");
                    txt_rxny.Focus();
                    return(0);
                }
                else if (Convert.ToDateTime(txt_dbrq.Value) > Convert.ToDateTime(txt_hxwrq.Value))
                {
                    Response.Write("<script>alert('论文答辩日期应早于获得学位日期!');</script>");
                    txt_dbrq.Focus();
                    return(0);
                }
            }
            catch
            {
                if (txt_rxny.Value == "")
                {
                    Response.Write("<script>alert('入学日期 不能为空!');</script>");
                    txt_rxny.Focus();
                }
                else if (txt_dbrq.Value == "")
                {
                    Response.Write("<script>alert('论文答辩日期 不能为空!');</script>");
                    txt_dbrq.Focus();
                }
                else if (txt_hxwrq.Value == "")
                {
                    Response.Write("<script>alert('获得学位日期 不能为空!');</script>");
                    txt_hxwrq.Focus();
                }
                return(0);
            }


            str_sql = " update yxxwlw_cpry set cplb='" + rblist_cplb.SelectedValue + "'," +
                      " yourname='" + tbx_Name.Text + "'," +
                      " birth='" + txt_csny.Value + "'," +
                      " xingbie='" + ddlist_xb.SelectedValue + "'," +
                      " mz='" + ddlist_mz.SelectedValue + "', " +
                      //" tjdw='" + ddlist_tjdw.SelectedValue + "', " +
                      //" tjdw_mc='" + ddlist_tjdw.SelectedItem.Text + "', " +
                      " rxny='" + txt_rxny.Value + "', " +
                      " lwdbrq='" + txt_dbrq.Value + "', " +
                      " xwhdrq='" + txt_hxwrq.Value + "', " +
                      " yjxk_dm='" + ddlist_yjxkdm.SelectedValue + "'," +
                      " yjxk_mc='" + ddlist_yjxkdm.SelectedItem.Text + "', " +
                      " ejxk_dm='" + ddlist_ejxkdm.SelectedValue + "'," +
                      " ejxk_mc='" + ddlist_ejxkdm.SelectedItem.Text + "', " +
                      " sfzsxkzy=" + cbx_zsxkzy.Checked + ", " +
                      " zsxkzy='" + tbx_zsxkzy.Text + "', " +
                      " lw_ctitle='" + tbx_ctitle.Text + "', " +
                      " lw_etitle='" + tbx_etitle.Text + "', " +
                      " lw_yjfx='" + tbx_yjfx.Text + "'," +
                      " gdxwfs='" + ddlist_gdxwfs.SelectedValue + "'," +
                      " edit_rq='" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "' " +
                      " where sfzh = '" + Session["sfzh"].ToString() + "'";
        }
        else if (Table2.Visible)
        {
            if (tbx2_gzjl.Text == "")
            {
                return(0);
            }
            if (lbl_id.Text == "")
            {
                try
                {
                    if (Convert.ToDateTime(Txt2_1.Value) > Convert.ToDateTime(Txt2_2.Value))
                    {
                        Response.Write("<script>alert('开始时间应早于结束时间!');</script>");
                        Txt2_2.Focus();
                        return(0);
                    }
                }
                catch
                {
                    Response.Write("<script>alert('起止时间不能为空!');</script>");
                    Txt2_1.Focus();
                    return(0);
                }
                tbx2_qzsj.Text = Txt2_1.Value + "~" + Txt2_2.Value;
                str_sql        = "select count(*) from yxxwlw_ll where sfzh = '" + Session["sfzh"].ToString() + "'";
                if (CommFun.JudgeRowCount(str_sql, 5))
                {
                    Response.Write("<script>alert('最多只能增加 5 项!');</script>");
                    return(-1);
                }
                str_sql = "select iif(isnull(max(id)),1,max(id)+1) as maxid from yxxwlw_ll where sfzh = '" + Session["sfzh"].ToString() + "'";
                int int_maxbm = Convert.ToInt32(DBFun.ExecuteScalar(str_sql).ToString());
                str_sql = string.Format("insert into yxxwlw_ll (id,qzsj,jl,edit_rq,sfzh) " +
                                        " values({0},'{1}','{2}','{3}','{4}');",
                                        int_maxbm, tbx2_qzsj.Text, tbx2_gzjl.Text, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString());
            }
            else
            {
                str_sql = string.Format("update yxxwlw_ll set qzsj='{0}',jl='{1}',edit_rq='{2}' where sfzh='{3}' and id={4} ",
                                        tbx2_qzsj.Text, tbx2_gzjl.Text, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString(), Convert.ToInt16(lbl_id.Text));
            }
        }
        else if (Table3.Visible)
        {
            string ls_content1 = ftb3_1.Text.Replace("'", "’");
            string ls_content2 = ftb3_2.Text.Replace("'", "’");
            string ls_content3 = ftb3_3.Text.Replace("'", "’");
            if (CommFun.StringCounter(ftb3_1.HtmlStrippedText) > 3000)
            {
                Response.Write("<script>alert('论文中文摘要 内容应在3000字以内!');</script>");
                return(-1);
            }
            if (CommFun.StringCounter(ftb3_2.HtmlStrippedText) > 6000)
            {
                Response.Write("<script>alert('论文英文摘要 内容应在6000字以内!');</script>");
                return(-1);
            }
            if (CommFun.StringCounter(ftb3_3.HtmlStrippedText) > 400)
            {
                Response.Write("<script>alert('学位论文的主要创新点 内容应在400字以内!');</script>");
                return(-1);
            }
            str_sql = " update yxxwlw_cpry set lw_Cabstract='" + ls_content1 + "', " +
                      " lw_Eabstract = '" + ls_content2 + "', " +
                      " lw_cxd = '" + ls_content3 + "' " +
                      " where sfzh = '" + Session["sfzh"].ToString() + "'";
        }
        else if (Table4.Visible)
        {
            if (tbx4_tm.Text == "")
            {
                return(0);
            }
            if (lbl_id.Text == "")
            {
                str_sql = "select count(*) from yxxwlw_lw where sfzh = '" + Session["sfzh"].ToString() + "'";
                if (CommFun.JudgeRowCount(str_sql, 5))
                {
                    Response.Write("<script>alert('最多只能增加 5 项!');</script>");
                    return(-1);
                }
                str_sql = "select iif(isnull(max(id)),1,max(id)+1) as maxid from yxxwlw_lw where sfzh = '" + Session["sfzh"].ToString() + "'";
                int int_maxbm = Convert.ToInt32(DBFun.ExecuteScalar(str_sql).ToString());
                str_sql = string.Format("insert into yxxwlw_lw (id,tm,kwmc,kwqh,fbsj,pm,slqk,edit_rq,sfzh) " +
                                        " values({0},'{1}','{2}','{3}','{4}',{5},'{6}','{7}','{8}');",
                                        int_maxbm, tbx4_tm.Text, tbx4_kwmc.Text, tbx4_kwqh.Text, txt4_fbsj.Value, tbx4_pm.Text,
                                        ddlist4_slqk.SelectedValue, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString());
            }
            else
            {
                str_sql = string.Format("update yxxwlw_lw set tm='{0}',kwmc='{1}',kwqh='{2}',fbsj='{3}',pm='{4}',slqk='{5}',edit_rq = '{6}' where sfzh='{7}' and id={8} ",
                                        tbx4_tm.Text, tbx4_kwmc.Text, tbx4_kwqh.Text, txt4_fbsj.Value, tbx4_pm.Text,
                                        ddlist4_slqk.SelectedValue, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString(), Convert.ToInt16(lbl_id.Text));
            }
        }
        else if (Table5.Visible)
        {
            if (tbx5_zzmc.Text == "")
            {
                return(0);
            }
            if (lbl_id.Text == "")
            {
                str_sql = "select count(*) from yxxwlw_zz where sfzh = '" + Session["sfzh"].ToString() + "'";
                if (CommFun.JudgeRowCount(str_sql, 3))
                {
                    Response.Write("<script>alert('最多只能增加 3 项!');</script>");
                    return(-1);
                }
                str_sql = "select iif(isnull(max(id)),1,max(id)+1) as maxid from yxxwlw_zz where sfzh = '" + Session["sfzh"].ToString() + "'";
                int int_maxbm = Convert.ToInt32(DBFun.ExecuteScalar(str_sql).ToString());
                str_sql = string.Format("insert into yxxwlw_zz (id,zzmc,cbs,cbsj,pm,edit_rq,sfzh) " +
                                        " values({0},'{1}','{2}','{3}','{4}','{5}','{6}');",
                                        int_maxbm, tbx5_zzmc.Text, tbx5_cbs.Text, txt5_cbsj.Value, tbx5_pm.Text,
                                        DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString());
            }
            else
            {
                str_sql = string.Format("update yxxwlw_zz set zzmc='{0}',cbs='{1}',cbsj='{2}',pm={3},edit_rq='{4}' where sfzh='{5}' and id={6} ",
                                        tbx5_zzmc.Text, tbx5_cbs.Text, txt5_cbsj.Value, tbx5_pm.Text,
                                        DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString(), Convert.ToInt16(lbl_id.Text));
            }
        }
        else if (Table6.Visible)
        {
            if (tbx6_cgmc.Text == "")
            {
                return(0);
            }
            if (lbl_id.Text == "")
            {
                str_sql = "select count(*) from yxxwlw_cg where sfzh = '" + Session["sfzh"].ToString() + "'";
                if (CommFun.JudgeRowCount(str_sql, 3))
                {
                    Response.Write("<script>alert('最多只能增加 3 项!');</script>");
                    return(-1);
                }
                str_sql = "select iif(isnull(max(id)),1,max(id)+1) as maxid from yxxwlw_cg where sfzh = '" + Session["sfzh"].ToString() + "'";
                int int_maxbm = Convert.ToInt32(DBFun.ExecuteScalar(str_sql).ToString());
                str_sql = string.Format("insert into yxxwlw_cg (id,cgmc,jlmc,hjdj,hjsj,pm,edit_rq,sfzh) " +
                                        " values({0},'{1}','{2}','{3}','{4}',{5},'{6}','{7}');",
                                        int_maxbm, tbx6_cgmc.Text, tbx6_jlmc.Text, ddlist6_jldj.SelectedValue, txt6_hjsj.Value, tbx6_pm.Text,
                                        DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString());
            }
            else
            {
                str_sql = string.Format("update yxxwlw_cg set cgmc='{0}',jlmc='{1}',hjdj='{2}',hjsj='{3}',pm={4},edit_rq='{5}' where sfzh='{6}' and id={7} ",
                                        tbx6_cgmc.Text, tbx6_jlmc.Text, ddlist6_jldj.SelectedValue, txt6_hjsj.Value, tbx6_pm.Text,
                                        DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), Session["sfzh"].ToString(), Convert.ToInt16(lbl_id.Text));
            }
        }
        else if (Table7.Visible)
        {
            //判断首任博导时间与首任硕导时间关系
            try
            {
                if (Convert.ToDateTime(Txt7_zdjs_srsdny.Value) > Convert.ToDateTime(Txt7_zdjs_srbdny.Value))
                {
                    Response.Write("<script>alert('首任硕导年月应早于首任博导年月!');</script>");
                    Txt7_zdjs_srsdny.Focus();
                    return(0);
                }
            }
            catch
            {
                //if (Txt7_zdjs_srsdny.Value == "")
                //{
                //    Response.Write("<script>alert('首任硕导年月不能为空!');</script>");
                //    Txt7_zdjs_srsdny.Focus();
                //    return 0;
                //}
            }

            if (tbx7_zdjs_xzrs.Text == "")
            {
                tbx7_zdjs_xzrs.Text = "0";
            }
            if (tbx7_zdjs_zdss.Text == "")
            {
                tbx7_zdjs_zdss.Text = "0";
            }
            if (tbx7_zdjs_zdbs.Text == "")
            {
                tbx7_zdjs_zdbs.Text = "0";
            }
            if (tbx7_zdjs_byss.Text == "")
            {
                tbx7_zdjs_byss.Text = "0";
            }
            if (tbx7_zdjs_bybs.Text == "")
            {
                tbx7_zdjs_bybs.Text = "0";
            }

            str_sql = " update yxxwlw_cpry set zdjs_xm='" + tbx7_zdjs_xm.Text + "'," +
                      " zdjs_csny='" + txt7_zdjs_csny.Value + "'," +
                      " zdjs_xingbie='" + ddlist7_zdjs_xingbie.SelectedValue + "'," +
                      " zdjs_zzxl='" + ddlist7_zdjs_zzxl.SelectedValue + "'," +
                      " zdjs_zgxw='" + ddlist7_zdjs_zgxw.SelectedValue + "', " +
                      " zdjs_sfys=" + ddlist7_zdjs_sfys.SelectedValue + ", " +
                      " zdjs_srbdny='" + Txt7_zdjs_srbdny.Value + "', " +
                      " zdjs_srsdny='" + Txt7_zdjs_srsdny.Value + "', " +
                      " zdjs_yjfx='" + tbx7_zdjs_yjfx.Text + "', " +
                      " zdjs_dsdh='" + tbx7_zdjs_dsdh.Text + "'," +
                      " zdjs_dsyx='" + tbx7_zdjs_dsyx.Text + "', " +
                      " zdjs_xzrs=" + Convert.ToInt16(tbx7_zdjs_xzrs.Text) + ", " +
                      " zdjs_zdss=" + Convert.ToInt16(tbx7_zdjs_zdss.Text) + ", " +
                      " zdjs_zdbs=" + Convert.ToInt16(tbx7_zdjs_zdbs.Text) + ", " +
                      " zdjs_byss=" + Convert.ToInt16(tbx7_zdjs_byss.Text) + ", " +
                      " zdjs_bybs=" + Convert.ToInt16(tbx7_zdjs_bybs.Text) + ", " +
                      " jzbd_gzdw='" + tbx7_jzbd_gzdw.Text + "'," +
                      " xrzw='" + tbx7_xrzw.Text + "'," +
                      " edit_rq='" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "' " +
                      " where sfzh = '" + Session["sfzh"].ToString() + "'";
        }

        if (DBFun.ExecuteUpdate(str_sql))
        {
            if (Session["msg"].ToString() == "no")
            {
                Session["msg"] = "yes";
            }
            else
            {
                if (Table3.Visible || Table5.Visible)
                {
                    Response.Write("<script>alert('添加成功!');</script>");
                }
                else
                {
                    Response.Write("<script>alert('保存成功!');</script>");
                }
                //    Response.Write("<script>alert('保存成功,申报材料已填写完毕,如需修改请点击相应模块!');</script>");
            }
            bindData();
            return(1);
        }
        else
        {
            Response.Write("<script>alert('保存失败!');</script>");
            return(-1);
        }
    }