/// <summary> /// 获得数据列表 /// </summary> public DataTable GetList(PagerQueryParam Pager, out int total) { StringBuilder strSql = new StringBuilder(); try { strSql.Append(RecordCountSql(Pager.StrParm)); object obj = ExecuteScalar(strSql.ToString()); if (obj != null && obj != DBNull.Value) { total = int.Parse(obj.ToString()); } else { total = 0; } if (total == 0) { return(null); } DataSet ds = ExecuteDataSet(GetListSql(Pager)); return(ds.Tables[0]); } catch (Exception e) { throw e; } }
private string GetListSql(PagerQueryParam Pager) { StringBuilder strSql = new StringBuilder(); strSql.Append("WITH OrderedOrders "); strSql.Append("AS ( SELECT ROW_NUMBER() OVER ( ORDER BY t_resource_detail.insert_time desc ) AS Rownumber ,"); strSql.Append("t_resource_detail.insert_time ,"); strSql.Append("t_resource_detail.id ,"); strSql.Append("t_resource_detail.name name,"); strSql.Append("t_resource_type.name type,"); strSql.Append("type_id ,"); strSql.Append("url ,"); strSql.Append("memo,"); strSql.Append("upload_people "); strSql.Append("FROM dbo.t_resource_detail LEFT JOIN dbo.t_resource_type ON t_resource_type.id=t_resource_detail.type_id WHERE 1 = 1 and t_resource_detail.delete_flag=0"); if (Pager.StrParm.Length > 0) { strSql.Append(Pager.StrParm); } strSql.Append(")"); strSql.Append(" SELECT *"); strSql.Append(" FROM OrderedOrders where RowNumber between " + ((Pager.PageIndex - 1) * Pager.PageSize + 1) + " and " + Pager.PageIndex * Pager.PageSize); return(strSql.ToString()); }
/// <summary> /// /// </summary> /// <param name="pager"></param> /// <param name="contractCode"></param> /// <param name="projectName"></param> public void initPager(PagerQueryParam pager, string contractCode, string projectName) { pager.TableName = " View_YS_contract_budget "; pager.PrimaryKey = "contract_code"; pager.ShowFields = " contract_code,contract_customer_name,contract_project_name,contract_equipment_name ,contract_income,contract_task_budget,contract_trans_budget,contract_profit,contract_profit_rate "; pager.StrWhere = this.getStrWhere(contractCode, projectName); pager.OrderField = "contract_code"; pager.OrderType = 1; pager.PageSize = 10; }
/// <summary> /// 初始化页面查询对象 /// </summary> /// <param name="taskCode">任务号</param> /// <param name="contractCode">合同号</param> /// <param name="projectName">项目名称</param> /// <param name="state">编制进度</param> public void initPager(PagerQueryParam pager, string taskCode, string contractCode, string projectName, string state, string myState, string userid) { pager.TableName = " ys_task_budget "; pager.PrimaryKey = "task_budget_id"; pager.ShowFields = " task_code,contract_code,project_name,equipment_name as product_name,task_type,case when state='1' then '初步预算'when state='2' then '部门反馈'when state='3' then '财务调整'when state='4' then '预算审核' when state='5' then '编制完成' end AS state,c_total_task_budget ,change_time,change_name"; pager.StrWhere = this.getStrWhere(taskCode, contractCode, projectName, state, myState, userid); pager.OrderField = "start_time"; pager.OrderType = 1; pager.PageSize = 10; }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="Pager"></param> /// <param name="total"></param> /// <returns></returns> public DataTable GetList(PagerQueryParam Pager, out int total) { try { DBResourceDetail db = new DBResourceDetail(); return(db.GetList(Pager, out total)); } catch (Exception e) { throw; } }
private string GetListSql(PagerQueryParam Pager) { StringBuilder strSql = new StringBuilder(); strSql.Append("WITH OrderedOrders "); strSql.Append("AS ( SELECT ROW_NUMBER() OVER ( ORDER BY id ) AS Rownumber ,"); strSql.Append("id ,"); strSql.Append("resource_detail_id ,"); strSql.Append("files_dir ,"); strSql.Append("files_name "); strSql.Append("FROM dbo.t_resource_detail_upload WHERE 1 = 1 "); if (Pager.StrParm.Length > 0) { strSql.Append(Pager.StrParm); } strSql.Append(")"); strSql.Append(" SELECT *"); strSql.Append(" FROM OrderedOrders"); //strSql.Append(" FROM OrderedOrders where RowNumber between " + ((Pager.PageIndex - 1)*Pager.PageSize + 1) + // " and " + Pager.PageIndex*Pager.PageSize); return(strSql.ToString()); }
protected void Page_Load(object sender, EventArgs e) { string id = string.Empty; string action = string.Empty; PagerQueryParam pager = new PagerQueryParam(); Panel p = new Panel();//添加到界面容器(DIV等 if (Request.QueryString["id"] != null) { id = Request.QueryString["id"].ToString(); } if (Request.QueryString["action"] != null) { action = Request.QueryString["action"].ToString(); } if (!IsPostBack) { string sqlselect = "select * from TBOM_DriverList as a left join View_TBDS_STAFFINFO as b on a.DriverId=ST_ID where DriverId='" + id + "'"; DataSet ds = DBCallCommon.FillDataSet(sqlselect); if (ds.Tables[0].Rows.Count > 0) { string context = ds.Tables[0].Rows[0]["Context"].ToString(); hidContext.Value = context; lblName.Text = ds.Tables[0].Rows[0]["ST_NAME"].ToString(); lblDep.Text = ds.Tables[0].Rows[0]["DEP_NAME"].ToString(); lblPos.Text = ds.Tables[0].Rows[0]["DEP_POSITION"].ToString(); lblWorkNo.Text = ds.Tables[0].Rows[0]["ST_WORKNO"].ToString(); if (context != "") { string sqltext = "select distinct(fileName) as fileName from tb_files where BC_CONTEXT='" + context + "'"; DataSet ds1 = DBCallCommon.FillDataSet(sqltext); string FilePath = ""; string[] imagr = new string[20]; int n = 0; string ss = ""; string mm = ""; if (ds1.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { FilePath = ds1.Tables[0].Rows[i]["fileName"].ToString(); imagr[i] = "<img src='" + "../Assets/images/om/" + "2014" + "/" + FilePath + "' height=200px width=200px/>"; n++; } imagenum.Value = n.ToString(); for (int j = 0; j < n; j++) { ss = imagr[j].ToString(); mm += ss; } ImageCar.Value = mm.ToString(); } } } Showdata(); } }