Exemplo n.º 1
0
    private void bindData()
    {
        string strqry = "SELECT ID,sfzh, yourname,xingbie, " +
                        "iif(DateDiff('YYYY', CDate(iif(isnull(birth),now,iif(birth='',now(),birth))),Format(Now(),'yyyy-mm-dd'))=0,'',DateDiff('YYYY', CDate(iif(isnull(birth),now,iif(birth='',now(),birth))),Format(Now(),'yyyy-mm-dd'))) AS nianling," +
                        "xrgw, gwxl, iif(isnull(tj_flag),'未审核',tj_flag) as tuijian,edit_flag,fenlei FROM ej_cpry where dw = '" + Session["admin_id"].ToString() + "' ";

        if (RadioButtonList1.SelectedValue != "all")
        {
            strqry = strqry + " and iif(isnull(tj_flag),'未审核',tj_flag) = '" + RadioButtonList1.SelectedValue + "'";
        }
        strqry = strqry + " ORDER BY ID;";
        Session["dv_detail"] = DBFun.GetDataView(strqry);
        DataView dv = (DataView)Session["dv_detail"];

        GridView1.DataSource = dv;
        GridView1.DataBind();

        string          str_sfzh;
        RadioButtonList rbtnList_1;

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            str_sfzh   = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["sfzh"].ToString();
            rbtnList_1 = (RadioButtonList)this.GridView1.Rows[i].FindControl("rbtnList_xg");
            rbtnList_1.SelectedValue = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["edit_flag"].ToString();
        }

        //strqry = " SELECT iif(isnull(csgz),'未填写',csgz), count(csgz) AS num " +
        //        "    FROM cpry " +
        //        "   WHERE gzdw = '" + Session["admin_id"].ToString() + "'";
        //if (RadioButtonList1.SelectedValue != "all") strqry += " and iif(isnull(tj_flag),'未审核',tj_flag) = '" + RadioButtonList1.SelectedValue + "'";
        //strqry += " GROUP BY csgz;";
        //OleDbDataReader reader = DBFun.dataReader(strqry);
        //lbl_tongji.Text = "";
        //if (reader != null)
        //{
        //    try
        //    {
        //        while (reader.Read())
        //        {
        //            lbl_tongji.Text = lbl_tongji.Text + reader.GetString(0).ToString() + ":" + reader.GetInt32(1).ToString() + "<br/>";
        //        }
        //    }
        //    catch { }
        //}
        //DBFun.closeDataReader(ref reader);
    }
Exemplo n.º 2
0
    protected void bindData()
    {
        //str_sql = " SELECT a.appNo,a.jsh, appyear, a.ktmc, a.sqbm, a.sqr, xmzt,edit_flag, iif(edit_flag,'否','是') as tj, c.tj_flag AS bmtj " +
        //          "   FROM t_teacher_list as a, t_teacher as b, t_dict as c "+
        //          "  WHERE a.jsh = b.jsh and a.sqbm = c.name and flm=13 and not edit_flag and sh1 and c.tj_flag ";
        str_sql = "SELECT appNo, a.ktmc, Status,a.sqbm, a.sqr,c.name as xmzt," +
                  "       cGroup1, a.id, pm, a.xmbh, zzlb, " +
                  "       mid(appNo,5) as jsh, " +
                  "       left(appNo,4) as appYear " +
                  "FROM   t_teacher_list a,t_teacher b, t_dict c " +
                  "WHERE  mid(a.appNo,5) = b.jsh and flm=11 and status = bm " +
                  //"  and left(appNo,4) = year(date()) " +
                  //"  and a.sqbm in (select name from t_dict where flm=13 and tj_flag) " +
                  "  and Status between (select url from t_dict where flm= 11 and bm = 4) and (select url from t_dict where flm= 11 and bm = 5)";
        if (ddlist_year.SelectedValue != "")
        {
            str_sql += " and ( left(appNo,4) = " + ddlist_year.SelectedValue + ") ";
        }
        if (ddlist_xmzt0.SelectedIndex != 0)
        {
            str_sql += " and ( Status = " + ddlist_xmzt0.SelectedValue + ") ";
        }
        if (ddlist_sqbm.SelectedIndex != 0)
        {
            str_sql += " and ( a.sqbm = '" + ddlist_sqbm.SelectedValue + "') ";
        }
        if (tbx_spm.Text.Trim() != "")
        {
            str_sql += " and (( spm LIKE '%" + tbx_spm.Text.Trim() + "%') " +
                       " or  ( a.sqr LIKE '%" + tbx_spm.Text.Trim() + "%') " +
                       " or  ( mid(appNo,5) LIKE '%" + tbx_spm.Text.Trim() + "%')) ";
        }
        str_sql         += " order by sqbm,sqr";
        ViewState["sql"] = str_sql;
        dv = DBFun.GetDataView(str_sql);
        PagedDataSource pds = new PagedDataSource();

        pds.AllowPaging      = true;
        pds.PageSize         = AspNetPager1.PageSize;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        pds.DataSource       = dv;
        GridView1.DataSource = pds;
        GridView1.DataBind();
        AspNetPager1.RecordCount = dv.Table.Rows.Count;
        TD_AddUser.Visible       = false;
    }
