//查询数据 void SearchControl1_SearchEvent(object sender, EventArgs e) { bool AllZc = false; AllZc = this.SearchControl1.AllZC; List <SearchField> condition = this.SearchControl1.SearchConditionList; ZcBu bu1 = new ZcBu(); DataSet ds1 = null; double benjin = 0, lixi = 0; if (this.SearchControl1.SearchType == SearchDataType.单条资产) { ds1 = bu1.GetZcList(condition, AllZc); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { foreach (DataRow dr1 in ds1.Tables[0].Rows) { benjin = benjin + double.Parse(dr1["bj"].ToString()); lixi = lixi + double.Parse(dr1["lx"].ToString()); } //增加合计行 DataRow dr = ds1.Tables[0].NewRow(); dr["danwei"] = "<b>合 计</b>"; dr["bj"] = benjin; dr["lx"] = lixi; ds1.Tables[0].Rows.Add(dr); } } else { ds1 = bu1.GetZcBaoList(condition); } this.GridView1.DataSource = ds1; this.GridView1.DataBind(); this.SearchTable.Visible = false; this.SearchInfo.Visible = true; Common_Master_Main master1 = this.Master as Common_Master_Main; if (master1 != null) { master1.HideNav(); } }
/// <summary> /// 得到一般政策库的资产 /// </summary> /// <param name="AllZc"></param> /// <returns></returns> private DataSet GetCommZc(bool AllZc) { ZcBu bu1 = new ZcBu(); DataSet ds1 = null; List <JSJ.SysFrame.DB.SearchField> condition = new List <JSJ.SysFrame.DB.SearchField>(); //1-单位名称 if (this.danwei.Text.Trim() != "") { condition.Add(new JSJ.SysFrame.DB.SearchField("u_zc.danwei", this.danwei.Text.Trim(), JSJ.SysFrame.SearchOperator.包含)); } //2-档案编号 if (this.num2.Text.Trim() != "") { condition.Add(new JSJ.SysFrame.DB.SearchField("num2", this.num2.Text.Trim())); } if (this.depart.SelectedValue != String.Empty || this.zeren.SelectedValue != String.Empty) { //4-责任人 if (this.zeren.SelectedValue != "") { condition.Add(new JSJ.SysFrame.DB.SearchField("zeren", this.zeren.SelectedValue)); } else { //3-责任部门 if (this.depart.SelectedValue != "") { condition.Add(new JSJ.SysFrame.DB.SearchField("depart", this.depart.SelectedValue)); } } } if (condition.Count > 0) { ds1 = bu1.GetZcList(condition, AllZc); return(ds1); } else { return(null); } }
//查询数据 void SearchControl1_SearchEvent(object sender, EventArgs e) { List <SearchField> condition = this.SearchControl1.SearchConditionList; ZcBu bu1 = new ZcBu(); DataSet ds1 = null; double benjin = 0, lixi = 0; double hs = 0; if (this.SearchControl1.SearchType == SearchDataType.单条资产) { ds1 = bu1.GetZcList(condition); } else { ds1 = bu1.GetZcBaoList(condition); } if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { foreach (DataRow dr1 in ds1.Tables[0].Rows) { benjin = benjin + double.Parse(dr1["bj"].ToString()); lixi = lixi + double.Parse(dr1["lx"].ToString()); hs = hs + double.Parse(dr1["hs"].ToString()); } //增加合计行 DataRow dr = ds1.Tables[0].NewRow(); dr["bname"] = "<b>合 计</b>"; dr["bj"] = benjin; dr["lx"] = lixi; dr["hs"] = hs; ds1.Tables[0].Rows.Add(dr); } this.GridView1.DataSource = ds1; this.GridView1.DataBind(); this.SearchTable.Visible = false; this.SearchInfo.Visible = true; }
//查询资产的新条件(2013年修改) void SearchControl1_SearchEvent(object sender, EventArgs e) { bool AllZc = false; AllZc = this.SearchControl1.AllZC; string zcid = ""; List <SearchField> list1 = this.SearchControl1.SearchConditionList; if (list1 != null) { list1.Add(new SearchField(String.Format("(u_zc.zeren='{0}')", User.Identity.Name), "", SearchOperator.用户定义)); ZcBu bu1 = new ZcBu(); DataSet ds1 = null; //double benjin = 0, lixi = 0; if (this.SearchControl1.SearchType == SearchDataType.单条资产) { ds1 = bu1.GetZcList(list1, AllZc); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { /* * foreach (DataRow dr1 in ds1.Tables[0].Rows) * { * benjin = benjin + double.Parse(dr1["bj"].ToString()); * lixi = lixi + double.Parse(dr1["lx"].ToString()); * } * * //增加合计行 * DataRow dr = ds1.Tables[0].NewRow(); * dr["danwei"] = "<b>合 计</b>"; * dr["bj"] = benjin; * dr["lx"] = lixi; * ds1.Tables[0].Rows.Add(dr);*/ for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { if (i == 0) { zcid = ds1.Tables[0].Rows[i]["id"].ToString(); } else { zcid = zcid + "," + ds1.Tables[0].Rows[i]["id"].ToString(); } } } } else { ds1 = bu1.GetZcBaoList(list1); } Session["Myzcid"] = zcid; this.GridView1.DataSource = ds1; this.GridView1.DataBind(); ds1.Dispose(); } }
private void NewBindData() { bool AllZc = false; AllZc = this.SearchControl1.AllZC; string zcid = ""; List <SearchField> list1 = this.SearchControl1.SearchConditionList; // Response.Write( JSJ.SysFrame.DB.SearchField.GetSearchCondition(list1)); if (list1 != null) { // list1.Add(new SearchField(String.Format("(u_zc.zeren='{0}')", User.Identity.Name), "", SearchOperator.用户定义)); ZcBu bu1 = new ZcBu(); DataSet ds1 = null; double benjin = 0, lixi = 0; if (this.SearchControl1.SearchType == SearchDataType.单条资产) { ds1 = bu1.GetZcList(list1, AllZc); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { foreach (DataRow dr1 in ds1.Tables[0].Rows) { benjin = benjin + double.Parse(dr1["bj"].ToString()); lixi = lixi + double.Parse(dr1["lx"].ToString()); } //增加合计行 DataRow dr = ds1.Tables[0].NewRow(); dr["danwei"] = "<b>合 计</b>"; dr["bj"] = benjin; dr["lx"] = lixi; ds1.Tables[0].Rows.Add(dr); for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { if (i == 0) { zcid = ds1.Tables[0].Rows[i]["id"].ToString(); } else { zcid = zcid + "," + ds1.Tables[0].Rows[i]["id"].ToString(); } } } } else { ds1 = bu1.GetZcBaoList(list1); } Session["Myzcid"] = zcid; this.GridView1.DataSource = ds1; this.GridView1.DataBind(); ds1.Dispose(); } }