private void bindData() { 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 zjry.flag = 1 "; strqry = strqry + " and cpry_sfzh = '" + Session["sfzh"].ToString() + "'"; Session["dv_zj_pingfen"] = DBFun.GetDataView(strqry); DataView dv = (DataView)Session["dv_zj_pingfen"]; GridView1.DataSource = dv; GridView1.DataBind(); lbl_sum.Text = "得分:" + PrivateFun.Get_Score_zj(dv); GridView1.ShowFooter = true; GridView1.Columns[2].FooterText = lbl_sum.Text; //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); }
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>"); }