Exemplo n.º 3
0
    protected void bindData()
    {
        string   str_sql = "select * from t_pszj where appyear=year(date()) ";
        DataView dv      = DBFun.GetDataView(str_sql);

        GridView1.DataSource = dv;
        GridView1.DataBind();
        Session["dv_detail"] = dv;
        CommFun.Add_ConfirmAttrib(GridView1, "lbtn_del");
        RadioButtonList rbl_fnd;

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            rbl_fnd = (RadioButtonList)this.GridView1.Rows[i].FindControl("rbl_tj");
            rbl_fnd.SelectedValue = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["tj_flag"].ToString();
        }
    }
Exemplo n.º 4
0
    protected void btn_Ok_Click(object sender, EventArgs e)
    {
        //操作
        string strOpid = "";
        string strsql;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("sle");
            string   id  = GridView1.Rows[i].Cells[0].Text;
            if (ckb.Checked)
            {
                if (strOpid == "")
                {
                    strOpid += ("(" + id);
                }
                else
                {
                    strOpid += ("," + id);
                }
            }
        }
        strOpid += ")";
        if (strOpid == ")")
        {
            Response.Write("<script>alert('没有选中任何记录!');history.go(-1);</script>");
        }
        else
        {
            if (dw_Operation.Text == "0")
            {
                //删除
                strsql = string.Format("delete from T_films where id in {0}", strOpid);
                if (DBFun.ExecuteUpdate(strsql))
                {
                    strsql = string.Format("Delete From T_film_Detail where filmid in {0}", strOpid);
                    DBFun.ExecuteSql(strsql);      //删除实际文件路径
                    ltl_Msg.Text             = "删除成功!";
                    dvlist                   = DBFun.GetDataView(Session["strqry"].ToString());
                    AspNetPager1.RecordCount = dvlist.Table.Rows.Count;
                    Cache["dvlist"]          = dvlist;
                    bindData();
                }
            }
        }
    }
Exemplo n.º 5
0
    protected void btn_commit_Click(object sender, EventArgs e)
    {
        str_sql = ViewState["sql"].ToString();
        dv      = DBFun.GetDataView(str_sql);
        string          str_appNo;
        bool            b_vote;
        RadioButtonList rbl_find;

        for (int i = 0; i < dv.Table.Rows.Count; i++)
        {
            str_appNo = dv.Table.Rows[i]["appNo"].ToString();
            rbl_find  = (RadioButtonList)GridView1.Rows[i].FindControl("rbl_vote");
            b_vote    = Convert.ToBoolean(rbl_find.SelectedValue);
            str_sql   = "update t_zjry2 set sftj = " + b_vote + " where appNo = '" + str_appNo + "' and zjNO = '" + Session["admin_id"].ToString() + "'";
            if (!DBFun.ExecuteUpdate(str_sql))
            {
                Response.Write("<script>alert('保存失败!');</script>");
                return;
            }
        }

        //str_sql = " SELECT count(*) "
        //               + " FROM   t_teacher_list a,t_zjry2 b"
        //               + " WHERE  a.appNo = b.appNo"
        //               + " AND    left(a.appNo,4)= year(date()) "
        //               + " and    zjNo ='" + Session["admin_id"].ToString() + "'"
        //               + " and    fs_pjys_sum is null";
        //if (Convert.ToInt16( DBFun.ExecuteScalar(str_sql)) > 0)
        //{
        //    Response.Write("<script>alert('您还有尚未评分的项目,请对所有项目评分后再提交!');</script>");
        //    return;
        //}
        str_sql = " update t_ExpertList2 set tj_flag = true "
                  + " where  appyear= year(date()) "
                  + " and    LoginName = '" + Session["admin_id"].ToString() + "'";
        if (DBFun.ExecuteUpdate(str_sql))
        {
            Response.Write("<script>alert('提交成功!');location.replace(location.href);</script>");
        }
        else
        {
            Response.Write("<script>alert('提交失败!');</script>");
            return;
        }
    }
