/// <summary> /// 绑定数据 /// </summary> public void BindData() { U_FASPBU bu1 = new U_FASPBU(); if (this.ListFlag == 1) { this.GridView1.DataSource = bu1.GetShenPiList1(); } else if (this.ListFlag == 2) { this.GridView1.DataSource = bu1.GetShenPiList2(); } else if (this.ListFlag == 3) { this.GridView1.DataSource = bu1.GetShenPiList3(); } else if (this.ListFlag == 4) { this.GridView1.DataSource = bu1.GetShenPiList4(); } else if (this.ListFlag == 5) { this.GridView1.DataSource = bu1.GetShenPiList5(); } else if (this.ListFlag == 6) { this.GridView1.DataSource = bu1.GetShenPiList6(); } else { ; } this.GridView1.DataBind(); }
//保存新数据 protected void Button1_Click(object sender, EventArgs e) { Hashtable data = new Hashtable(); this.Info1.GetControlData(data); this.Info2.GetControlData(data); if (data["xmmc"].ToString().Trim() != String.Empty) { //设置某些字段的默认值 data.Add("zcid", Request["zcid"]); //data.Add("spstatus", "0"); data.Add("spkind", "0"); data.Add("zcbid", Request["zcbid"]); data.Add("time0", DateTime.Now.ToString()); U_FASPBU bu1 = new U_FASPBU(); int zcid = bu1.InsertData(data); if (zcid != 0) { Response.Redirect("EditSbb.aspx?id=" + zcid, true); } else { Util.alert(this.Page, "提示:数据提交错误,可能的原因是网络中断,请重试!"); } } else { Util.alert(this.Page, "错误:项目名称不能为空!"); } }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { U_FASPBU bu1 = new U_FASPBU(); DataSet ds = bu1.GetSelectZcList(ViewState["SearchCondition"] as List <SearchField>); this.GridView1.DataSource = ds; this.GridView1.DataBind(); }
/// <summary> /// 根据查询条件绑定数据 /// </summary> /// <param name="xmmc"></param> /// <param name="num1"></param> /// <param name="danwei"></param> /// <param name="status"></param> /// <param name="time0"></param> /// <param name="time1"></param> public void BindData(String xmmc, String num1, String danwei, String status, String time0, String time1, String status1, String Status2) { U_FASPBU bu1 = new U_FASPBU(); this.GridView1.DataSource = bu1.GetShenPiListBySearchCondition(xmmc, num1, danwei, status, time0, time1, status1, Status2); this.GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request["id"] != null && Request["id"].Trim() != String.Empty) { U_FASPBU bu1 = new U_FASPBU(); /////////////////////////////////////////////////// Hashtable ht = bu1.GetInfo2(Request["id"]); ////////////////////////////////////////////////// this.Info1.SetControlData(ht); this.Info2.SetControlData(ht); this.Info2.SetYiJian(ht["id"].ToString()); this.Info3.SetControlData(ht); this.Info4.SetControlData(ht); this.Info5.CzID = ht["id"].ToString(); this.Info5.ZcID = ht["zcid"].ToString(); this.Info6.CzID = ht["id"].ToString(); this.Info6.ZcID = ht["zcid"].ToString(); this.Info5.Xmsbh = ht["xmsbh"].ToString(); this.Info5.BindData(); this.Info6.SetControlData(ht); //设置资产和资产包的情况 if (ht["zcid"].ToString().Trim() != String.Empty) { this.MenuKind1.ZcID = ht["zcid"].ToString(); } if (ht["zcbid"].ToString().Trim() != String.Empty) { this.MenuKind1.ZcbID = ht["zcbid"].ToString(); } //////////////////////////////////////////// ViewState["zeren"] = ht["zeren"].ToString(); ViewState["status"] = ht["status"].ToString(); int index1 = 1; if (Request["menuIndex"] != null) { index1 = int.Parse(Request["menuIndex"]); } this.SelectControl(index1, ViewState["status"].ToString()); this.MenuKind1.SetMenu(index1); } } }
/// <summary> /// 设置相关的页面处理意见 /// </summary> /// <param name="czid"></param> public void SetYiJian(String czid) { U_FASPBU bu1 = new U_FASPBU(); ShenPi info1 = bu1.GetBuMenYiJian(czid); if (info1 != null) { this.yj1.Text = info1.YiJian; this.ren1.Text = info1.Ren; this.yj1_1.Text = info1.YiJian; this.ren1_1.Text = info1.Ren; if (info1.ShiJian.Trim() != String.Empty) { info1.ShiJian = DateTime.Parse(info1.ShiJian).ToString("yyyy年MM月dd日"); } this.time1.Text = info1.ShiJian; this.time1_1.Text = info1.ShiJian; } ShenPi info2 = bu1.GetPSYYiJian(czid); if (info2 != null) { this.yj2.Text = info2.YiJian; this.ren2.Text = info2.Ren; this.yj2_1.Text = info2.YiJian; this.ren2_1.Text = info2.Ren; if (info2.ShiJian.Trim() != String.Empty) { info2.ShiJian = DateTime.Parse(info2.ShiJian).ToString("yyyy年MM月dd日"); } this.time2.Text = info2.ShiJian; this.time2_1.Text = info2.ShiJian; } }
//保存数据 protected void Button1_Click(object sender, EventArgs e) { Hashtable data = new Hashtable(); this.Info1.GetControlData(data); this.Info2.GetControlData(data); this.Info3.GetControlData(data); this.Info4.GetControlData(data); this.Info6.GetControlData(data); String[] arr1 = { "zqce", "benjin", "lixi", "spstatus" }; foreach (String m in arr1) { if (data.ContainsKey(m)) { data.Remove(m); } } U_FASPBU bu1 = new U_FASPBU(); bu1.EditData(data, Request["id"]); Response.Redirect("EditSbb.aspx?id=" + Request["id"].ToString() + "&menuIndex=" + this.MenuKind1.MenuIndex, true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.MenuKind1.EditMode = false; //隐藏编辑状态才有的菜单; if (Request["zcid"] != null && Request["zcid"].Trim() != String.Empty) { U_FASPBU bu1 = new U_FASPBU(); Hashtable ht = bu1.GetInfo1(Request["zcid"]); ht["bstatus"] = "0"; ht["status"] = "04"; //设置为部门审批 this.Info1.SetControlData(ht); this.Info1.NewMode = true; this.Info2.NewMode = true; this.Info2.EditMode = false; this.MenuKind1.ZcID = Request["zcid"]; } if (String.IsNullOrEmpty(Request["zcbid"]) == false) { this.Info1.NewMode = true; this.Info2.NewMode = true; this.Info2.EditMode = false; this.MenuKind1.ZcbID = Request["zcbid"]; U_ZCBAOBU bu1 = new U_ZCBAOBU(); DataSet ds = bu1.GetDetailByID(Request["zcbid"], "*"); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; Hashtable ht2 = new Hashtable(); foreach (DataColumn col in dr.Table.Columns) { String colName = col.ColumnName.ToLower().Trim(); if (ht2.ContainsKey(colName) == false) { ht2.Add(colName, dr[colName].ToString()); } } //调整部分数据 ht2["zeren"] = ht2["bzeren"]; ht2["xmmc"] = ht2["bname"]; ht2["status"] = ht2["bstatus"]; ht2["spkind"] = "1"; ht2["bstatus"] = "0"; ht2["status"] = "04"; //设置为部门审批 //根据资产包的信息计算资产的总金额 CommTable com1 = new CommTable(); com1.TabName = "U_ZCBaoInfo"; List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("bid", Request["zcbid"], SearchFieldType.数值型)); DataSet ds0 = com1.SearchData("zcid", condition); String zcid = ""; foreach (DataRow dr1 in ds0.Tables[0].Rows) { if (zcid == String.Empty) { zcid = dr1["zcid"].ToString(); } else { zcid = zcid + "," + dr1["zcid"].ToString(); } } com1.TabName = "U_ZC"; condition.Clear(); condition.Add(new SearchField("id", zcid, SearchOperator.集合, SearchFieldType.数值型)); DataSet ds1 = com1.SearchData("sum(cast(isnull(bj,0) as numeric(18,2))),sum(cast(isnull(lx1,0) as numeric(18,2))),sum(cast(isnull(lx2,0) as numeric(18,2))),sum(cast(isnull(lx3,0) as numeric(18,2)))", condition); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow dr2 = ds1.Tables[0].Rows[0]; ht2["benjin"] = dr2[0].ToString(); ht2["zqce"] = double.Parse(dr2[0].ToString()) + double.Parse(dr2[1].ToString()) + double.Parse(dr2[2].ToString()) + double.Parse(dr2[3].ToString()); ht2["lixi"] = double.Parse(dr2[1].ToString()) + double.Parse(dr2[2].ToString()) + double.Parse(dr2[3].ToString()); } com1.Close(); //////////////////////////////////////////////////////////////////////// this.Info1.SetControlData(ht2); } } } }
//设置数据 private void BindData() { if (Request["id"] != null) { CommTable comm1 = new CommTable(); comm1.TabName = "U_Zc2"; List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("id", Request["id"])); Hashtable data = comm1.SearchData(condition); comm1.Close(); if (data != null && data.Count > 0) { //设置数据1 this.xmsbh.Value = data["xmsbh"].ToString(); this.num2.Value = data["num2"].ToString(); this.xmmc.Value = data["xmmc"].ToString(); this.zwdw.Value = data["danwei"].ToString(); this.dbdw.Value = data["bzrmc"].ToString(); this.zwzgbm.Value = data["zwzg"].ToString(); this.zqxx.Value = data["zqsx"].ToString(); this.zclx.Value = data["zclx"].ToString(); this.zcse.Value = data["zcse"].ToString(); this.jiazhi.Value = data["jiazhi"].ToString(); this.zqze.Value = data["zqce"].ToString(); this.benjin.Value = data["benjin"].ToString(); this.lixi.Value = data["lixi"].ToString(); this.xmbj.Value = data["xmbj"].ToString(); //设置数据2 this.czfs1.Value = data["czfs1"].ToString(); this.czba1.Value = data["jtfa1"].ToString(); this.czjg1.Value = data["czjg1"].ToString(); this.qcl1.Value = data["qcl1"].ToString(); this.czfs2.Value = data["czfs2"].ToString(); this.czba2.Value = data["jtfa2"].ToString(); this.czjg2.Value = data["czjg2"].ToString(); this.qcl2.Value = data["qcl2"].ToString(); this.xgsxsm.Value = data["xgsx"].ToString(); //设置部门意见 U_FASPBU bu1 = new U_FASPBU(); ShenPi info1 = bu1.GetBuMenYiJian(Request["id"]); if (info1 != null) { this.bmyj.Value = info1.YiJian; this.bmren.Value = info1.Ren; if (info1.ShiJian.Trim() != String.Empty) { this.bmsj.Value = DateTime.Parse(info1.ShiJian).ToString("yyyy年MM月dd日"); } } //设置承办部门和时间 this.cbbm.Value = data["depart"].ToString(); this.jbr.Value = data["zeren"].ToString(); if (data["shijian1"].ToString().Trim() != String.Empty) { //this.jbsj.Value = DateTime.Parse(data["shijian1"].ToString().Trim()).ToString("yyyy年MM月dd日"); } //设置评审员的意见 ShenPi info2 = bu1.GetPSYYiJian(Request["id"]); if (info2 != null) { this.psyyj.Value = info2.YiJian; this.psyren.Value = info2.Ren; if (info2.ShiJian.Trim() != String.Empty) { this.psysj.Value = DateTime.Parse(info2.ShiJian).ToString("yyyy年MM月dd日"); } } //设置审核委员会信息st this.hysj1.Value = data["hysj1"].ToString(); this.hydd1.Value = data["hydd1"].ToString(); this.yingdao1.Value = data["yingdao1"].ToString(); this.shidao1.Value = data["shidao1"].ToString(); this.quexi1.Value = data["quexi1"].ToString(); this.zcr1.Value = data["zcr1"].ToString(); //设置意见信息 String weiyuan1 = ""; String weiyuan2 = ""; String weiyuan3 = ""; String zhuxi = ""; String zhuxiTime = ""; String zhuxiyijian = ""; JSJ.CJZC.Business.Comm.GetWeiYuan1(Request["id"], "13", out weiyuan1, out weiyuan2, out weiyuan3, out zhuxi, out zhuxiTime, out zhuxiyijian); this.ztwy1.Value = weiyuan1; this.fdwy1.Value = weiyuan2; this.shren1.Value = zhuxi; this.shyj1.Value = zhuxiyijian; this.shsj1.Value = zhuxiTime; //设置决策委员会信息 this.hysj2.Value = data["hysj2"].ToString(); this.hydd2.Value = data["hydd2"].ToString(); this.yingdao2.Value = data["yingdao2"].ToString(); this.shidao2.Value = data["shidao2"].ToString(); this.quexi2.Value = data["quexi2"].ToString(); this.zcr2.Value = data["zcr2"].ToString(); JSJ.CJZC.Business.Comm.GetWeiYuan1(Request["id"], "15", out weiyuan1, out weiyuan2, out weiyuan3, out zhuxi, out zhuxiTime, out zhuxiyijian); this.ztwy2.Value = weiyuan1; this.fdwy2.Value = weiyuan2; this.shren2.Value = zhuxi; this.shyj2.Value = zhuxiyijian; this.shsj2.Value = zhuxiTime; } } }
//执行查询 private void SearchData(SearchStruct info1) { this.SearchTable.Visible = false; this.SearchInfo.Visible = true; U_FASPBU bu1 = new U_FASPBU(); DataSet ds1 = bu1.GetShenPiListBySearchCondition(info1); //////////////////////////////////////////////////////// DataTable[] ArrData = new DataTable[] { new DataTable(), new DataTable() }; #region Code1 ds1.Tables[0].Columns.Add("sort1"); //增加排序列 ds1.Tables[0].Columns.Add("Money1", typeof(Double)); ds1.Tables[0].Columns.Add("money2", typeof(double)); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { //将查询结果的列写入Dt1和Dt2 ArrayList colName = new ArrayList(); foreach (DataColumn col1 in ds1.Tables[0].Columns) { DataColumn newCol1 = new DataColumn(col1.ColumnName, col1.DataType); DataColumn newCol2 = new DataColumn(col1.ColumnName, col1.DataType); ArrData[0].Columns.Add(newCol1); ArrData[1].Columns.Add(newCol2); colName.Add(col1.ColumnName); //得到列的数组 } //得到资产包的ID列表; ArrayList baozclist = this.GetZcbaoIDList(); //将数据写入Dt1和Dt2 //DataRow dr2=null; foreach (DataRow dr1 in ds1.Tables[0].Rows) { //设置Sort1的值 String str1 = dr1["xmsbh"].ToString().Trim().Replace('-', '-'); String str2 = null; if (str1.IndexOf('-') > 0) { String temp1 = str1.Split('-')[0].PadLeft(5, '0'); String temp2 = str1.Split('-')[1].PadLeft(5, '0'); str2 = temp1 + "-" + temp2; } else { str2 = str1.PadLeft(5, '0') + "-" + "00000"; } str2 = str2 + "-" + dr1["num2"].ToString(); dr1["sort1"] = str2; //将数据分别移到数据1表和数据2表 int i = 0; String id = dr1["zcid"].ToString().Trim(); if (baozclist.Contains(id)) { i = 1; } DataRow newdr = ArrData[i].NewRow(); foreach (String m in colName) { newdr[m] = dr1[m]; } ArrData[i].Rows.Add(newdr); } } #endregion #region code2 for (int i = 0; i < ArrData.Length; i++) { //分别计算合计的户数和数据 if (ArrData[i] != null && ArrData[i].Rows.Count > 0) { ArrayList arr1 = new ArrayList(); double d1 = 0, d2 = 0, d3 = 0; foreach (DataRow dr1 in ArrData[i].Rows) { String num2 = dr1["num2"].ToString().Trim(); if (String.IsNullOrEmpty(num2) == false) { if (arr1.Contains(num2) == false) { arr1.Add(num2); } } ///////////////////////////////////////////////////// String temp = dr1["benjin"].ToString().Replace(",", ""); if (String.IsNullOrEmpty(temp)) { temp = "0"; } d1 = d1 + double.Parse(temp); temp = dr1["lixi"].ToString().Replace(",", ""); if (String.IsNullOrEmpty(temp)) { temp = "0"; } d2 = d2 + double.Parse(temp); temp = dr1["zqce"].ToString().Replace(",", ""); if (String.IsNullOrEmpty(temp)) { temp = "0"; } d3 = d3 + double.Parse(temp); } DataRow dr = ArrData[i].NewRow(); ArrData[i].Rows.Add(dr); dr["status1"] = DBNull.Value; dr["spstatus"] = " "; dr["num2"] = " "; dr["xmmc"] = "<center><b>合 计(" + arr1.Count + "户) </b></center>"; dr["benjin"] = d1.ToString(); dr["lixi"] = d2.ToString(); dr["zqce"] = d3.ToString(); dr["sort1"] = "ZZZZZ"; } } #endregion code2 //绑定数据 DataView view1 = null; if (ArrData[0].Rows.Count + ArrData[1].Rows.Count > 0) { if (ArrData[0] == null || ArrData[0].Rows.Count == 0) { view1 = ArrData[1].DefaultView; view1.Sort = "sort1"; this.GridView1.DataSource = view1; this.GridView1.DataBind(); } else { view1 = ArrData[0].DefaultView; view1.Sort = "sort1"; this.GridView1.DataSource = view1; this.GridView1.DataBind(); view1 = ArrData[1].DefaultView; view1.Sort = "sort1"; this.GridView2.DataSource = view1; this.GridView2.DataBind(); } } //展开导航项 Common_Master_Zcsp master1 = this.Master as Common_Master_Zcsp; if (master1 != null) { master1.SetShowMax(); } }