protected void move(int i_RowNum, string str_Direct) { string str_sql = "SELECT * from t_cyqk where appyear = 2015 and jsh = '1996196701' order by id"; OleDbDataAdapter OleAdp = DBFun.UpdateDataSet(str_sql); DataSet Ds = new DataSet(); OleAdp.Fill(Ds, "aa"); GridView1.DataSource = Ds.Tables[0].DefaultView; GridView1.DataBind(); if (i_RowNum >= 0 && i_RowNum < Ds.Tables[0].Rows.Count) { if (str_Direct.ToUpper() == "UP") { if (i_RowNum == 0) { Response.Write("<script>alert('已经是第一行,不能再上移了!');</script>"); return; } Ds.Tables[0].Rows[i_RowNum]["ID"] = i_RowNum; Ds.Tables[0].Rows[i_RowNum - 1]["ID"] = i_RowNum + 1; } else { if (i_RowNum == Ds.Tables[0].Rows.Count - 1) { Response.Write("<script>alert('已经是最后一行,不能再下移了!');</script>"); return; } Ds.Tables[0].Rows[i_RowNum]["ID"] = i_RowNum + 2; Ds.Tables[0].Rows[i_RowNum + 1]["ID"] = i_RowNum + 1; } } //Ds.AcceptChanges(); OleDbCommandBuilder odcb = new OleDbCommandBuilder(OleAdp); Ds.Tables[0].GetChanges(); int i_return = OleAdp.Update(Ds, "aa"); Ds.Tables[0].AcceptChanges(); DataView dv = new DataView(); dv.Table = Ds.Tables[0]; dv.Sort = "id asc"; GridView2.DataSource = dv; GridView2.DataBind(); if (i_return != 0) { Response.Write("<script>alert('成功!');</script>"); } else { Response.Write("<script>alert('失败!');</script>"); } OleAdp.Dispose(); Ds.Dispose(); }
protected void btn_Ok_Click(object sender, EventArgs e) { //JY2014B25 str_sql = " SELECT a.jsh, appyear, a.xmbh,zzlb " + " FROM t_teacher_list AS a " + " WHERE appYear=year(date()) and a.jsh in (SELECT a.jsh 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 sh2 and c.tj_flag and xmzt = '在研' order by sqbm,sqr) " + " order by sqbm,sqr"; OleDbDataAdapter OleAdp = DBFun.UpdateDataSet(str_sql); DataSet Ds = new DataSet(); OleAdp.Fill(Ds, "aa"); string str_zzlb; int i_zd = 0, i_yb = 0, i_bh; for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { str_zzlb = Ds.Tables[0].Rows[i]["zzlb"].ToString(); if (str_zzlb == "重点") { str_zzlb = "A"; i_zd++; i_bh = i_zd; } else { str_zzlb = "B"; i_yb++; i_bh = i_yb; } Ds.Tables[0].Rows[i]["xmbh"] = "JY" + DateTime.Today.Year.ToString() + str_zzlb + i_bh; } //Ds.AcceptChanges(); OleDbCommandBuilder odcb = new OleDbCommandBuilder(OleAdp); Ds.Tables[0].GetChanges(); int i_return = OleAdp.Update(Ds, "aa"); Ds.Tables[0].AcceptChanges(); bindData(); if (i_return != 0) { Response.Write("<script>alert('分配成功!');</script>"); } else { Response.Write("<script>alert('分配失败!');</script>"); } OleAdp.Dispose(); Ds.Dispose(); }
protected void move(int i_RowNum, string str_Direct, string as_Sql) { OleDbDataAdapter OleAdp = DBFun.UpdateDataSet(as_Sql); DataSet Ds = new DataSet(); OleAdp.Fill(Ds, "t1"); if (i_RowNum >= 0 && i_RowNum < Ds.Tables[0].Rows.Count) { if (str_Direct.ToUpper() == "UP") { if (i_RowNum == 0) { Response.Write("<script>alert('已经是第一行,不能再上移了!');</script>"); return; } Ds.Tables[0].Rows[i_RowNum]["orderID"] = i_RowNum; Ds.Tables[0].Rows[i_RowNum - 1]["orderID"] = i_RowNum + 1; } else { if (i_RowNum == Ds.Tables[0].Rows.Count - 1) { Response.Write("<script>alert('已经是最后一行,不能再下移了!');</script>"); return; } Ds.Tables[0].Rows[i_RowNum]["orderID"] = i_RowNum + 2; Ds.Tables[0].Rows[i_RowNum + 1]["orderID"] = i_RowNum + 1; } } //Ds.AcceptChanges(); OleDbCommandBuilder odcb = new OleDbCommandBuilder(OleAdp); Ds.Tables[0].GetChanges(); int i_return = OleAdp.Update(Ds, "t1"); Ds.Tables[0].AcceptChanges(); //DataView dv = new DataView(); //dv.Table = Ds.Tables[0]; //dv.Sort = "orderid asc"; //gv_jxgzjl.DataSource = dv; //gv_jxgzjl.DataBind(); //if (i_return != 0) // Response.Write("<script>alert('成功!');</script>"); //else // Response.Write("<script>alert('失败!');</script>"); odcb.Dispose(); OleAdp.Dispose(); Ds.Dispose(); bindData(); }
protected void btn_Ok_Click(object sender, EventArgs e) { //JY2014B25 //编码规则:前两位JY;接下来四位是年2015;下一位A代表资助类别为重点,B代表一般项目;最后两位为序号 //str_sql = " SELECT appNo,mid(appNo,5) as jsh, left(appNo,4) as appyear, xmbh,zzlb " + // " FROM t_teacher_list " + // " WHERE left(appNo,4) = year(date()) and a.jsh in "+ // " ( SELECT appNo "+ // " 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 sh2 and c.tj_flag and xmzt = '在研' order by sqbm,sqr) "+ // " order by sqbm,sqr"; str_sql = " SELECT appNo, a.ktmc, a.sqbm, a.sqr," + " mid(appNo,5) as jsh, left(appNo,4) as appyear," + " cGroup1, a.id, pm, a.xmbh, zzlb " + " FROM t_teacher_list AS a " + " WHERE 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)" + " order by sqbm,id"; OleDbDataAdapter OleAdp = DBFun.UpdateDataSet(str_sql); DataSet Ds = new DataSet(); OleAdp.Fill(Ds, "aa"); string str_zzlb; int i_zd = 0, i_yb = 0, i_bh; string str_bh, str_xmbh; string str_appNo; for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { str_zzlb = Ds.Tables[0].Rows[i]["zzlb"].ToString(); if (str_zzlb == "重点") { str_zzlb = "A"; i_zd++; i_bh = i_zd; } else { str_zzlb = "B"; i_yb++; i_bh = i_yb; } if (i_bh < 10) { str_bh = "0" + i_bh.ToString(); } else { str_bh = i_bh.ToString(); } Ds.Tables[0].Rows[i]["xmbh"] = "JY" + DateTime.Today.Year.ToString() + str_zzlb + str_bh; str_xmbh = "JY" + DateTime.Today.Year.ToString() + str_zzlb + str_bh; str_appNo = Ds.Tables[0].Rows[i]["appno"].ToString(); str_sql = "update t_teacher_list set xmbh ='" + str_xmbh + "' where appno = '" + str_appNo + "' "; DBFun.ExecuteUpdate(str_sql); } //Ds.AcceptChanges(); //OleDbCommandBuilder odcb = new OleDbCommandBuilder(OleAdp); //Ds.Tables[0].GetChanges(); //int i_return = OleAdp.Update(Ds, "aa"); //Ds.Tables[0].AcceptChanges(); bindData(); //if (i_return != 0) // Response.Write("<script>alert('分配成功!');</script>"); //else // Response.Write("<script>alert('分配失败!');</script>"); //OleAdp.Dispose(); //Ds.Dispose(); }