Exemplo n.º 6
0
 protected void GridViewEdit(int RowIndex)
 {
     imgbtn_save.ImageUrl = "./img/save.gif";
     if (Table3.Visible)
     {
         str_sql     = ViewState["sql3"].ToString();
         dv          = DBFun.GetDataView(str_sql);
         lbl_id.Text = dv.Table.Rows[RowIndex]["id"].ToString();
         tbx3_rksj.Focus();
         tbx3_rksj.Text = dv.Table.Rows[RowIndex]["rksj"].ToString();
         tbx3_kcmc.Text = dv.Table.Rows[RowIndex]["kcmc"].ToString();
         tbx3_skdx.Text = dv.Table.Rows[RowIndex]["skdx"].ToString();
         tbx3_xs.Text   = dv.Table.Rows[RowIndex]["xs"].ToString();
         tbx3_szdw.Text = dv.Table.Rows[RowIndex]["szdw"].ToString();
         //try { ddlist3_zccy.SelectedValue = dv.Table.Rows[RowIndex]["zccy"].ToString(); }
         //catch { }
         //try { ddlist3_sfjt.SelectedValue = dv.Table.Rows[RowIndex]["sfjt"].ToString(); }
         //catch { }
     }
     else if (Table4.Visible)
     {
         str_sql     = ViewState["sql4"].ToString();
         dv          = DBFun.GetDataView(str_sql);
         lbl_id.Text = dv.Table.Rows[RowIndex]["id"].ToString();
         tbx4_qzsj.Focus();
         tbx4_qzsj.Text = dv.Table.Rows[RowIndex]["qzsj"].ToString();
         tbx4_xmmc.Text = dv.Table.Rows[RowIndex]["xmmc"].ToString();
         tbx4_lxdw.Text = dv.Table.Rows[RowIndex]["lxdw"].ToString();
         tbx4_hjqk.Text = dv.Table.Rows[RowIndex]["hjqk"].ToString();
     }
     else if (Table5.Visible)
     {
         str_sql     = ViewState["sql5"].ToString();
         dv          = DBFun.GetDataView(str_sql);
         lbl_id.Text = dv.Table.Rows[RowIndex]["id"].ToString();
         tbx5_xm.Focus();
         tbx5_jsh.Text = dv.Table.Rows[RowIndex]["cyjsh"].ToString();
         tbx5_xm.Text  = dv.Table.Rows[RowIndex]["xm"].ToString();
         tbx5_zc.Text  = dv.Table.Rows[RowIndex]["zc"].ToString();
         tbx5_zy.Text  = dv.Table.Rows[RowIndex]["zy"].ToString();
         tbx5_fg.Text  = dv.Table.Rows[RowIndex]["fg"].ToString();
         try { ddlist5_xw.SelectedValue = dv.Table.Rows[RowIndex]["xw"].ToString(); }
         catch { }
     }
 }
Exemplo n.º 7
0
    private void bindData()
    {
        string strqry = "SELECT ID,sfzh, yourname,name, " +
                        " cplb,lw_ctitle,ejxk_mc,zdjs_xm,edit_flag,sh_flag" +
                        " FROM yxxwlw_cpry,t_dict" +
                        " where url = tjdw and t_dict.tj_flag = true and edit_flag = false and yxxwlw_cpry.tj_flag = '推荐' ";

        if (RadioButtonList1.SelectedValue != "all")
        {
            strqry = strqry + " and sh_flag = '" + RadioButtonList1.SelectedValue + "'";
        }
        strqry = strqry + " ORDER BY name asc , ID asc;";
        Session["dv_detail"] = DBFun.GetDataView(strqry);
        DataView dv = (DataView)Session["dv_detail"];

        GridView1.DataSource = dv;
        GridView1.DataBind();
    }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string strqry = "select url From t_dict where flm=8 and bm=11";
         if (Convert.ToDateTime(DBFun.ExecuteScalar(strqry)) <= DateTime.Now)
         {
             Response.Write(@"<script>alert('评审截止日期已到!');window.history.go(-1);</script>");
             return;
         }
         string str_sql;
         str_sql = "SELECT top 10 hot,leixing,id,iif(len(title)>23,left(title,22)+'…',title)+'('+format(shijian,'mm-dd')+')' as biaoti FROM news where leibie = '新闻' and leixing='2'  order by shijian asc,id asc";
         DataView dv = DBFun.GetDataView(str_sql);
         GV_news.DataSource = dv;
         GV_news.DataBind();
         Session["dv_news"] = dv;
     }
 }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    CommFun.IsAdmin();

                    string strqry = "select * From T_HotSearch order by scount desc";
                    GridView1.DataSource = DBFun.GetDataView(strqry);
                    GridView1.DataBind();
                }
                catch (Exception ex)
                {
                    Response.Write("执行时出错!" + ex.Message);
                }
            }
        }
Exemplo n.º 10
0
    protected void CommitInfoxmcy()
    {
        str_sql = "exec Q_Para_Cyqk_By_appNo '" + Session["appNo"].ToString() + "'";
        dv      = DBFun.GetDataView(str_sql);
        if (dv == null || dv.Table.Rows.Count == 0)
        {
            return;
        }

        string str_xmcy = "";

        for (int i = 0; i < dv.Table.Rows.Count; i++)
        {
            str_xmcy += "," + dv.Table.Rows[i]["xm"].ToString();
        }
        str_sql = "update t_teacher_list set xmcy = '" + str_xmcy.Substring(1) + "' where appNo = '" + Session["appNo"].ToString() + "'";
        DBFun.ExecuteSql(str_sql);
    }
Exemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["admin_name"] == null)
     {
         Response.Redirect("../SessionTimeOut.aspx?type=top");
     }
     if (!CommFun.IsAdmin(Session["admin_name"].ToString()))
     {
         Response.Redirect("../SessionTimeOut.aspx?type=isnotadmin");
     }
     if (!IsPostBack)
     {
         DataView dv = DBFun.GetDataView("select * from master;");
         GridView1.DataSource = dv;
         GridView1.DataBind();
         Session["dv_detail"] = dv;
     }
 }
Exemplo n.º 12
0
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        str_sql = ViewState["sql"].ToString();
        dv      = DBFun.GetDataView(str_sql);
        int    i_rownum = e.NewEditIndex + (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize;
        string str_xmbh = dv.Table.Rows[i_rownum]["xmbh"].ToString();

        str_sql           = "select * from t_jf where xmbh = '" + str_xmbh + "'";
        ViewState["sql1"] = str_sql;
        ViewState["xmbh"] = str_xmbh;
        //使选中行颜色与其他行颜色不同
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            GridView1.Rows[i].BackColor = System.Drawing.Color.White;
        }
        GridView1.Rows[e.NewEditIndex].BackColor = System.Drawing.Color.RosyBrown;
        bindData1();
    }
Exemplo n.º 13
0
    protected void btn_Hand_Click(object sender, EventArgs e)
    {
        string strOpid = "";
        string strsql;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("cbx_select");
            string   id  = GridView1.Rows[i].Cells[1].Text;
            if (ckb.Checked)
            {
                if (strOpid == "")
                {
                    strOpid += ("('" + id);
                }
                else
                {
                    strOpid += ("','" + id);
                }
            }
        }
        strOpid += "')";
        if (strOpid == "')")
        {
            Response.Write("<script>alert('没有选中任何记录!');history.go(-1);</script>");
            return;
        }
        else
        {
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                str_sql = ViewState["sql"].ToString();
                dv      = DBFun.GetDataView(str_sql);
                str_sql = string.Format("update t_ExpertList3 set tj_flag = " + true + " where appyear=year(date()) and LoginName in {0}", strOpid);

                if (DBFun.ExecuteUpdate(str_sql))
                {
                    bindData();
                }
            }
            Response.Write("<script>alert('修改成功!');</script>");
            bindData();
        }
    }
Exemplo n.º 14
0
    protected void bindData()
    {
        str_sql = "select a.LoginName,UserName,szbm,zc,zy,jb,tj_flag,cGroup from t_Expert as a,t_ExpertList3 as b " +
                  " where a.LoginName=b.LoginName and appyear=year(date()) ";
        if (ddlist_Group.SelectedIndex != 0)
        {
            str_sql += " and cGroup = '" + ddlist_Group.SelectedValue + "'";
        }
        if (ddlist_type.SelectedIndex != 0)
        {
            str_sql += " and " + ddlist_type.SelectedValue + " like '%" + tbx_search.Text.Trim() + "%'";
        }
        str_sql         += " order by a.LoginName";
        ViewState["sql"] = str_sql;
        dv = DBFun.GetDataView(str_sql);
        PagedDataSource pds = new PagedDataSource();

        pds.AllowPaging      = true;
        pds.PageSize         = AspNetPager1.PageSize;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        pds.DataSource       = dv;
        GridView1.DataSource = pds;
        GridView1.DataBind();
        AspNetPager1.RecordCount = dv.Table.Rows.Count;

        //CommFun.Add_ConfirmAttrib(GridView1, "lbtn_del");
        CheckBox cbx_fnd;
        Label    lbl;

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            lbl = (Label)this.GridView1.Rows[i].FindControl("lbl_Flag");
            if ((bool)dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["tj_flag"])
            {
                lbl.Text      = "已提交";
                lbl.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lbl.Text      = "未提交";
                lbl.ForeColor = System.Drawing.Color.Red;
            }
        }
    }
Exemplo n.º 15
0
    protected void bindData()
    {
        str_sql = " select appNo,sqr,ktmc ,iif(zjtp0_1,'是','否') as tp1," +
                  " iif(zjtp0_2,'是','否') as tp2," +
                  " iif(zjtp0_3,'是','否') as tp3," +
                  " iif(zjtp0_4,'是','否') as tp4," +
                  " iif(zjtp0_5,'是','否') as tp5," +
                  " pm0,ps0,cGroup0 " +
                  " from   t_teacher_list " +
                  " where  left(appNo,4)=year(date()) " +
                  //" and    sqbm in (select name from t_dict where flm= 13 and tj_flag) "+
                  " and    Status >= (select url from t_dict where flm= 11 and bm = 3)";
        if (ddlist_year.SelectedValue != "")
        {
            str_sql += " and ( left(appNo,4) = " + ddlist_year.SelectedValue + ") ";
        }
        if (ddlist_xmzt0.SelectedIndex != 0)
        {
            str_sql += " and ( Status = " + ddlist_xmzt0.SelectedValue + ") ";
        }
        if (ddlist_cGroup.SelectedIndex != 0)
        {
            str_sql += " and ( cGroup0 = '" + ddlist_cGroup.SelectedValue + "') ";
        }
        if (tbx_spm.Text.Trim() != "")
        {
            str_sql += " and (( spm LIKE '%" + tbx_spm.Text.Trim() + "%') " +
                       " or  ( sqr LIKE '%" + tbx_spm.Text.Trim() + "%') " +
                       " or  ( mid(appNo,5) LIKE '%" + tbx_spm.Text.Trim() + "%')) ";
        }
        str_sql         += " order by sqbm,sqr ";
        ViewState["sql"] = str_sql;
        dv = DBFun.GetDataView(str_sql);
        PagedDataSource pds = new PagedDataSource();

        pds.AllowPaging      = true;
        pds.PageSize         = AspNetPager1.PageSize;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        pds.DataSource       = dv;
        GridView1.DataSource = pds;
        GridView1.DataBind();
        AspNetPager1.RecordCount = dv.Table.Rows.Count;
    }
Exemplo n.º 16
0
    protected void btn_calc_Click(object sender, EventArgs e)
    {
        string str_sql = "alter table cpry add column score_xmrw numeric,score_lzbg numeric,score_yjcg numeric";

        try { DBFun.ExecuteSql(str_sql); }
        catch { }

        str_sql = "select sfzh,sbzw from cpry,t_dict " +
                  "where url=gzdw and edit_flag=false and cpry.tj_flag='推荐' and sh_flag='通过' and t_dict.tj_flag=true  order by gzdw asc, ID asc;";
        DataView dv = DBFun.dataView(str_sql);
        DataView dv_zj;

        for (int i = 0; i < dv.Table.Rows.Count; i++)
        {
            Session["sfzh"] = dv.Table.Rows[i]["sfzh"].ToString();
            string str_score = "";
            if (dv.Table.Rows[i]["sbzw"].ToString() == "研究员")
            {
                str_score = GetScore_yjy();
            }
            else
            {
                str_score = GetScore_gg();
            }
            string str_s1, str_s2, str_s3, str_s4;
            str_s1 = str_score.Substring(0, str_score.IndexOf(","));
            str_s2 = str_score.Substring(str_score.IndexOf(",") + 1, str_score.LastIndexOf(",") - str_score.IndexOf(",") - 1);
            str_s3 = str_score.Substring(str_score.LastIndexOf(",") + 1);
            //计算专家评分
            string strqry = "select iif(isnull(fs_pjys_sum),'0',fs_pjys_sum) as fs_sum,zj_sfzh,cpry_sfzh,jypj,UserName,zjdm,iif(isnull(fs_pjys_sum),'否','是') as sfpj from zjry,pszj where sfzh = zj_sfzh and pszj.flag = 1 ";
            strqry = strqry + " and cpry_sfzh = '" + dv.Table.Rows[i]["sfzh"].ToString() + "'";
            dv_zj  = DBFun.GetDataView(strqry);
            str_s4 = PrivateFun.Get_Score_zj(dv_zj);

            str_sql = "update cpry set score_xmrw = " + str_s1 + ",score_lzbg=" + str_s2 + ",score_yjcg=" + str_s3 + ",score_zj=" + str_s4 + " where sfzh = '" + Session["sfzh"].ToString() + "';";
            if (!DBFun.ExecuteUpdate(str_sql))
            {
                Response.Write("<script>alert('计算分数失败,请重新计算!');</script>");
                return;
            }
        }
        Response.Write("<script>alert('计算分数成功!');</script>");
    }
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    CommFun.IsAdmin();

                    DBFun.FillDwList(dw_class, "select ID,caption From T_Class");
                    string strqry = "select * From T_IndexPage";
                    GridView1.DataSource = DBFun.GetDataView(strqry);
                    GridView1.DataBind();
                }
                catch (Exception ex)
                {
                    Response.Write("执行时出错!" + ex.Message);
                }
            }
        }
Exemplo n.º 18
0
    private void bindData()
    {
        string strqry = "SELECT ID,sfzh, yourname,xingbie, DateDiff('YYYY', CDate(birth),Format(Now(),'yyyy-mm-dd')) AS nianling, xrzw, sbzw, tj_flag,edit_flag,fenlei FROM cpry where edit_flag = false and gzdw = '" + Session["admin_id"].ToString() + "' ";

        if (Session["admin_type"].ToString() == "zhuanjia")
        {
            strqry = "SELECT cpry.id,cpry.sfzh ,yourname,xingbie, DateDiff('YYYY', CDate(birth),Format(Now(),'yyyy-mm-dd')) AS nianling,xrzw,sbzw,tj_flag from cpry,zjry where edit_flag = false and zjid = " + Session["admin_id"].ToString() + " and cpry.sfzh=zjry.sfzh";
        }
        if (RadioButtonList1.SelectedValue != "all")
        {
            strqry = strqry + " and tj_flag = '" + RadioButtonList1.SelectedValue + "'";
        }
        strqry = strqry + " ORDER BY ID;";

        DataView dv = DBFun.GetDataView(strqry);//dv null 为什么

        Session["dv_detail"] = dv;
        GridView1.DataSource = dv;
        GridView1.DataBind();
        //for (int i = 0; i < GridView1.Rows.Count; i++)
        //{
        //    CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("ckb_Sle");
        //    ckb.Checked = Convert.ToBoolean(dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["edit_flag"].ToString());
        //}

        strqry = " SELECT csgz, count(csgz) AS num " +
                 "    FROM cpry " +
                 "   WHERE gzdw = '" + Session["admin_id"].ToString() + "' ";
        if (RadioButtonList1.SelectedValue != "all")
        {
            strqry += " and tj_flag = '" + RadioButtonList1.SelectedValue + "'";
        }
        strqry += " GROUP BY csgz;";
        OleDbDataReader reader = DBFun.dataReader(strqry);

        lbl_tongji.Text = "";
        while (reader.Read())
        {
            lbl_tongji.Text = lbl_tongji.Text + reader.GetString(0).ToString() + ":" + reader.GetInt32(1).ToString() + "<br/>";
        }
        DBFun.closeDataReader(ref reader);
    }
Exemplo n.º 19
0
    protected void btn_expAllInfo_Click(object sender, EventArgs e)
    {
        HttpResponse resp;

        resp = Page.Response;
        resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
        resp.AppendHeader("Content-Disposition", "attachment;filename=1.xls");
        string   colHeaders = "";
        string   str_sql    = "select sfzh from yxxwlw_cpry where sh_flag='通过' and edit_flag = false and tj_flag='推荐' order by tjdw asc, ID asc";
        DataView dv         = DBFun.GetDataView(str_sql);

        for (int i = 0; i < dv.Table.Rows.Count; i++)
        {
            colHeaders += GetPersonInfo(dv.Table.Rows[i]["sfzh"].ToString()) + "\n\n";
        }

        resp.Write(colHeaders);
        //写缓冲区中的数据到HTTP头文件中
        resp.End();
    }
Exemplo n.º 20
0
    /// <summary>
    /// 填充GridView FillGridView
    /// </summary>
    /// <param name="str_sql">得到数据的SQL语句</param>
    /// <param name="gv_bind">要绑定的Gridview</param>
    /// <param name="b_lbtn"> 是否包含删除按钮</param>
    /// <returns>包含数据的DataView</returns>
    #region  填充GridView
    public static DataView FillGridView(string str_sql, GridView gv_bind, bool b_lbtn)
    {
        DataView dv = DBFun.GetDataView(str_sql);

        gv_bind.DataSource = dv;
        gv_bind.DataBind();
        if (b_lbtn && dv != null)
        {
            LinkButton lbtn;
            for (int i = 0; i < gv_bind.Rows.Count; i++)//dv.Table
            {
                lbtn = (LinkButton)gv_bind.Rows[i].FindControl("lbtn_del");
                if (lbtn != null)
                {
                    lbtn.Attributes.Add("onclick", "return   confirm   (\"确定要删除吗?\");");
                }
            }
        }
        return(dv);
    }
Exemplo n.º 21
0
    protected void bindData_zj()
    {
        string          str_sql  = "select zjid,ryid from zjry where ryid = " + lbl_zjid.Text;
        OleDbDataReader reader   = DBFun.dataReader(str_sql);
        string          str_zjid = "0,";

        while (reader.Read())
        {
            str_zjid = str_zjid + reader["zjid"].ToString() + ",";
        }
        DBFun.closeDataReader(ref reader);
        str_sql = "";
        str_sql = str_sql + " where id in (" + str_zjid + ") ORDER BY ID;";
        Session["dv_zhuanjia"] = DBFun.GetDataView(str_sql);
        DataView dv = (DataView)Session["dv_zhuanjia"];

        gv_zhuanjia.DataSource = dv;
        gv_zhuanjia.DataBind();
        gv_zhuanjia.Visible = true;
    }
Exemplo n.º 22
0
    protected void NewRow()
    {
        str_sql = ViewState["sql1"].ToString();
        dv      = DBFun.GetDataView(str_sql);
        DataRow dr = dv.Table.NewRow();

        dr["je"] = 0;
        dr["rq"] = string.Format(DateTime.Today.ToString(), "yyyy-MM-dd");
        dv.Table.Rows.Add(dr);
        PagedDataSource pds = new PagedDataSource();

        pds.AllowPaging        = true;
        pds.PageSize           = AspNetPager2.PageSize;
        pds.CurrentPageIndex   = AspNetPager2.CurrentPageIndex - 1;
        pds.DataSource         = dv;
        GridView2.DataSource   = pds;
        GridView2.DataKeyNames = new string[] { "ID" };
        GridView2.DataBind();
        AspNetPager2.RecordCount = dv.Table.Rows.Count;
    }
Exemplo n.º 23
0
    protected void btn_confirm1_Click(object sender, EventArgs e)
    {
        string str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_pwd_new.Text, "MD5");
        string str_sql = string.Format("Insert Into Master (admin_name,Username,admin_pwd,flag) Values ('{0}','{1}','{2}',{3})",
                                       tbx_admin_name.Text.Trim(), tbx_user_name.Text.Trim(), str_pwd, 1);

        if (DBFun.ExecuteUpdate(str_sql))
        {
            Response.Write("<script>alert('用户添加成功!');</script>");
            DataView dv = DBFun.GetDataView("select * from master;");
            GridView1.DataSource = dv;
            GridView1.DataBind();
            Session["dv_detail"] = dv;
            TD_AddUser.Visible   = false;
        }
        else
        {
            Response.Write("<script>alert('用户添加失败!');</script>");
        }
    }
Exemplo n.º 24
0
    private void bindData()
    {
        string strqry = "exec Q_Para_CommitList_By_sqbm '" + Session["dept_name"].ToString() + "' ";

        Session["dv_detail"] = DBFun.GetDataView(strqry);
        DataView dv = (DataView)Session["dv_detail"];

        GridView1.DataSource = dv;
        GridView1.DataBind();

        string          str_sfzh;
        RadioButtonList rbtnList_1;

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            str_sfzh   = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["jsh"].ToString();
            rbtnList_1 = (RadioButtonList)this.GridView1.Rows[i].FindControl("rbtnList_xg");
            rbtnList_1.SelectedValue = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["edit_flag"].ToString();
        }
    }
Exemplo n.º 25
0
    //参评组 数据绑定 传入参数 参评组ID
    protected void bindData_cpry(string str_cpzid)
    {
        //string str_sql = "select zjid,ryid from zjry where zjid = " + lbl_zjid.Text;
        //OleDbDataReader reader = DBFun.dataReader(str_sql);
        //string str_ryid = "0,";
        //while (reader.Read())
        //{
        //    str_ryid = str_ryid + reader["ryid"].ToString() + ",";
        //}
        //DBFun.closeDataReader(ref reader);
        string str_sql = "SELECT ID,sfzh, yourname,xingbie, " +
                         "iif(DateDiff('YYYY', CDate(iif(isnull(birth),now,birth)),Format(Now(),'yyyy-mm-dd'))=0,'',DateDiff('YYYY', CDate(iif(isnull(birth),now,birth)),Format(Now(),'yyyy-mm-dd'))) AS nianling, " +
                         "xrzw, sbzw, sh_flag,edit_flag,fenlei FROM cpry ";

        str_sql            = str_sql + " where fenlei = '" + str_cpzid + "';";
        Session["dv_cpry"] = DBFun.GetDataView(str_sql);
        DataView dv = (DataView)Session["dv_cpry"];

        gv_chengyuan.DataSource = dv;
        gv_chengyuan.DataBind();
    }
Exemplo n.º 26
0
    protected void bindData()
    {
        string str_sql = "exec Q_Para_CommitList_By_sqbm '" + Session["dept_name"].ToString() + "'";

        dv = DBFun.GetDataView(str_sql);
        GridView1.DataSource = dv;
        GridView1.DataBind();
        Session["dv_detail"] = dv;

        CommFun.Add_ConfirmAttrib(GridView1, "lbtn_del");

        str_sql = "select InitPwd from t_dict where flm = 1 and url = '" + Session["dept_id"].ToString() + "'";
        if (DBFun.ExecuteScalar(str_sql) == null)
        {
            tbx_InitPwd.Text = "";
        }
        else
        {
            tbx_InitPwd.Text = DBFun.ExecuteScalar(str_sql).ToString();
        }
    }
Exemplo n.º 27
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        str_sql = ViewState["sql"].ToString();
        dv      = DBFun.GetDataView(str_sql);
        CheckBox ckb;

        ckb = (CheckBox)this.GridView1.Rows[e.RowIndex].FindControl("cbx_HandOn");
        if (ckb.Checked)
        {
            str_sql = "update t_ExpertList3 set tj_flag = " + true + " where appyear=year(date()) and LoginName = '" + dv.Table.Rows[e.RowIndex + GridView1.PageIndex * GridView1.PageSize]["LoginName"].ToString() + "'";
        }
        else
        {
            str_sql = "update t_ExpertList3 set tj_flag = " + false + " where appyear=year(date()) and LoginName = '" + dv.Table.Rows[e.RowIndex + GridView1.PageIndex * GridView1.PageSize]["LoginName"].ToString() + "'";
        }
        if (DBFun.ExecuteUpdate(str_sql))
        {
            Response.Write("<script>alert('修改成功!');</script>");
            bindData();
        }
    }
Exemplo n.º 28
0
    protected void bindData()
    {
        str_sql = " SELECT appNo, a.ktmc, a.sqbm, a.sqr,c.name AS xmzt," +
                  "        mid(appNo,5) as jsh, left(appNo,4) as appyear," +
                  "        cGroup1, a.id, pm, a.xmbh, zzlb " +
                  " FROM   t_teacher_list AS a, t_teacher AS b ,t_dict c " +
                  " WHERE  mid(a.appNo,5) = b.jsh and flm=11 and status = bm " +
                  " and    left(a.appNo,4) =year(date()) " +
                  //"  and a.sqbm in (select name from t_dict where flm=13 and tj_flag) " +
                  " and    Status = (select url from t_dict where flm= 11 and bm = 5)";
        if (ddlist_Group.SelectedIndex != 0)
        {
            str_sql += " and cGroup1 = '" + ddlist_Group.SelectedValue + "' ";
        }
        if (ddlist_type.SelectedIndex != 0)
        {
            str_sql += " and " + ddlist_type.SelectedValue + " like '%" + tbx_search.Text.Trim() + "%' ";
        }
        if (rbl_order.SelectedIndex == 0)
        {
            str_sql += " order by cGroup1,pm";
        }
        else
        {
            str_sql += " order by sqbm,sqr";
        }
        dv = DBFun.GetDataView(str_sql);
        ViewState["sql"] = str_sql;
        PagedDataSource pds = new PagedDataSource();

        pds.AllowPaging       = true;
        pds.PageSize          = AspNetPager1.PageSize;
        AspNetPager1.PageSize = Convert.ToInt16(ddl_PageSize.SelectedValue);
        pds.PageSize          = Convert.ToInt16(ddl_PageSize.SelectedValue);
        pds.CurrentPageIndex  = AspNetPager1.CurrentPageIndex - 1;
        pds.DataSource        = dv;
        GridView1.DataSource  = pds;
        GridView1.DataBind();
        AspNetPager1.RecordCount = dv.Table.Rows.Count;
    }
Exemplo n.º 29
0
    private void bindData()
    {
        string strqry = "SELECT ID,sfzh, yourname,xingbie, " +
                        " iif(DateDiff('YYYY', CDate(iif(isnull(birth),now,birth)),Format(Now(),'yyyy-mm-dd'))=0,'',DateDiff('YYYY', CDate(iif(isnull(birth),now,birth)),Format(Now(),'yyyy-mm-dd'))) AS nianling," +
                        " xrgw, gwxl, sh_flag,edit_flag,fenlei,ej_cpry.tj_flag,t_dict.ej_tj_flag,t_dict.name as gzdw FROM ej_cpry,t_dict" +
                        " where url = dw and t_dict.ej_tj_flag = true and edit_flag = false and ej_cpry.tj_flag = '推荐' ";

        if (RadioButtonList1.SelectedValue != "all")
        {
            strqry = strqry + " and sh_flag = '" + RadioButtonList1.SelectedValue + "'";
        }
        strqry = strqry + " ORDER BY dw asc , ID asc;";
        Session["dv_detail"] = DBFun.GetDataView(strqry);
        DataView dv = (DataView)Session["dv_detail"];

        GridView1.DataSource = dv;
        GridView1.DataBind();
        //for (int i = 0; i < GridView1.Rows.Count; i++)
        //{
        //    CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("ckb_Sle");
        //    ckb.Checked = Convert.ToBoolean(dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["edit_flag"].ToString());
        //}

        //strqry = " select gz,count(gz) as num from " +
        //        " (SELECT iif(isnull(csgz),'未填写',csgz) as gz" +
        //        " FROM cpry ,t_dict" +
        //        " WHERE url = gzdw and t_dict.tj_flag = true and edit_flag = false and cpry.tj_flag = '推荐'";

        //if (RadioButtonList1.SelectedValue != "all")
        //    strqry = strqry + " and sh_flag = '" + RadioButtonList1.SelectedValue + "'";
        //strqry = strqry + ") group by gz";
        //OleDbDataReader reader = DBFun.dataReader(strqry);
        //lbl_tongji.Text = "";
        //while (reader.Read())
        //{
        //    lbl_tongji.Text = lbl_tongji.Text + reader.GetString(0).ToString() + ":" + reader.GetInt32(1).ToString() + "<br/>";

        //}
        //DBFun.closeDataReader(ref reader);
    }
Exemplo n.º 30
0
    protected void btn_Ok_Click(object sender, EventArgs e)
    {
        string strOpid = "";
        string strsql;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("ckb_Sle");
            string   id  = GridView1.Rows[i].Cells[0].Text;
            if (ckb.Checked)
            {
                if (strOpid == "")
                {
                    strOpid += ("(" + id);
                }
                else
                {
                    strOpid += ("," + id);
                }
            }
        }
        strOpid += ")";
        if (strOpid == ")")
        {
            Response.Write("<script>alert('没有选中任何记录!');history.go(-1);</script>");
        }
        else
        {
            //删除
            strsql = string.Format("update news set leibie = '" + dw_class.SelectedValue + "' where id in {0}", strOpid);
            if (DBFun.ExecuteUpdate(strsql))
            {
                Response.Write("<script>alert('移动成功!');</script>");
                string strqry = "select id,title,shijian ,admin,hits,leibie,iif(leixing='0','正高级',iif(leixing='1','专业技术二级',iif(leixing='2','特殊津贴人员',iif(leixing='3','优秀论文')))) as lx from news where leibie = '" + lbl_leibie.Text + "' and leixing='0' order by shijian desc  ";
                Session["dv_detail"] = DBFun.GetDataView(strqry);
                bindData();
            }
        }
    }