private void AutoCarMenu(TreeView trvMenu) { trvMenu.Nodes.Clear(); trvMenu.Font.Name = "宋体"; trvMenu.Font.Size = FontUnit.Parse("10"); string strSql = "select t_R_RoleMenu.MenuID,MenuName,URL from t_R_Role,t_R_Menu,t_R_RoleMenu " + " where t_R_Role.RoleID=t_R_RoleMenu.RoleID and " + " t_R_RoleMenu.MenuID=t_R_Menu.ID and " + " t_R_Role.RoleID='" + Request.Cookies["Cookies"].Values["u_role"].ToString() + "' and " + "t_R_Menu.FatherID='0' and t_R_Menu.flag>=1 and t_R_RoleMenu.checked='1' and t_R_Menu.id=63 order by t_R_Menu.OrderID"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { TreeNode tnFather = new TreeNode(); tnFather.Text = ds.Tables[0].Rows[i]["MenuName"].ToString(); tnFather.NavigateUrl = ds.Tables[0].Rows[i]["URL"].ToString(); if (tnFather.NavigateUrl == "#") { tnFather.Expanded = true; } else { tnFather.Expanded = true; } trvMenu.Nodes.Add(tnFather); CreateCarChildNodes(tnFather, Int16.Parse(ds.Tables[0].Rows[i]["MenuID"].ToString())); } ds.Dispose(); }
private void LoadLog() { string outputlog = ""; string date1 = DateTime.Now.ToString("yyyy-MM-dd"); string date2 = date1 + " 23:59:59"; string strSql = "select id,name as 工作人员,ulog as 工作内容,utime as 登记时间 from t_R_UserLog where utime > '" + date1 + "' and utime < '" + date2 + "' order by id desc"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { outputlog += "[<font color='green'>" + ds.Tables[0].Rows[i][1].ToString() + "</font>] " + ds.Tables[0].Rows[i][2].ToString() + " <font color='#6c6f6f'>" + ds.Tables[0].Rows[i][3].ToString() + "</font> <br>"; } } else { outputlog += "<font color='red'>今日无工作日志!</font>"; } ds.Dispose(); Response.ContentType = "text/xml"; Response.Write(outputlog); Response.End(); }
private void AutoTree(TreeView tree) { DataSet ds = new DataSet(); string sqlStr = "select * from t_document where PARENTID is null or PARENTID = ''"; try { ds = new MyDataOp(sqlStr).CreateDataSet(); foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode parent = new TreeNode(); parent.Text = dr["NAME"].ToString(); tree.Nodes.Add(parent); this.AddChildNode(parent, dr["ID"].ToString()); } } catch (Exception msg) { //修改:异常捕捉,并对异常记日志。修改人:WQ // logExpert.writOperateLog("专家系统目录树的加载" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001"); Response.Write("<script language='javascript'>alert('文件系统加载出错!');</script>"); } finally {//wq2007-10-30 if (ds != null) { ds.Dispose(); ds = null; } } }
//待修改,删除该目录的子目录及文件 private void DeleteChildNode(string ID, ref string strIDlist) { DataSet dataSet = new DataSet(); string str = "select * from t_directory where PARENTID =" + "'" + ID + "'"; try {//异常捕捉,并记错误日志。修改人:WQ dataSet = new MyDataOp(str).CreateDataSet(); foreach (DataRow row in dataSet.Tables[0].Rows) { strIDlist += "','" + row["ID"].ToString(); this.DeleteChildNode(row["ID"].ToString(), ref strIDlist); } } catch (Exception msg) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('目录加载错误!');", true); //Response.Write("<script language='javascript'>alert('目录加载错误!');</script>"); } finally { if (dataSet != null) { dataSet.Dispose(); dataSet = null; } } }
private void AddChildNode(TreeNode parent, string ID) { DataSet dataSet = new DataSet(); string str = "select * from t_directory where PARENTID =" + "'" + ID + "'"; try {//异常捕捉,并记错误日志。修改人:WQ dataSet = new MyDataOp(str).CreateDataSet(); foreach (DataRow row in dataSet.Tables[0].Rows) { TreeNode child = new TreeNode(); child.Text = row["NAME"].ToString(); child.Value = row["ID"].ToString(); parent.ChildNodes.Add(child); this.AddChildNode(child, row["ID"].ToString()); string strContent = row["LINK"].ToString(); } } catch (Exception msg) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('目录加载错误!');", true); // Response.Write("<script language='javascript'>alert('目录加载错误!');</script>"); } finally { if (dataSet != null) { dataSet.Dispose(); dataSet = null; } } }
private void AutoTree(TreeView tree) { tree.Nodes.Clear(); DataSet ds = new DataSet(); string sqlStr = "select * from t_directory where PARENTID is null or PARENTID = ''"; try { ds = new MyDataOp(sqlStr).CreateDataSet(); foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode parent = new TreeNode(); parent.Text = dr["NAME"].ToString(); parent.Value = dr["ID"].ToString(); tree.Nodes.Add(parent); this.AddChildNode(parent, dr["ID"].ToString()); } } catch (Exception msg) { //修改:异常捕捉,并对异常记日志。修改人:WQ // Response.Write("<script language='javascript'>alert('文件系统加载出错!');</script>"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('文件系统加载出错!');", true); } finally {//wq2007-10-30 if (ds != null) { ds.Dispose(); ds = null; } } }
//protected void SetButton() //{ // if (!MyStaVoid.isWrite(Request.Cookies["Cookies"].Values["uid"].ToString(), this.Request.Url.Segments[this.Request.Url.Segments.Length - 1].ToString())) // { // btn_Add.Enabled = false; // btn_OK.Enabled = false; // btn_AddSample.Enabled = false; // for (int i = 0; i < grdvw_List.Rows.Count; i++) // { // ImageButton btn = (ImageButton)grdvw_List.Rows[i].FindControl("btn_delete"); // if(btn!=null) // btn.Visible = false; // } // } // else // { // btn_Add.Enabled = true; // btn_OK.Enabled = true; // btn_AddSample.Enabled = true; // for (int i = 0; i < grdvw_List.Rows.Count; i++) // { // ImageButton btn = (ImageButton)grdvw_List.Rows[i].FindControl("btn_delete"); // if(btn!=null) // btn.Visible = true; // } // } //} private void ReportQuery() { string strSql = "select t_DrawSampleDetail.id, t_M_SampleInfor.SampleID AS 样品编号," + " t_DrawSampleDetail.CreateDate 领用时间,t_MonitorItemDetail.MonitorItem, t_M_AnalysisItemEx.AIName 分析项目 ,t_DrawSampleDetail.fxDate 数据登记时间,t_DrawSampleDetail.value" + " FROM t_M_SampleInfor INNER JOIN" + " t_M_SampleType ON " + " t_M_SampleInfor.TypeID = t_M_SampleType.TypeID inner join t_MonitorItemDetail on t_MonitorItemDetail.SampleID=t_M_SampleInfor.id inner join t_DrawSample on t_DrawSample.SampleID=t_M_SampleInfor.SampleID and t_DrawSample.id=t_MonitorItemDetail.fxDanID inner join t_M_AnalysisItemEx on t_M_AnalysisItemEx.id=t_MonitorItemDetail.MonitorItem inner join t_DrawSampleDetail on DrawID=t_DrawSample.id where t_M_SampleInfor.SampleID='" + strSampleID + "' and t_DrawSample.id='" + strNowLyID + "' and t_DrawSample.LyUserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' and fxflag=0 ORDER BY t_M_SampleInfor.SampleID"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_ReportDetail.DataSource = ds; grdvw_ReportDetail.DataBind(); int intColumnCount = grdvw_ReportDetail.Rows[0].Cells.Count; grdvw_ReportDetail.Rows[0].Cells.Clear(); grdvw_ReportDetail.Rows[0].Cells.Add(new TableCell()); grdvw_ReportDetail.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_ReportDetail.DataSource = ds; grdvw_ReportDetail.DataBind(); } ds.Dispose(); }
//查询出选中的报告的样品列表 private void ReportSelectQuery() { string strSql = "SELECT t_M_ReporInfo.ReportName AS 报告标识, t_M_SampleInfor.id," + "t_M_SampleInfor.AccessDate AS 接样时间, t_M_ReporInfo.ItemType," + " ItemName AS 项目类型, t_M_SampleInfor.SampleID AS 样品编号, " + " t_M_SampleInfor.TypeID, t_M_SampleType.SampleType AS 样品类型, " + " t_M_ReporInfo.ClientID, t_M_ClientInfo.ClientName AS 委托单位, " + " t_M_ReporInfo.urgent 备注, t_M_SampleInfor.ReportRemark AS 报告备注, " + " t_M_SampleInfor.StatusID, t_M_SampleInfor.ReportID" + " FROM t_M_ReporInfo inner join t_M_SampleInfor on t_M_SampleInfor.ReportID = t_M_ReporInfo.id INNER JOIN" + " t_M_ItemInfo ON t_M_ReporInfo.ItemType = t_M_ItemInfo.ItemID INNER JOIN" + " t_M_SampleType ON " + " t_M_SampleInfor.TypeID = t_M_SampleType.TypeID INNER JOIN" + " t_M_ClientInfo ON t_M_ReporInfo.ClientID = t_M_ClientInfo.id " + " WHERE " + " t_M_SampleInfor.ReportID=" + strReportId + " ORDER BY t_M_SampleInfor.id"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dccc = new DataColumn("样品单状态"); ds.Tables[0].Columns.Add(dccc); foreach (DataRow dr in ds.Tables[0].Rows) { if (int.Parse(dr["StatusID"].ToString()) <= 1) { dr["样品单状态"] = "未完成"; } else { dr["样品单状态"] = "完成"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_ReportDetail.DataSource = ds; grdvw_ReportDetail.DataBind(); int intColumnCount = grdvw_ReportDetail.Rows[0].Cells.Count; grdvw_ReportDetail.Rows[0].Cells.Clear(); grdvw_ReportDetail.Rows[0].Cells.Add(new TableCell()); grdvw_ReportDetail.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_ReportDetail.DataSource = ds; grdvw_ReportDetail.DataBind(); } ds.Dispose(); ReportQuery(); }
//private void MainQuery() //{ // string strSql = "select t_M_SampleInfor.ReportID,t_M_SampleInfor.ItemType,ItemName 项目类型, from t_M_SampleInfor,t_M_ItemInfo,t_M_SampleType,t_M_ClientInfo where t_M_ClientInfo.id=ClientID and t_M_SampleInfor.ItemType=t_M_ItemInfo.ItemID and t_M_SampleInfor.TypeID=t_M_SampleType.TypeID and (StatusID=1 or ((StatusID=3 or StatusID=2) and t_M_SampleInfor.id in (select SampleID from t_M_BackInfo where flag=0))) order by t_M_SampleInfor.id "; // DataSet ds = new MyDataOp(strSql).CreateDataSet(); // DataColumn dc = new DataColumn("是否上传报告"); // ds.Tables[0].Columns.Add(dc); // foreach (DataRow dr in ds.Tables[0].Rows) // { // if (dr["ReportAddress"].ToString() == "") // dr["是否上传报告"] = "否"; // else // dr["是否上传报告"] = "是"; // } // if (ds.Tables[0].Rows.Count == 0) // { // //没有记录仍保留表头 // ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); // grdvw_List.DataSource = ds; // grdvw_List.DataBind(); // int intColumnCount = grdvw_List.Rows[0].Cells.Count; // grdvw_List.Rows[0].Cells.Clear(); // grdvw_List.Rows[0].Cells.Add(new TableCell()); // grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; // } // else // { // grdvw_List.DataSource = ds; // grdvw_List.DataBind(); // } //} // private void Query() // { // string strSql = "SELECT t_M_ReporInfo.ReportName AS 报告标识, t_M_SampleInfor.id,"+ // "t_M_SampleInfor.AccessDate AS 接样时间, t_M_SampleInfor.ItemType,"+ // " ItemName AS 项目类型, t_M_SampleInfor.SampleID AS 样品编号, "+ // " t_M_SampleInfor.TypeID, t_M_SampleType.SampleType AS 样品类型, "+ // " t_M_ReporInfo.ClientID, t_M_ClientInfo.ClientName AS 委托单位, "+ // " t_M_ReporInfo.urgent, t_M_SampleInfor.ReportRemark AS 备注, " + // " t_M_SampleInfor.StatusID" + //" FROM t_M_SampleInfor INNER JOIN"+ // " t_M_ItemInfo ON t_M_SampleInfor.ItemType = t_M_ItemInfo.ItemID INNER JOIN"+ // " t_M_SampleType ON "+ // " t_M_SampleInfor.TypeID = t_M_SampleType.TypeID INNER JOIN"+ // " t_M_ReporInfo INNER JOIN"+ // " t_M_ClientInfo ON t_M_ReporInfo.ClientID = t_M_ClientInfo.id ON "+ // " t_M_SampleInfor.ReportID = t_M_ReporInfo.id"+ //" WHERE (t_M_SampleInfor.StatusID = 1) OR"+ // " (t_M_SampleInfor.StatusID = 2)"+ //" ORDER BY t_M_SampleInfor.id"; // // string strSql = "select ReportName 报告标识,t_M_SampleInfor.id,AccessDate 接样时间,t_M_SampleInfor.ItemType,ItemName 项目类型,SampleID 样品编号,t_M_SampleInfor.TypeID,t_M_SampleType.SampleType 样品类型,ClientID,ClientName 委托单位,urgent,ReportRemark 备注,StatusID from t_M_SampleInfor,t_M_ItemInfo,t_M_SampleType,t_M_ClientInfo where t_M_ClientInfo.id=ClientID and t_M_SampleInfor.ItemType=t_M_ItemInfo.ItemID and t_M_SampleInfor.TypeID=t_M_SampleType.TypeID and (StatusID=1 or StatusID=2) order by t_M_SampleInfor.id ";// or ((StatusID=2) and t_M_SampleInfor.id in (select SampleID from t_M_BackInfo where flag=0)) // DataSet ds = new MyDataOp(strSql).CreateDataSet(); // //DataColumn dc = new DataColumn("是否上传报告"); // //ds.Tables[0].Columns.Add(dc); // DataColumn dcc = new DataColumn("紧急程度"); // ds.Tables[0].Columns.Add(dcc); // DataColumn dccc = new DataColumn("分析报告状态"); // ds.Tables[0].Columns.Add(dccc); // foreach (DataRow dr in ds.Tables[0].Rows) // { // //if (dr["ReportAddress"].ToString() == "") // // dr["是否上传报告"] = "否"; // //else // // dr["是否上传报告"] = "是"; // if (dr["urgent"].ToString() == "0") // dr["紧急程度"] = "一般"; // else // dr["紧急程度"] = "紧急"; // if (dr["StatusID"].ToString() == "1") // dr["分析报告状态"] = "未完成"; // else // dr["分析报告状态"] = "完成"; // } // if (ds.Tables[0].Rows.Count == 0) // { // //没有记录仍保留表头 // ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); // grdvw_List.DataSource = ds; // grdvw_List.DataBind(); // int intColumnCount = grdvw_List.Rows[0].Cells.Count; // grdvw_List.Rows[0].Cells.Clear(); // grdvw_List.Rows[0].Cells.Add(new TableCell()); // grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; // } // else // { // grdvw_List.DataSource = ds; // grdvw_List.DataBind(); // } // } //查询出报告列表 private void ReportQuery() { string strSql = "select ReportName 报告标识,t_M_ReporInfo.id,CreateDate 时间,t_M_ReporInfo.ItemType,ItemName 项目类型,ClientID,ClientName 委托单位,ReportAddress,urgent 备注,ReportRemark 报告备注,StatusID,ReportWriteDate,ReportWriteRemark,ReportProofRemark,Ulevel,ReportNumber 报告编号 from t_M_ReporInfo,t_M_ItemInfo,t_M_ClientInfo where t_M_ClientInfo.id=ClientID and t_M_ReporInfo.ItemType=t_M_ItemInfo.ItemID and (StatusID=2) order by t_M_ReporInfo.id ";// or ((StatusID=2) and t_M_SampleInfor.id in (select SampleID from t_M_BackInfo where flag=0)) DataSet ds = new MyDataOp(strSql).CreateDataSet(); //DataColumn dc = new DataColumn("是否上传报告"); //ds.Tables[0].Columns.Add(dc); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); DataColumn dccc = new DataColumn("报告编制状态"); ds.Tables[0].Columns.Add(dccc); foreach (DataRow dr in ds.Tables[0].Rows) { //if (dr["ReportAddress"].ToString() == "") // dr["是否上传报告"] = "否"; //else // dr["是否上传报告"] = "是"; if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } if (int.Parse(dr["StatusID"].ToString()) <= 1) { dr["报告编制状态"] = "未完成"; } else { dr["报告编制状态"] = "完成"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_Report.DataSource = ds; grdvw_Report.DataBind(); int intColumnCount = grdvw_Report.Rows[0].Cells.Count; grdvw_Report.Rows[0].Cells.Clear(); grdvw_Report.Rows[0].Cells.Add(new TableCell()); grdvw_Report.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_Report.DataSource = ds; grdvw_Report.DataBind(); } ds.Dispose(); }
protected void btn_query_Click(object sender, EventArgs e) { //strSelectedId=txt_samplequery.Text; string strSample = ""; string strDate = ""; if (txt_samplequery.Text != "") { strSample = "and SampleID like'%" + txt_samplequery.Text + "%'"; } if (txt_QueryTime.Text != "") { strDate = " and (year(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string strSql = "select t_M_SampleInfor.id,AccessDate 接样时间,t_M_ReporInfo.ItemType,ItemName 项目类型,SampleID 样品编号,t_M_SampleInfor.TypeID,t_M_SampleType.SampleType 样品类型,t_M_ReporInfo.ClientID,ClientName 区域,t_M_ReporInfo.ReportName 报告标识,t_M_ReporInfo.urgent 备注,t_M_SampleInfor.ReportRemark 报告备注,Ulevel,snum,wtdepart 委托单位 from t_M_ReporInfo, t_M_SampleInfor,t_M_ItemInfo,t_M_SampleType,t_M_ClientInfo where t_M_ClientInfo.id=t_M_ReporInfo.ClientID and t_M_ReporInfo.ItemType=t_M_ItemInfo.ItemID and t_M_SampleInfor.TypeID=t_M_SampleType.TypeID and t_M_ReporInfo.StatusID<2 and t_M_SampleInfor.ReportID=t_M_ReporInfo.id and t_M_SampleInfor.StatusID=0 " + strSample + strDate + " order by t_M_SampleInfor.id "; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
private void SummaryQuery() { StringBuilder outputSum = new StringBuilder(); //string sql = "SELECT t_M_AnalysisItem.AIName,"; //sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NULL THEN t_M_MonitorItem.num ELSE 0 END) AS undone,"; //sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NOT NULL THEN t_M_MonitorItem.num ELSE 0 END) AS done "; //sql += "FROM t_M_MonitorItem INNER JOIN t_M_AnalysisItem ON t_M_MonitorItem.MonitorItem = t_M_AnalysisItem.id INNER JOIN t_M_SampleInfor ON t_M_MonitorItem.SampleID = t_M_SampleInfor.id inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID "; //sql += "WHERE (t_M_ReporInfo.StatusID < 6) and SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NULL THEN t_M_MonitorItem.num ELSE 0 END)>0 GROUP BY t_M_AnalysisItem.AIName"; string sql = "select * from view_ywc"; //DataSet dss = new MyDataOp(sql).CreateDataSetP("tj"); DataSet dss = new MyDataOp(sql).CreateDataSet(); outputSum.Append("<table><tr><td>分析项目</td>"); if (dss.Tables[0].Rows.Count > 0) { string AIName = ""; string UnDone = ""; string Done = ""; for (int m = 0; m < dss.Tables[0].Rows.Count; m++) { AIName = dss.Tables[0].Rows[m][0].ToString(); outputSum.Append("<td>" + AIName + "</td>"); } outputSum.Append("</tr><tr><td>已完成</td>"); for (int n = 0; n < dss.Tables[0].Rows.Count; n++) { Done = dss.Tables[0].Rows[n][2].ToString(); outputSum.Append("<td>" + Done + "</td>"); } outputSum.Append("</tr><tr><td>未完成</td>"); for (int l = 0; l < dss.Tables[0].Rows.Count; l++) { UnDone = dss.Tables[0].Rows[l][1].ToString(); outputSum.Append("<td>" + UnDone + "</td>"); } } outputSum.Append("</tr></table>"); lbl_sum.Text = outputSum.ToString(); dss.Dispose(); // if (flagRelash == "1") //{ // Response.ContentType = "text/xml"; // Response.Write(outputSum.ToString()); // Response.End(); // flagRelash = ""; //} }
protected void DropList_AnalysisMainItem_SelectedIndexChanged(object sender, EventArgs e) { DataSet ds; string str; if (DropList_AnalysisMainItem.SelectedValue.ToString() == "-1") { str = "select id,AIName from t_M_AnalysisItem"; ds = new MyDataOp(str).CreateDataSet(); cb_analysisList.DataSource = ds; cb_analysisList.DataValueField = "id"; cb_analysisList.DataTextField = "AIName"; cb_analysisList.DataBind(); } else { str = "select id,AIName from t_M_AnalysisItem where ClassID='" + DropList_AnalysisMainItem.SelectedValue.ToString() + "'"; ds = new MyDataOp(str).CreateDataSet(); cb_analysisList.DataSource = ds; cb_analysisList.DataValueField = "id"; cb_analysisList.DataTextField = "AIName"; cb_analysisList.DataBind(); } if (ds.Tables[0].Rows.Count > 0) { str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' "; DataSet dscheck = new MyDataOp(str).CreateDataSet(); if (dscheck.Tables[0].Rows.Count > 0) { foreach (ListItem LI in cb_analysisList.Items) { foreach (DataRow dr in dscheck.Tables[0].Rows) { if (dr[0].ToString() == LI.Value) { LI.Selected = true; } } } } dscheck.Dispose(); } ds.Dispose(); Query(); }
//int fileaddress = 0; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LabMessage1.Text = ""; LabMessage2.Text = ""; if (Request.QueryString["kw"] != null && Request.QueryString["file"] != null) { strSelectedId = Request.QueryString["kw"].ToString(); filestr = Request.QueryString["file"].ToString(); } string str = "select id,ReportNumber 报告编号,ReportUploadDate 上传日期,ReportAddress 报告地址 from t_M_ReporInfo where id='" + strSelectedId + "' and fileflag=1"; DataSet ds = new MyDataOp(str).CreateDataSet(); GridView_Report.DataSource = ds; GridView_Report.DataBind(); ds.Dispose(); } }
//查询出某个样品的分析项目列表 protected void queryAnalysisItem() { string sql = "select t_M_MonitorItem.id,MonitorItem,t_M_MonitorItem.SampleID,t_M_SampleInfor.SampleID 样品编号,AIName 分析项目 ,Num 数量,ReportDate 收到时间,flag,Remark 备注 from t_M_MonitorItem,t_M_AnalysisItem,t_M_SampleInfor where t_M_SampleInfor.id=t_M_MonitorItem.SampleID and t_M_MonitorItem.MonitorItem=t_M_AnalysisItem.id and t_M_SampleInfor.id='" + strSelectedId + "' order by t_M_SampleInfor.SampleID"; DataSet ds = new MyDataOp(sql).CreateDataSet(); DataColumn dc = new DataColumn("状态"); ds.Tables[0].Columns.Add(dc); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["flag"].ToString() == "0") { dr["状态"] = "未完成"; } else { dr["状态"] = "已完成"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_ListAnalysisItem.DataSource = ds; grdvw_ListAnalysisItem.DataBind(); int intColumnCount = grdvw_ListAnalysisItem.Rows[0].Cells.Count; grdvw_ListAnalysisItem.Rows[0].Cells.Clear(); grdvw_ListAnalysisItem.Rows[0].Cells.Add(new TableCell()); grdvw_ListAnalysisItem.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_ListAnalysisItem.DataSource = ds; grdvw_ListAnalysisItem.DataBind(); } ds.Dispose(); grdvw_ListAnalysisItem.Caption = "<FONT style='WIDTH: 102.16%; COLOR: #3333FF;font-size:14pt; LINE-HEIGHT: 150%; FONT-FAMILY: 楷体_GB2312; HEIGHT: 35px'><b>" + strSampleId + "的分析项目列表</b></font>"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "showAddEdit();", true); ReportSelectQuery(); }
private void CreateChildNodes(TreeNode tnParentNode, int NodeId) { string strSql = "select t_R_RoleMenu.MenuID,MenuName,URL from t_R_Role,t_R_Menu,t_R_RoleMenu " + " where t_R_Role.RoleID=t_R_RoleMenu.RoleID and " + " t_R_RoleMenu.MenuID=t_R_Menu.ID and " + " t_R_Role.RoleID='" + Request.Cookies["Cookies"].Values["u_role"].ToString() + "' and " + "t_R_Menu.FatherID='" + NodeId + "' and t_R_Menu.flag>=1 and t_R_RoleMenu.checked='1' order by t_R_Menu.OrderID"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { TreeNode tnChild = new TreeNode(); tnChild.Text = ds.Tables[0].Rows[i]["MenuName"].ToString(); tnChild.NavigateUrl = ds.Tables[0].Rows[i]["URL"].ToString(); tnChild.Expanded = true; tnParentNode.ChildNodes.Add(tnChild); CreateChildNodes(tnChild, Int16.Parse(ds.Tables[0].Rows[i]["MenuID"].ToString())); } ds.Dispose(); }
private void SummaryQuery() { //string sql = "SELECT t_M_AnalysisItem.AIName,"; //sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NULL THEN t_M_MonitorItem.num ELSE 0 END) AS undone,"; //sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NOT NULL THEN t_M_MonitorItem.num ELSE 0 END) AS done "; //sql += "FROM t_M_MonitorItem INNER JOIN t_M_AnalysisItem ON t_M_MonitorItem.MonitorItem = t_M_AnalysisItem.id INNER JOIN t_M_SampleInfor ON t_M_MonitorItem.SampleID = t_M_SampleInfor.id inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID "; //sql += "WHERE (t_M_ReporInfo.StatusID < 6) GROUP BY t_M_AnalysisItem.AIName"; string sql = "select * from view_ywc"; //DataSet dss = new MyDataOp(sql).CreateDataSetP("tj"); DataSet dss = new MyDataOp(sql).CreateDataSet(); outputSum = "<table><tr><td>分析项目</td>"; if (dss.Tables[0].Rows.Count > 0) { string AIName = ""; string UnDone = ""; string Done = ""; for (int m = 0; m < dss.Tables[0].Rows.Count; m++) { AIName = dss.Tables[0].Rows[m][0].ToString(); outputSum += "<td>" + AIName + "</td>"; } outputSum += "</tr><tr><td>已完成</td>"; for (int n = 0; n < dss.Tables[0].Rows.Count; n++) { Done = dss.Tables[0].Rows[n][2].ToString(); outputSum += "<td>" + Done + "</td>"; } outputSum += "</tr><tr><td>未完成</td>"; for (int l = 0; l < dss.Tables[0].Rows.Count; l++) { UnDone = dss.Tables[0].Rows[l][1].ToString(); outputSum += "<td>" + UnDone + "</td>"; } } outputSum += "</tr></table>"; dss.Dispose(); }
private void Query() { string strSql = "select t_M_ReporInfo.id,CreateDate 时间,t_M_ReporInfo.ItemType,ItemName 项目类型,ReportName 报告标识,ClientID,ClientName 区域,urgent 备注,Ulevel,wtdepart 委托单位 from t_M_ReporInfo,t_M_ItemInfo,t_M_ClientInfo where t_M_ClientInfo.id=ClientID and t_M_ReporInfo.ItemType=t_M_ItemInfo.ItemID and (StatusID=1) order by t_M_ReporInfo.id"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
private void AddChildNode(TreeNode parent, string ID) { DataSet dataSet = new DataSet(); string str = "select * from t_document where PARENTID =" + "'" + ID + "'"; try {//异常捕捉,并记错误日志。修改人:WQ dataSet = new MyDataOp(str).CreateDataSet(); foreach (DataRow row in dataSet.Tables[0].Rows) { TreeNode child = new TreeNode(); child.Text = row["NAME"].ToString(); parent.ChildNodes.Add(child); this.AddChildNode(child, row["ID"].ToString()); string strContent = row["LINK"].ToString(); //Regex urlregex = new Regex(@"(http:\/\/([\w.]+\/?)\S*)", // RegexOptions.IgnoreCase | RegexOptions.Compiled); //strContent = urlregex.Replace(strContent, // "<a href=\"\" target=\"_blank\">" + child.Text + "</a>"); } } catch (Exception msg) { //logExpert.writOperateLog("专家系统加载目录" + msg.Message, Session.SessionID, Request.Cookies["Cookies"].Values["UserID"].ToString(), "0001"); Response.Write("<script language='javascript'>alert('目录加载错误!');</script>"); } finally { if (dataSet != null) { dataSet.Dispose(); dataSet = null; } } }
private void Query() { //strSelectedId=txt_samplequery.Text; string strSample = ""; string strDate = ""; if (txt_samplequery.Text != "") { strSample = "and ReportName like'%" + txt_samplequery.Text + "%'"; } if (drop_tkwether.SelectedValue.Trim() == "0") { strSample += " and (StatusID=6)"; } else { strSample += " and (StatusID>=2 and StatusID!=6 )"; } if (cb_query_fa.Checked) { strSample += " and hanwether=1"; } else { strSample += " and hanwether=0"; } if (txt_QueryTime.Text != "") { strDate = " and ReportAccessDate>= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00") + "' "; } if (txt_QueryTimeEnd.Text != "") { strDate = " and ReportAccessDate<= '" + DateTime.Parse(txt_QueryTimeEnd.Text.Trim() + " 00:00:00") + "'"; } //TBD//项目负责人只能看到自己的项目 string strSql = "select t_Y_FlowInfo.id,t_Y_FlowInfo.ReportAccessDate 时间,t_Y_FlowInfo.ItemType,ItemName 项目类型,ReportName 报告标识,urgent 备注,t_Y_FlowInfo.Ulevel,Projectname 项目名称,rwclass,jcmethod,address,lxman,lxtel,lxemail,wtdepart,wether,varman1,vardate1,varremark1,t_Y_FlowInfo.chargeman,hanwether from t_Y_FlowInfo,t_M_ItemInfo where t_Y_FlowInfo.ItemType=t_M_ItemInfo.ItemID " + strSample + strDate + " order by t_Y_FlowInfo.ReportAccessDate"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); DataColumn dc = new DataColumn("监测方式"); ds.Tables[0].Columns.Add(dc); DataColumn dc0 = new DataColumn("任务类型"); ds.Tables[0].Columns.Add(dc0); DataColumn dc1 = new DataColumn("委托单位"); ds.Tables[0].Columns.Add(dc1); DataColumn dc2 = new DataColumn("项目负责人"); ds.Tables[0].Columns.Add(dc2); DAl.Sample getobj = new DAl.Sample(); DataTable dtmode = getobj.GetMode("", "mode", ""); DAl.Station get = new DAl.Station(); DataTable dtstation = get.GetWTByName(""); DAl.User.Users userobj = new DAl.User.Users(); DataTable dtuser = userobj.GetUsersDt(""); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["rwclass"].ToString() == "1") { dr["任务类型"] = "委托监测"; } else { dr["任务类型"] = "例行监测"; } DataRow[] drsel = dtmode.Select("code='" + dr["jcmethod"].ToString() + "'"); if (drsel.Length == 1) { dr["监测方式"] = drsel[0]["name"].ToString(); } else { dr["监测方式"] = ""; } dr["委托单位"] = dr["wtdepart"].ToString(); if (dr["chargeman"].ToString() != "") { DataRow[] druser = dtuser.Select("UserID='" + dr["chargeman"].ToString().Trim() + "'"); if (druser.Length == 1) { dr["项目负责人"] = druser[0]["name"].ToString(); } else { dr["项目负责人"] = ""; } } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
private void Query() { DataSet ds; StringBuilder outputStr = new StringBuilder(); outputStr.Append("<table>"); DateTime start = DateTime.Parse(txt_StartTime.Text.Trim() + " 0:00:00"); DateTime end = DateTime.Parse(txt_EndTime.Text.Trim() + " 23:59:59"); string strSql = "SELECT t_M_ReporInfo.ReportName, t_M_ReporInfo.ReportRemark,t_M_ItemInfo.ItemName, t_M_SampleInfor.id, t_M_SampleInfor.AccessDate, t_M_SampleType.SampleType, t_M_SampleInfor.SampleID, t_M_SampleInfor.UserID,t_M_SampleInfor.CreateDate, t_M_ReporInfo.ReportWriteDate,t_M_ReporInfo.ReportWriteUserID,t_M_ReporInfo.ReportWriteRemark,t_M_ReporInfo.ReportWriteUserID, t_M_ReporInfo.ReportWriteRemark,t_M_ReporInfo.ReportDataDate, t_M_ReporInfo.ReportDataUser,t_M_ReporInfo.ReportDataRemark, t_M_ReporInfo.ReportCheckDate,t_M_ReporInfo.ReportSignUserID, t_M_ReporInfo.ReportProofRemark,t_M_ReporInfo.ReportSignDate,t_M_ReporInfo.ReportSignUserID,t_M_ReporInfo.ReportSignRemark, t_M_ReporInfo.ReportBindDate,t_M_ReporInfo.StatusID,t_M_ReporInfo.urgent FROM t_M_ReporInfo INNER JOIN t_M_SampleInfor ON t_M_ReporInfo.id = t_M_SampleInfor.ReportID INNER JOIN t_M_ItemInfo ON t_M_ReporInfo.ItemType = t_M_ItemInfo.ItemID INNER JOIN t_M_SampleType ON t_M_SampleInfor.TypeID = t_M_SampleType.TypeID WHERE (t_M_ReporInfo.StatusID >=6) and t_M_SampleInfor.AccessDate between '" + start + "' and '" + end + "' order by t_M_SampleInfor.AccessDate desc"; string ItemSql = ""; ds = new MyDataOp(strSql).CreateDataSet(); string strtemp = "select Name,UserID from t_R_UserInfo"; DataSet ds_User = new MyDataOp(strtemp).CreateDataSet(); foreach (DataRow dr in ds.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["ReportWriteUserID"].ToString() == drr["UserID"].ToString()) { dr["ReportWriteUserID"] = drr["Name"].ToString(); } if (dr["ReportDataUser"].ToString() == drr["UserID"].ToString()) { dr["ReportDataUser"] = drr["Name"].ToString(); } if (dr["ReportSignUserID"].ToString() == drr["UserID"].ToString()) { dr["ReportSignUserID"] = drr["Name"].ToString(); } if (dr["ReportSignUserID"].ToString() == drr["UserID"].ToString()) { dr["ReportSignUserID"] = drr["Name"].ToString(); } } } kk = ds.Tables[0].Rows.Count; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { outputStr.Append("<tr>"); outputStr.Append("<td rowspan='3' width='5%' class='AutoNewline'>" + (i + 1).ToString() + "</td>"); if (ds.Tables[0].Rows[i]["AccessDate"].ToString() != "") { string strurgent = ""; strurgent = ds.Tables[0].Rows[i]["urgent"].ToString(); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'><font color=red>" + ds.Tables[0].Rows[i]["ReportName"].ToString() + "</font></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ItemName"].ToString() + "</td>"); outputStr.Append("<td rowspan='3' width='10%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["AccessDate"].ToString() + "</td>"); outputStr.Append("<td rowspan='3' width='5%' style='background-color:#9AFF9A' class='AutoNewline'>" + strurgent + "</td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["SampleType"].ToString() + "</td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'><font color=red>" + ds.Tables[0].Rows[i]["SampleID"].ToString() + "</font></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportRemark"].ToString() + "</td>"); } else { outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='10%' style='background-color:#9AFF9A' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='5%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'></td>"); } //if (ds.Tables[0].Rows[i]["ReportRemark"] != null) //{ //报告校核 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 2) { if (ds.Tables[0].Rows[i]["ReportdataDate"].ToString() != "") { outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + DateTime.Parse(ds.Tables[0].Rows[i]["ReportdataDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } //} //else //{ // if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 2) // { // outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'></td>"); // } // else // { // outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); // } //}、 //报告编制 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 3 && ds.Tables[0].Rows[i]["ReportWriteDate"].ToString() != "") { outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + DateTime.Parse(ds.Tables[0].Rows[i]["ReportWriteDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } //报告审核 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 4) { // if (ds.Tables[0].Rows[i]["ReportProofDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + DateTime.Parse(ds.Tables[0].Rows[i]["ReportCheckDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } //报告签发 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { //if (ds.Tables[0].Rows[i]["ReportCheckDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + DateTime.Parse(ds.Tables[0].Rows[i]["ReportCheckDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } // if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 6) //报告装订 if (ds.Tables[0].Rows[i]["ReportSignDate"].ToString() != "" && int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 6) { outputStr.Append("<td width='8%' rowspan='3' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignDate"].ToString() + "</td>"); } else { outputStr.Append("<td rowspan='3' style='background-color:#FF8C69' class='AutoNewline'></td>"); } //if (ds.Tables[0].Rows[i]["ReportBindDate"].ToString() != "" && int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >=6) // outputStr.Append( "<td width='8%' rowspan='3' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportBindDate"].ToString() + "</td>"); //else // outputStr.Append( "<td width='8%' rowspan='3' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("</tr>"); outputStr.Append("<tr>"); //报告校核 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 2) { //if (ds.Tables[0].Rows[i]["ReportWriteDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportDataUser"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportDataUser"].ToString() + "</td>"); } //报告编制 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 3) { //if (ds.Tables[0].Rows[i]["ReportProofDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportWriteUserID"].ToString() + "</td>"); } else { outputStr.Append("<td style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportWriteUserID"].ToString() + "</td>"); } //报告审核 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 4) { //if (ds.Tables[0].Rows[i]["ReportCheckDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignUserID"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignUserID"].ToString() + "</td>"); } //报告签发 if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { //if (ds.Tables[0].Rows[i]["ReportCheckDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignUserID"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignUserID"].ToString() + "</td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 2) { //if (ds.Tables[0].Rows[i]["ReportWriteDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportdataRemark"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportdataRemark"].ToString() + "</td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 3) { //if (ds.Tables[0].Rows[i]["ReportProofDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportWriteRemark"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportWriteRemark"].ToString() + "</td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 4) { outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportProofRemark"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportProofRemark"].ToString() + "</td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignRemark"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignRemark"].ToString() + "</td>"); } outputStr.Append("</tr>"); //----分析项目----// ItemSql = "select t_MonitorItemDetail.id,t_M_AnalysisItemEx.AIName,t_MonitorItemDetail.FxDate,Remark,Name from t_MonitorItemDetail,t_M_AnalysisItemEx,t_R_UserInfo "; ItemSql += "where t_MonitorItemDetail.SampleID = '" + ds.Tables[0].Rows[i]["SampleID"].ToString() + "' and t_MonitorItemDetail.MonitorItem = t_M_AnalysisItemEx.id and fxuser=t_R_UserInfo.UserID "; ItemSql += "order by t_MonitorItemDetail.id"; DataSet Ids = new MyDataOp(ItemSql).CreateDataSet(); outputStr.Append("<tr><td colspan='13'><table width='100%' class='listTable2'><tr><td colspan='10' align='center'>分析项目</td></tr>"); // outputStr.Append( "<tr align='center'>"; //outputStr.Append( "<td rowspan='4' width='8%'>分析项目</td>"; if (Ids.Tables[0].Rows.Count > 0 && Ids.Tables[0].Rows.Count <= 10) { outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); //数量 outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { //if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") //{ outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Name"].ToString() + "</td>"); //} //else //{ // outputStr.Append("<td width='7%' style='background-color:#FF8C69'>1</td>"); //} } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); //日期 outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + DateTime.Parse(Ids.Tables[0].Rows[j]["FxDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%'></td>"); } outputStr.Append("</tr>"); } else { int num = Ids.Tables[0].Rows.Count / 10 + 1; int ni = 0; for (ni = 0; ni < num - 1; ni++) { // outputStr.Append( "</tr>"; outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } } outputStr.Append("</tr>"); //数量 outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Name"].ToString() + "</td>"); //if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") //{ // outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>1</td>"); //} //else //{ // outputStr.Append("<td width='7%' style='background-color:#FF8C69'>1</td>"); //} } outputStr.Append("</tr>"); //日期 outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + DateTime.Parse(Ids.Tables[0].Rows[j]["FxDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } } outputStr.Append("</tr>"); } if (ni == num - 1) { outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Name"].ToString() + "</td>"); //if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") //{ // outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>1</td>"); //} //else //{ // outputStr.Append("<td width='7%' style='background-color:#FF8C69'>1</td>"); //} } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + DateTime.Parse(Ids.Tables[0].Rows[j]["FxtDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["FxDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); } Ids.Dispose(); } //将分析项目分行显示 outputStr.Append("</tr>"); outputStr.Append("</table></td></tr>"); //----分析项目----// } } ds.Dispose(); outputStr.Append("</table>"); Samplelist.Text = outputStr.ToString(); }
protected void grdvw_List_RowEditing(object sender, GridViewEditEventArgs e) { strSelectedId = grdvw_List.Rows[e.NewEditIndex].Cells[1].Text; txt_ItemName.Text = grdvw_List.Rows[e.NewEditIndex].Cells[2].Text; if (grdvw_List.Rows[e.NewEditIndex].Cells[2].Text.Trim() != " ") { txt_AccessTime.Text = grdvw_List.Rows[e.NewEditIndex].Cells[4].Text; } else { txt_AccessTime.Text = ""; } txt_person0.Text = grdvw_List.Rows[e.NewEditIndex].Cells[3].Text; txt_ItemName.ReadOnly = true; txt_person0.ReadOnly = true; //备注绑定 //项目接收备注显示 string remarkstr = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='1' order by t_Y_Detail.id"; DataSet ds_Remark1 = new MyDataOp(remarkstr).CreateDataSet(); string strtemp = "select Name,UserID from t_R_UserInfo"; DataSet ds_User = new MyDataOp(strtemp).CreateDataSet(); foreach (DataRow dr in ds_Remark1.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView1.DataSource = ds_Remark1; GridView1.DataBind(); string remarkstr2 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='2' order by t_Y_Detail.id"; DataSet ds_Remark2 = new MyDataOp(remarkstr2).CreateDataSet(); foreach (DataRow dr in ds_Remark2.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView2.DataSource = ds_Remark2; GridView2.DataBind(); string remarkstr3 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='3' order by t_Y_Detail.id"; DataSet ds_Remark3 = new MyDataOp(remarkstr3).CreateDataSet(); foreach (DataRow dr in ds_Remark3.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView3.DataSource = ds_Remark3; GridView3.DataBind(); string remarkstr4 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='4' order by t_Y_Detail.id"; DataSet ds_Remark4 = new MyDataOp(remarkstr4).CreateDataSet(); foreach (DataRow dr in ds_Remark4.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView4.DataSource = ds_Remark4; GridView4.DataBind(); string remarkstr5 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='5' order by t_Y_Detail.id"; DataSet ds_Remark5 = new MyDataOp(remarkstr5).CreateDataSet(); foreach (DataRow dr in ds_Remark5.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView5.DataSource = ds_Remark5; GridView5.DataBind(); string remarkstr6 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='6' order by t_Y_Detail.id"; DataSet ds_Remark6 = new MyDataOp(remarkstr6).CreateDataSet(); foreach (DataRow dr in ds_Remark6.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView6.DataSource = ds_Remark6; GridView6.DataBind(); string remarkstr7 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='7' order by t_Y_Detail.id"; DataSet ds_Remark7 = new MyDataOp(remarkstr7).CreateDataSet(); foreach (DataRow dr in ds_Remark7.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView7.DataSource = ds_Remark7; GridView7.DataBind(); string remarkstr8 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='8' order by t_Y_Detail.id"; DataSet ds_Remark8 = new MyDataOp(remarkstr8).CreateDataSet(); foreach (DataRow dr in ds_Remark8.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView8.DataSource = ds_Remark8; GridView8.DataBind(); //备注绑定 //有回退的,则显示回退备注,非回退,不显示 string backremarkstr = "select createdate 备注时间,t_Y_BackInfo.remark 备注及意见,userid 用户名 from t_Y_BackInfo inner join t_Y_FlowInfo on t_Y_BackInfo.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_BackInfo.functionid where t_Y_BackInfo.itemid='" + strSelectedId + "' and t_Y_BackInfo.functionid='10' order by t_Y_BackInfo.id"; // string backremarkstr = "select * from t_Y_BackInfo where itemid='" + strSelectedId + "' and functionid='2'"; DataSet ds_Remark_back = new MyDataOp(backremarkstr).CreateDataSet(); foreach (DataRow dr in ds_Remark_back.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView_back.DataSource = ds_Remark_back; GridView_back.DataBind(); //回退的数据编辑,显示前面的备注信息,只读 string remarkstr_now = "select ItemName 项目类型, name 阶段,CreateDate 备注时间,bz 备注及意见,userid 用户名,flag,t_Y_Detail.id from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='9' order by t_Y_Detail.id"; DataSet ds_Remark_now = new MyDataOp(remarkstr_now).CreateDataSet(); foreach (DataRow dr in ds_Remark_now.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView_now.DataSource = ds_Remark_now; GridView_now.DataBind(); DataRow[] dr_remark = ds_Remark_now.Tables[0].Select("flag=0"); if (dr_remark.Length > 0) { txt_Remark_now.Text = dr_remark[0][3].ToString(); SelectedId = dr_remark[0][6].ToString(); } if (ds_Remark_back.Tables[0].Rows.Count > 0) { Panel_back.Visible = true; } else { Panel_back.Visible = false; } ds_Remark1.Dispose(); ds_Remark2.Dispose(); ds_Remark3.Dispose(); ds_Remark4.Dispose(); ds_Remark5.Dispose(); ds_Remark6.Dispose(); ds_Remark7.Dispose(); ds_Remark8.Dispose(); // ds_Remark9.Dispose(); //ds_Remark10.Dispose(); //ds_Remark11.Dispose(); //ds_Remark12.Dispose(); //ds_Remark13.Dispose(); //ds_Remark14.Dispose(); ds_Remark_back.Dispose(); ds_Remark_now.Dispose(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "showAddEdit();", true); }
private void Query() { //strSelectedId=txt_samplequery.Text; string strSample = ""; string strDate = ""; if (txt_samplequery.Text != "") { strSample = "and ReportName like'%" + txt_samplequery.Text + "%'"; } strSample += " and tkwether='1'"; if (drop_tkwether.SelectedValue.ToString() == "3") { strSample += " and (statusID='3')"; btn_OK.Visible = true; btn_Save.Visible = true; panel_han.Visible = true; btn_print.Visible = false; btn_back.Visible = true; grdvw_List.Caption = "<FONT style='WIDTH: 102.16%; COLOR:#2292DD;font-size:14pt; LINE-HEIGHT: 150%; FONT-FAMILY: 楷体_GB2312; HEIGHT: 35px'><b>编制整改函</b></font>"; } else { strSample += " and (statusID='5')"; if (Request.Cookies["Cookies"].Values["u_purview"].ToString().Substring(2, 1) != "1") { btn_OK.Visible = false; } else { btn_OK.Visible = true; } btn_back.Visible = false; btn_Save.Visible = false; panel_han.Visible = true; btn_print.Visible = true; grdvw_List.Caption = "<FONT style='WIDTH: 102.16%; COLOR:#2292DD;font-size:14pt; LINE-HEIGHT: 150%; FONT-FAMILY: 楷体_GB2312; HEIGHT: 35px'><b>编制整改函</b></font>"; } if (Request.Cookies["Cookies"].Values["u_purview"].ToString().Substring(2, 1) != "1") { strSample += " and chargeman='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "'"; } if (txt_QueryTime.Text != "") { strDate = " and (year(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string strSql = "select t_Y_FlowInfo.id,t_Y_FlowInfo.ReportAccessDate 时间,t_Y_FlowInfo.ItemType,ItemName 项目类型,ReportName 报告标识,urgent 备注,t_Y_FlowInfo.Ulevel,Projectname 项目名称,t_R_UserInfo.Name 项目负责人,rwclass,jcmethod,address,lxman,lxtel,lxemail,wtdepart,wether,varman1,vardate1,varremark1,t_Y_FlowInfo.chargeman,varman2,vardate2,varremark2,tkwether,hcontent,hfwdw,hcs,hanNO 函文号 from t_Y_FlowInfo,t_M_ItemInfo,t_R_UserInfo where t_Y_FlowInfo.ItemType=t_M_ItemInfo.ItemID and chargeman=t_R_UserInfo.UserID and hanwether=1 " + strSample + strDate + " order by t_Y_FlowInfo.ReportAccessDate"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); DataColumn dc = new DataColumn("监测方式"); ds.Tables[0].Columns.Add(dc); DataColumn dc0 = new DataColumn("任务类型"); ds.Tables[0].Columns.Add(dc0); DataColumn dc1 = new DataColumn("委托单位"); ds.Tables[0].Columns.Add(dc1); DAl.Sample getobj = new DAl.Sample(); DataTable dtmode = getobj.GetMode("", "mode", ""); DAl.Station get = new DAl.Station(); DataTable dtstation = get.GetWTByName(""); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } if (dr["rwclass"].ToString() == "1") { dr["任务类型"] = "委托监测"; } else { dr["任务类型"] = "例行监测"; } DataRow[] drsel = dtmode.Select("code='" + dr["jcmethod"].ToString() + "'"); if (drsel.Length == 1) { dr["监测方式"] = drsel[0]["name"].ToString(); } else { dr["监测方式"] = ""; } //if (dr["wtdepart"].ToString().Trim() != "") //{ // DataRow[] drdep = dtstation.Select("id=" + dr["wtdepart"].ToString().Trim() + ""); // if (drdep.Length == 1) // dr["委托单位"] = drdep[0]["单位全称"].ToString(); // else dr["委托单位"] = dr["wtdepart"].ToString().Trim(); // } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
private void Query() { string constr = ""; if (txt_QueryTime.Text.Trim() != "") { constr = " and (year(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string strSql = "select t_M_SampleInfor.id, t_M_SampleInfor.SampleID AS 样品编号,t_M_ReporInfo.Ulevel ,t_M_SampleInfor.SampleDate AS 采样时间,t_M_SampleInfor.SampleAddress 采样点 ," + "t_M_SampleInfor.AccessDate AS 接样时间, " + " t_M_SampleInfor.TypeID, t_M_SampleType.SampleType AS 样品类型,t_M_SampleInfor.SampleProperty 样品性状, " + " t_M_SampleInfor.ypstatus, t_M_SampleInfor.ReportID,t_M_ReporInfo.chargeman 项目负责人" + " FROM t_M_ReporInfo inner join t_M_SampleInfor on t_M_ReporInfo.id=t_M_SampleInfor.ReportID INNER JOIN" + " t_M_SampleType ON " + " t_M_SampleInfor.TypeID = t_M_SampleType.TypeID where ( t_M_SampleInfor.SampleID in(select SampleID from t_MonitorItemDetail where flag <1) or t_M_SampleInfor.SampleID in(select SampleID from t_DrawSample where returndate is null and type=0 ) ) " + constr + " ORDER BY t_M_SampleInfor.AccessDate"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); DataColumn dcs = new DataColumn("样品状态"); ds.Tables[0].Columns.Add(dcs); DataColumn dcitem = new DataColumn("分析项目"); ds.Tables[0].Columns.Add(dcitem); DataColumn dcitemvalue = new DataColumn("分析项目编码"); ds.Tables[0].Columns.Add(dcitemvalue); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } if (dr["ypstatus"].ToString() == "1") { dr["样品状态"] = "领用中"; } else if (dr["ypstatus"].ToString() == "0") { dr["样品状态"] = "可领用"; } else { dr["样品状态"] = "领用中"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
protected void Query(int type) { //strSelectedId=txt_samplequery.Text; string strSample = ""; //样品编号 string strDate = ""; //接样时间 string strStatus = ""; //样品状态 string strItem = ""; //项目类型 string strType = ""; //样品名称 string strClient = ""; //委托单位 string strAnalysis = ""; // 分析项目; string strAanlysisStatus = ""; //样品分析状态 string strUrgent = ""; //按紧急程度 if (Drop_Urgent.SelectedValue != "-1") { if (Drop_Urgent.SelectedValue == "1") { strUrgent = "and t_M_ReporInfo.Ulevel=1"; } else { strUrgent = "and (t_M_ReporInfo.Ulevel<>1 or t_M_ReporInfo.Ulevel is null)"; } } if (txt_QuerySource.Text != "")//按样品来源 { strSample += "and t_M_SampleInfor.SampleSource like'%" + txt_QuerySource.Text + "%'"; } if (txt_QueryBS.Text != "")//按报告标识 { strSample += "and t_M_ReporInfo.ReportName like'%" + txt_QueryBS.Text + "%'"; } if (txt_samplequery.Text != "")//按样品编号 { strSample += "and t_M_SampleInfor.SampleID like'%" + txt_samplequery.Text + "%'"; } if (txt_QueryTime.Text.Trim() != "" && txt_QueryEndTime.Text.Trim() != "")//按采样时间 { DateTime start = DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00"); DateTime end = DateTime.Parse(txt_QueryEndTime.Text.Trim() + " 23:59:59"); strDate = " and AccessDate between '" + start + "' and '" + end + "'"; //strDate = " and (year(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } if (drop_status.SelectedValue != "-1")//按样品状态 { strStatus = " and t_M_ReporInfo.StatusID='" + drop_status.SelectedValue + "' "; } if (txt_item.SelectedValue != "-1")// 按项目类型 { strItem = " and t_M_ReporInfo.ItemType='" + txt_item.SelectedValue + "' "; } if (txt_type.SelectedValue != "-1")//按样品类型 { strType = " and t_M_SampleInfor.TypeID='" + txt_type.SelectedValue + "' "; } if (drop_client.SelectedValue != "-1")//按委托单位 { strClient = " and t_M_ReporInfo.ClientID='" + drop_client.SelectedValue + "' "; } if (drop_analysisstatus.SelectedValue != "-1") { strAanlysisStatus = " and t_MonitorItemDetail.flag=" + drop_analysisstatus.SelectedValue + ""; } bool flag = false; int i = 0; //string flagtype =""; //if(RadioButtonList1.SelectedValue==1) // flagtype = " and "; //else //flagtype = " or "; foreach (ListItem item in cb_analysisList.Items) { if (item.Selected) { flag = true; if (i == 0) { strAnalysis = " t_MonitorItemDetail.MonitorItem='" + item.Value + "' "; } else { strAnalysis += " or t_MonitorItemDetail.MonitorItem='" + item.Value + "' "; } //} i++; } } //按选中的分析项目查询 string strtitle = ""; if (flag) { strtitle += " and (" + strAnalysis + ")"; } string cstr = ""; if (cstr == "") { cstr = " and 1=1"; } if (Request.Cookies["Cookies"].Values["u_level"].ToString() == "12" && Request.Cookies["Cookies"].Values["u_role"].ToString() != "48") //zpto='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' or { strtitle += " and (chargeman ='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' or t_MonitorItemDetail.fxuser='******')"; } //if (Request.Cookies["Cookies"].Values["u_level"].ToString() == "12")//zpto='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' or //{ // strtitle += " and (chargeman ='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' or t_MonitorItemDetail.fxuser='******')"; //} cstr = strUrgent + strSample + strDate + strStatus + strItem + strType + strClient + strAanlysisStatus + strtitle; if (type == 0) { cstr += " and 1<>1"; } string strSql = "SELECT t_M_SampleInfor.id,t_M_ReporInfo.ReportName 报告标识,t_M_ReporInfo.Projectname 项目名称,t_M_SampleInfor.SampleID AS 样品编号,t_M_SampleInfor.SampleSource 样品来源,t_M_SampleInfor.SampleAddress 采样点 ," + "t_M_SampleInfor.AccessDate AS 接样时间,t_M_ReporInfo.chargeman 项目负责人, " + " t_M_SampleInfor.TypeID, t_M_AnalysisMainClassEx.ClassName AS 样品类型,t_M_SampleInfor.SampleProperty 样品性状, " + " t_M_SampleInfor.StatusID, t_M_SampleInfor.ReportID,t_M_SampleInfor.ReportRemark,AIName 监测项,experimentvalue 分析值, t_MonitorItemDetail.flag,zpto 指派给, zpto 状态" + " FROM t_M_ReporInfo inner join t_M_SampleInfor on t_M_ReporInfo.id=t_M_SampleInfor.ReportID INNER JOIN " + " t_M_AnalysisMainClassEx ON " + " t_M_SampleInfor.TypeID = t_M_AnalysisMainClassEx.ClassID inner join t_MonitorItemDetail on t_MonitorItemDetail.SampleID=t_M_SampleInfor.id inner join t_M_ANItemInf on t_M_ANItemInf.id=MonitorItem " + " WHERE " + " 1=1" + cstr + " ORDER BY t_M_SampleInfor.id"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); string strtemp = "select Name,UserID from t_R_UserInfo"; DataSet ds_User = new MyDataOp(strtemp).CreateDataSet(); foreach (DataRow dr in ds.Tables[0].Rows) { DataRow[] drs = ds_User.Tables[0].Select("UserID='" + dr["指派给"].ToString() + "'"); if (drs.Length > 0) { dr["指派给"] = drs[0]["Name"].ToString(); } DataRow[] drchargeman = ds_User.Tables[0].Select("UserID='" + dr["项目负责人"].ToString() + "'"); if (drchargeman.Length > 0) { dr["项目负责人"] = drchargeman[0]["Name"].ToString(); } switch (dr["flag"].ToString()) { case "1": dr["状态"] = "未领用"; break; case "2": dr["状态"] = "分析中"; break; case "0": dr["状态"] = "未指派"; break; default: dr["状态"] = "完成"; break; } if (dr["flag"].ToString() != "3") { dr["分析值"] = ""; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
protected void btn_upload_Click(object sender, EventArgs e) { string str1 = "select * from t_M_ReporInfo where id='" + strSelectedId + "' and ReportAddress is Null"; DataSet dss = new MyDataOp(str1).CreateDataSet(); if (dss.Tables[0].Rows.Count > 0) { bool fileOK = false; string path = filedirectory; if (FileUpload1.FileName != "") { String fileExtension = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName).ToLower(); String[] allowedExtensions = { ".doc", ".xls" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } if (fileOK) { string pathstr = path + "\\Report\\" + FileUpload1.FileName; try { FileUpload1.SaveAs(pathstr); LabMessage1.Text = "文件上传成功."; LabMessage2.Text = "<b>原文件路径:</b>" + FileUpload1.PostedFile.FileName + "<br />" + "<b>文件大小:</b>" + FileUpload1.PostedFile.ContentLength + "字节<br />" + "<b>文件类型:</b>" + FileUpload1.PostedFile.ContentType + "<br />"; string savestr = "update t_M_ReporInfo set ReportAddress='" + pathstr + "', ReportUploadDate=getdate(),fileflag=1 where id='" + strSelectedId + "'"; MyDataOp doobj = new MyDataOp(savestr); if (doobj.ExecuteCommand()) { WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")成功! " + LabMessage2.Text, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "window.alert('文件上传成功!');window.opener.location.href = '" + filestr + "';if(window.opener.progressWindow)window.opener.progressWindow.close();window.close();", true); } else { WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")文件上传成功!路径保存失败! " + LabMessage2.Text, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('文件上传成功!路径保存失败!')", true); } } catch (Exception ex) { WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")!存在异常: " + ex.Message.ToString(), Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); LabMessage1.Text = "文件上传不成功."; } } else { WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")!存在异常: 只能够Word和Excel文件.", Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); LabMessage1.Text = "只能够Word和Excel文件."; } } else { WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")!存在异常: 没有要上传的文件.", Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); LabMessage1.Text = " 没有要上传的文件."; } string str = "select id,ReportNumber 报告编号,ReportUploadDate 报告上传日期,ReportAddress 报告地址 from t_M_ReporInfo where id='" + strSelectedId + "' and fileflag=1"; DataSet ds = new MyDataOp(str).CreateDataSet(); GridView_Report.DataSource = ds; GridView_Report.DataBind(); } else { WebApp.Components.Log.SaveLog("报告编制中上传报告:(" + FileUpload1.PostedFile.FileName + ")已存在同名样品的报告文档! " + LabMessage2.Text, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('已存在改报告的监测报告文档!')", true); } dss.Dispose(); }
private void Query1() { StringBuilder outputStr = new StringBuilder(); outputStr.Append("<table>"); string strSql = ""; string ItemSql = ""; string sql = "select * from view_sstj"; DataSet ds = new MyDataOp(strSql).CreateDataSetP("ssxs"); string strtemp = "select Name,UserID from t_R_UserInfo"; DataSet ds_User = new MyDataOp(strtemp).CreateDataSet(); foreach (DataRow dr in ds.Tables[0].Rows) { DataRow[] dataUser = ds_User.Tables[0].Select("UserID='" + dr["ReportWriteUserID"].ToString() + "'"); foreach (DataRow drr in dataUser) { dr["ReportWriteUserID"] = drr["Name"].ToString(); } DataRow[] dataUser2 = ds_User.Tables[0].Select("UserID='" + dr["ReportProofUserID"].ToString() + "'"); foreach (DataRow drr in dataUser2) { dr["ReportProofUserID"] = drr["Name"].ToString(); } DataRow[] dataUser3 = ds_User.Tables[0].Select("UserID='" + dr["ReportSignUserID"].ToString() + "'"); foreach (DataRow drr in dataUser3) { dr["ReportSignUserID"] = drr["Name"].ToString(); } //foreach (DataRow drr in ds_User.Tables[0].Rows) //{ //if (dr["ReportWriteUserID"].ToString() == drr["UserID"].ToString()) // dr["ReportWriteUserID"] = drr["Name"].ToString(); //if (dr["ReportProofUserID"].ToString() == drr["UserID"].ToString()) // dr["ReportProofUserID"] = drr["Name"].ToString(); //if (dr["ReportSignUserID"].ToString() == drr["UserID"].ToString()) // dr["ReportSignUserID"] = drr["Name"].ToString(); //} } ds_User.Dispose(); kk = ds.Tables[0].Rows.Count; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { outputStr.Append("<tr>"); outputStr.Append("<td rowspan='3' width='5%' class='AutoNewline'>" + (i + 1).ToString() + "</td>"); if (ds.Tables[0].Rows[i]["AccessDate"].ToString() != "") { string strurgent = ""; strurgent = ds.Tables[0].Rows[i]["urgent"].ToString(); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'><font color=red>" + ds.Tables[0].Rows[i]["ReportName"].ToString() + "</font></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ItemName"].ToString() + "</td>"); outputStr.Append("<td rowspan='3' width='10%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["AccessDate"].ToString() + "</td>"); outputStr.Append("<td rowspan='3' width='5%' style='background-color:#9AFF9A' class='AutoNewline'>" + strurgent + "</td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["SampleType"].ToString() + "</td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'><font color=red>" + ds.Tables[0].Rows[i]["SampleID"].ToString() + "</font></td>"); } else { outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='10%' style='background-color:#9AFF9A' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='5%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } if (ds.Tables[0].Rows[i]["ReportRemark"] != null) { if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 2) { outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportRemark"].ToString() + "</td>"); } else { outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportRemark"].ToString() + "</td>"); } } else { if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 2) { outputStr.Append("<td rowspan='3' width='8%' style='background-color:#9AFF9A' class='AutoNewline'></td>"); } else { outputStr.Append("<td rowspan='3' width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 3) { if (ds.Tables[0].Rows[i]["ReportWriteDate"].ToString() != "") { outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + DateTime.Parse(ds.Tables[0].Rows[i]["ReportWriteDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 4) { // if (ds.Tables[0].Rows[i]["ReportProofDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + DateTime.Parse(ds.Tables[0].Rows[i]["ReportProofDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { //if (ds.Tables[0].Rows[i]["ReportCheckDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + DateTime.Parse(ds.Tables[0].Rows[i]["ReportCheckDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } // if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 6) if (ds.Tables[0].Rows[i]["ReportSignDate"].ToString() != "" && int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { outputStr.Append("<td width='8%' rowspan='3' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignDate"].ToString() + "</td>"); } else { outputStr.Append("<td rowspan='3' style='background-color:#FF8C69' class='AutoNewline'></td>"); } if (ds.Tables[0].Rows[i]["ReportBindDate"].ToString() != "" && int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { outputStr.Append("<td width='8%' rowspan='3' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportBindDate"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' rowspan='3' style='background-color:#FF8C69' class='AutoNewline'></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 3) { //if (ds.Tables[0].Rows[i]["ReportWriteDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportWriteUserID"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 4) { //if (ds.Tables[0].Rows[i]["ReportProofDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportProofUserID"].ToString() + "</td>"); } else { outputStr.Append("<td style='background-color:#FF8C69'></td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { //if (ds.Tables[0].Rows[i]["ReportCheckDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportSignUserID"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 3) { //if (ds.Tables[0].Rows[i]["ReportWriteDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportWriteRemark"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportWriteRemark"].ToString() + "</td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 4) { //if (ds.Tables[0].Rows[i]["ReportProofDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportProofRemark"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportProofRemark"].ToString() + "</td>"); } if (int.Parse(ds.Tables[0].Rows[i]["StatusID"].ToString()) >= 5) { //if (ds.Tables[0].Rows[i]["ReportCheckDate"].ToString() != "") outputStr.Append("<td width='8%' style='background-color:#9AFF9A' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportProofRemark"].ToString() + "</td>"); } else { outputStr.Append("<td width='8%' style='background-color:#FF8C69' class='AutoNewline'>" + ds.Tables[0].Rows[i]["ReportProofRemark"].ToString() + "</td>"); } outputStr.Append("</tr>"); //----分析项目----// ItemSql = "select t_M_MonitorItem.id,t_M_AnalysisItem.AIName,t_M_MonitorItem.Num,t_M_MonitorItem.ReportDate,Remark from t_M_MonitorItem,t_M_AnalysisItem "; ItemSql += "where t_M_MonitorItem.SampleID = '" + ds.Tables[0].Rows[i]["id"].ToString() + "' and t_M_MonitorItem.MonitorItem = t_M_AnalysisItem.id "; ItemSql += "order by t_M_MonitorItem.id"; DataSet Ids = new MyDataOp(ItemSql).CreateDataSet(); outputStr.Append("<tr><td colspan='13'><table width='100%' class='listTable2'><tr><td colspan='10' align='center'>分析项目</td></tr>"); // outputStr.Append( "<tr align='center'>"; //outputStr.Append( "<td rowspan='4' width='8%'>分析项目</td>"; if (Ids.Tables[0].Rows.Count > 0 && Ids.Tables[0].Rows.Count <= 10) { outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); //数量 outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Num"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["Num"].ToString() + "</td>"); } } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); //日期 outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + DateTime.Parse(Ids.Tables[0].Rows[j]["ReportDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%'></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = 0; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } } for (int mi = 0; mi < 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%'></td>"); } outputStr.Append("</tr>"); } else { int num = Ids.Tables[0].Rows.Count / 10 + 1; int ni = 0; for (ni = 0; ni < num - 1; ni++) { // outputStr.Append( "</tr>"; outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } } outputStr.Append("</tr>"); //数量 outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Num"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["Num"].ToString() + "</td>"); } } outputStr.Append("</tr>"); //日期 outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + DateTime.Parse(Ids.Tables[0].Rows[j]["ReportDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < (ni + 1) * 10; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } } outputStr.Append("</tr>"); } if (ni == num - 1) { outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["AIName"].ToString() + "</td>"); } } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Num"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'>" + Ids.Tables[0].Rows[j]["Num"].ToString() + "</td>"); } } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + DateTime.Parse(Ids.Tables[0].Rows[j]["ReportDate"].ToString()).ToString("MM-dd HH:mm") + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); outputStr.Append("<tr>"); for (int j = ni * 10; j < Ids.Tables[0].Rows.Count; j++) { if (Ids.Tables[0].Rows[j]["ReportDate"].ToString() != "") { outputStr.Append("<td width='7%' style='background-color:#9AFF9A'>" + Ids.Tables[0].Rows[j]["Remark"].ToString() + "</td>"); } else { outputStr.Append("<td width='7%' style='background-color:#FF8C69'></td>"); } } for (int mi = 0; mi < (ni + 1) * 10 - Ids.Tables[0].Rows.Count; mi++) { outputStr.Append("<td width='7%' ></td>"); } outputStr.Append("</tr>"); } Ids.Dispose(); } //将分析项目分行显示 outputStr.Append("</tr>"); outputStr.Append("</table></td></tr>"); //----分析项目----// } } outputStr.Append("</table>"); Samplelist.Text = outputStr.ToString(); ds.Dispose(); //if (flagRelash == "2") //{ // Response.ContentType = "text/xml"; // Response.Write(outputStr.ToString()); // Response.End(); // flagRelash = ""; //} }
private void Query() { string constr = ""; if (txt_QueryTime.Text.Trim() != "") { constr = " and (year(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string strSql = "select t_DrawSample.ID, t_M_ReporInfo.Ulevel , t_M_SampleInfor.SampleID AS 样品编号," + "t_M_SampleInfor.AccessDate AS 接样时间, " + " t_M_SampleInfor.TypeID, t_M_AnalysisMainClassEx.ClassName AS 样品类型, t_DrawSample.CreateDate 领用时间,LyUserID,t_DrawSample.fxflag,jhtime,jhman " + " FROM t_M_ReporInfo inner join t_M_SampleInfor on t_M_ReporInfo.id=t_M_SampleInfor.ReportID INNER JOIN" + " t_M_AnalysisMainClassEx ON " + " t_M_SampleInfor.TypeID = t_M_AnalysisMainClassEx.ClassID inner join t_DrawSample on t_DrawSample.SampleID=t_M_SampleInfor.SampleID where LyUserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' and t_M_SampleInfor.StatusID<=2 " + constr + " and t_DrawSample.fxflag=0 and t_DrawSample.type=0 and yxflag=0 ORDER BY t_M_SampleInfor.SampleID"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); DataColumn dcs = new DataColumn("分析项目"); ds.Tables[0].Columns.Add(dcs); DataColumn dcs1 = new DataColumn("领用分析项目"); ds.Tables[0].Columns.Add(dcs1); DataColumn dcs2 = new DataColumn("分析单状态"); ds.Tables[0].Columns.Add(dcs2); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } string getitemstr = "select AIName,MonitorItem,fxDanID from t_MonitorItemDetail inner join t_M_AnalysisItemEx on t_M_AnalysisItemEx.id=t_MonitorItemDetail.MonitorItem where SampleID='" + dr["样品编号"].ToString() + "' and delflag=0"; DataSet dsitem = new MyDataOp(getitemstr).CreateDataSet(); if (dsitem != null && dsitem.Tables.Count > 0) { DataRow[] drselect = dsitem.Tables[0].Select("fxDanID='" + dr["id"].ToString() + "'"); foreach (DataRow drr in dsitem.Tables[0].Rows) { dr["分析项目"] += drr[0].ToString() + ","; } foreach (DataRow drr in drselect) { dr["领用分析项目"] += drr[0].ToString() + ","; } } if (dr["fxflag"].ToString() == "0") { dr["分析单状态"] = "分析中"; } else if (dr["fxflag"].ToString() == "1") { dr["分析单状态"] = "未提交"; } else if (dr["fxflag"].ToString() == "2") { dr["分析单状态"] = "待交接"; } else if (dr["fxflag"].ToString() == "3") { dr["分析单状态"] = "交接完成"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
private void Query() { //strSelectedId=txt_samplequery.Text; string strSample = ""; string strDate = ""; if (txt_samplequery.Text != "") { strSample = "and ReportName like'%" + txt_samplequery.Text + "%'"; } if (txt_QueryTime.Text != "") { strDate = " and (year(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string strSql = "select t_Y_FlowInfo.id,t_Y_FlowInfo.ReportAccessDate 时间,t_Y_FlowInfo.ItemType,ItemName 项目类型,ReportName 报告标识,urgent 备注,t_Y_FlowInfo.Ulevel,Projectname 项目名称,t_R_UserInfo.Name 项目负责人,rwclass,jcmethod,address,lxman,lxtel,lxemail,wtdepart from t_Y_FlowInfo,t_M_ItemInfo,t_R_UserInfo where t_Y_FlowInfo.ItemType=t_M_ItemInfo.ItemID and (StatusID='0') and wetherscance=0 and chargeman=t_R_UserInfo.UserID " + strSample + strDate + " order by t_Y_FlowInfo.id"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); DataColumn dc = new DataColumn("监测方式"); ds.Tables[0].Columns.Add(dc); DataColumn dc0 = new DataColumn("任务类型"); ds.Tables[0].Columns.Add(dc0); DataColumn dc1 = new DataColumn("委托单位"); ds.Tables[0].Columns.Add(dc1); DAl.Sample getobj = new DAl.Sample(); DataTable dtmode = getobj.GetMode("", "mode", ""); DAl.Station get = new DAl.Station(); DataTable dtstation = get.GetStationByName(""); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } if (dr["rwclass"].ToString() == "1") { dr["任务类型"] = "委托监测"; } else { dr["任务类型"] = "例行监测"; } DataRow[] drsel = dtmode.Select("code='" + dr["jcmethod"].ToString() + "'"); if (drsel.Length == 1) { dr["监测方式"] = drsel[0]["name"].ToString(); } else { dr["监测方式"] = ""; } if (dr["wtdepart"].ToString().Trim() != "") { DataRow[] drdep = dtstation.Select("id=" + dr["wtdepart"].ToString().Trim() + ""); if (drdep.Length == 1) { dr["委托单位"] = drdep[0]["单位全称"].ToString(); } else { dr["委托单位"] = ""; } } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
protected void btn_query_Click(object sender, EventArgs e) { //strSelectedId=txt_samplequery.Text; string strSample = ""; //样品编号 string strDate = ""; //接样时间 string strStatus = ""; //样品状态 string strItem = ""; //项目类型 string strType = ""; //样品名称 string strClient = ""; //委托单位 string strAanlysisStatus = ""; //样品分析状态 string strUrgent = ""; //按紧急程度 if (Drop_Urgent.SelectedValue != "-1") { if (Drop_Urgent.SelectedValue == "1") { strUrgent = "and t_M_ReporInfo.Ulevel=1"; } else { strUrgent = "and (t_M_ReporInfo.Ulevel<>1 or t_M_ReporInfo.Ulevel is null)"; } } if (txt_samplequery.Text != "")//按样品编号 { strSample = "and t_M_SampleInfor.SampleID like'%" + txt_samplequery.Text + "%'"; } if (txt_QueryTime.Text.Trim() != "" && txt_QueryEndTime.Text.Trim() != "")//按采样时间 { DateTime start = DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00"); DateTime end = DateTime.Parse(txt_QueryEndTime.Text.Trim() + " 23:59:59"); strDate = " and t_M_SampleInfor.AccessDate between '" + start + "' and '" + end + "'"; //strDate = " and (year(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } if (txt_item.SelectedValue != "-1")// 按项目类型 { strItem = " and t_M_ReporInfo.ItemType='" + txt_item.SelectedValue + "' "; } if (txt_type.SelectedValue != "-1")//按样品类型 { strType = " and t_M_SampleInfor.TypeID='" + txt_type.SelectedValue + "' "; } if (drop_client.SelectedValue != "-1")//按委托单位 { strClient = " and t_M_ReporInfo.ClientID='" + drop_client.SelectedValue + "' "; } ////按选中的分析项目查询 string strtitle = ""; string cstr = ""; if (cstr == "") { cstr = " and 1=1"; } cstr = strUrgent + strSample + strDate + strStatus + strItem + strType + strClient + strAanlysisStatus + strtitle; string strSql = "SELECT t_M_SampleInfor.SampleID AS 样品编号, t_M_ReporInfo.projectname 项目名称,t_M_SampleInfor.SampleDate AS 采样时间,t_M_SampleInfor.SampleProperty 样品性状,t_M_SampleInfor.SampleAddress 采样点 ," + "t_M_AnalysisMainClassEx.ClassName AS 样品类型, " + " t_M_SampleInfor.xcflag,t_M_SampleInfor.num 数量" + " FROM t_M_SampleInfor INNER JOIN" + " t_M_AnalysisMainClassEx ON " + " t_M_SampleInfor.TypeID = t_M_AnalysisMainClassEx.ClassID inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID " + " WHERE 1=1 " + cstr + " ORDER BY t_M_SampleInfor.SampleID"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dccc = new DataColumn("分析项目"); ds.Tables[0].Columns.Add(dccc); DataColumn dcc = new DataColumn("现场分析项目"); ds.Tables[0].Columns.Add(dcc); DataColumn dcc2 = new DataColumn("分析项目代码"); ds.Tables[0].Columns.Add(dcc2); string specialstr = "select * from t_SpecialItem"; DataSet ds_sitem = new MyDataOp(specialstr).CreateDataSet(); DataColumn dc = new DataColumn("标签打印项"); ds.Tables[0].Columns.Add(dc); foreach (DataRow dr in ds.Tables[0].Rows) { string getitemstr = "select AIName,AICode,MonitorItem,xcflag from t_MonitorItemDetail inner join t_M_ANItemInf on t_M_ANItemInf.id=t_MonitorItemDetail.MonitorItem where SampleID='" + dr["样品编号"].ToString() + "' and MonitorItem not in(select itemid from t_SpecialItem) and delflag=0 and xcflag=0"; DataSet dsitem = new MyDataOp(getitemstr).CreateDataSet(); if (dsitem != null && dsitem.Tables.Count > 0) { int num = 0; foreach (DataRow drr in dsitem.Tables[0].Rows) { dr["分析项目"] += drr[0].ToString() + ","; num++; if (num % 12 != 0) { if (drr[1].ToString() != "") { dr["分析项目代码"] += drr[1].ToString() + ","; } else { dr["分析项目代码"] += drr[0].ToString() + ","; } } else if (drr[1].ToString() != "") { dr["分析项目代码"] += drr[1].ToString() + ";"; } else { dr["分析项目代码"] += drr[0].ToString() + ";"; } } string temp = dr["分析项目代码"].ToString(); if (temp != "") { temp = temp.Substring(0, temp.Length - 1); dr["分析项目代码"] = temp.ToString(); } } string itemstr = "select AIName,AICode,MonitorItem,relatedItem,xcflag from t_MonitorItemDetail inner join t_M_ANItemInf on t_M_ANItemInf.id=t_MonitorItemDetail.MonitorItem inner join t_SpecialItem on t_SpecialItem.itemid=t_MonitorItemDetail.MonitorItem where SampleID='" + dr["样品编号"].ToString() + "' and delflag=0 and xcflag=0"; DataSet dssitem = new MyDataOp(itemstr).CreateDataSet(); string delindex = ""; if (dssitem != null && dssitem.Tables.Count > 0) { int i = 0; foreach (DataRow drr in dssitem.Tables[0].Rows) { if (dr["数量"].ToString() != "1") { if (drr[4].ToString() != "100") { dr["分析项目"] += drr[0].ToString() + ","; if (drr[1].ToString() != "") { dr["分析项目代码"] += ";" + drr[1].ToString(); } else { dr["分析项目代码"] += ";" + drr[0].ToString(); } if (drr["relatedItem"].ToString() != "") { string[] relatedItemlist = drr["relatedItem"].ToString().Split(',', ','); for (int l = 0; l < relatedItemlist.Length; l++) { if (relatedItemlist[l].ToString() != "") { DataRow[] drsecond = dssitem.Tables[0].Select("MonitorItem= '" + relatedItemlist[l] + "'"); if (drsecond.Length > 0) { drsecond[0]["xcflag"] = "100"; dr["分析项目"] += drsecond[0][0].ToString() + ","; if (drsecond[0][1].ToString() != "") { dr["分析项目代码"] += "," + drsecond[0][1].ToString(); } else { dr["分析项目代码"] += "," + drsecond[0][0].ToString(); } } } } } } i++; } else { //if (drr[4].ToString() != "100") // { dr["分析项目"] += drr[0].ToString() + ","; if (drr[1].ToString() != "") { dr["分析项目代码"] += "," + drr[1].ToString(); } else { dr["分析项目代码"] += "," + drr[0].ToString(); } } } } dr["标签打印项"] = dr["分析项目代码"].ToString() + delindex; } ds_dayin = ds.Copy(); DataRow[] drsele = ds_dayin.Tables[0].Select("数量<>1"); foreach (DataRow dr in drsele) { //int n = int.Parse(dr["数量"].ToString()); //int num = n; string[] list = dr["标签打印项"].ToString().Split(';'); //if (n > list.Length) // num = n; dr["标签打印项"] = list[0]; for (int i = 1; i < list.Length; i++) { DataRow drnew = ds_dayin.Tables[0].NewRow(); foreach (DataColumn dcname in ds_dayin.Tables[0].Columns) { drnew[dcname.ColumnName] = dr[dcname.ColumnName]; if (dcname.ColumnName == "标签打印项") { if (i < list.Length) { drnew[dcname.ColumnName] = list[i]; } } } ds_dayin.Tables[0].Rows.Add(drnew); } } ds_dayin.AcceptChanges(); grv_dayin.Visible = true; if (ds_dayin.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds_dayin.Tables[0].Rows.Add(ds_dayin.Tables[0].NewRow()); grv_dayin.DataSource = ds_dayin; grv_dayin.DataBind(); int intColumnCount = grv_dayin.Rows[0].Cells.Count; grv_dayin.Rows[0].Cells.Clear(); grv_dayin.Rows[0].Cells.Add(new TableCell()); grv_dayin.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grv_dayin.Visible = true; DataView dv = new DataView(); dv.Table = ds_dayin.Tables[0]; dv.Sort = "样品编号"; grv_dayin.DataSource = dv; grv_dayin.DataBind(); } ds.Dispose(); }
protected void btn_query_Click(object sender, EventArgs e) { //strSelectedId=txt_samplequery.Text; string strSample = ""; //样品编号 string strDate = ""; //接样时间 string strStatus = ""; //样品状态 string strItem = ""; //项目类型 string strType = ""; //样品名称 string strClient = ""; //委托单位 string strAnalysis = ""; // 分析项目; string strAanlysisStatus = ""; //样品分析状态 string strUrgent = ""; //按紧急程度 if (Drop_Urgent.SelectedValue != "-1") { if (Drop_Urgent.SelectedValue == "1") { strUrgent = "and t_M_ReporInfo.Ulevel=1"; } else { strUrgent = "and (t_M_ReporInfo.Ulevel<>1 or t_M_ReporInfo.Ulevel is null)"; } } //样品原标识 if (txt_pfk_query.Text.Trim() != "") { strSample += "and t_M_SampleInfor.SampleAddress like'%" + txt_pfk_query.Text + "%'"; } //报告标识 if (txt_WTNO_query.Text.Trim() != "") { strSample += "and t_M_ReporInfo.ReportName like'%" + txt_WTNO_query.Text + "%'"; } //样品来源 if (txt_source_query.Text.Trim() != "") { strSample += "and t_M_SampleInfor.SampleSource like'%" + txt_source_query.Text + "%'"; } if (txt_samplequery.Text != "")//按样品编号 { strSample += "and t_M_SampleInfor.SampleID like'%" + txt_samplequery.Text + "%'"; } if (txt_QueryTime.Text.Trim() != "" && txt_QueryEndTime.Text.Trim() != "")//按采样时间 { DateTime start = DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00"); DateTime end = DateTime.Parse(txt_QueryEndTime.Text.Trim() + " 23:59:59"); strDate = " and AccessDate between '" + start + "' and '" + end + "'"; //strDate = " and (year(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } //if(drop_status.SelectedValue!="-1")//按样品状态 //{ // strStatus = " and t_M_ReporInfo.StatusID='" + drop_status.SelectedValue + "' "; //} if (txt_item.SelectedValue != "-1")// 按项目类型 { strItem = " and t_M_ReporInfo.ItemType='" + txt_item.SelectedValue + "' "; } int i = 0; foreach (ListItem li in cbl_type.Items) { if (li.Selected) { if (i != 0) { strType += " or "; } strType += " t_M_SampleInfor.TypeID='" + li.Value.ToString().Trim() + "' "; i++; } } if (strType != "") { strType = " and (" + strType + ")"; } //if (txt_type.SelectedValue != "-1")//按样品类型 //{ // strType = " and t_M_SampleInfor.TypeID='" + txt_type.SelectedValue + "' "; //} if (drop_client.SelectedValue != "-1")//按委托单位 { strClient = " and t_M_ReporInfo.ClientID='" + drop_client.SelectedValue + "' "; } //bool flag=false; //int i = 0; ////按选中的分析项目查询 string strtitle = ""; string cstr = ""; if (cstr == "") { cstr = " and 1=1"; } cstr = strUrgent + strSample + strDate + strStatus + strItem + strType + strClient + strAanlysisStatus + strtitle; string strSql = "SELECT t_M_SampleInfor.id, t_M_ReporInfo.ReportName 报告标识,t_M_ReporInfo.projectname 项目名称,CONVERT(varchar,t_M_SampleInfor.AccessDate,23) AS 送样时间,t_M_SampleInfor.SampleSource 样品来源,t_M_SampleInfor.SampleAddress 样品原标识,t_M_SampleInfor.SampleID AS 样品编号,t_M_SampleInfor.SampleProperty 样品性状,SourceBs 监测项目,t_M_SampleInfor.num 数量, CONVERT(varchar,t_M_SampleInfor.SampleDate,23) AS 采样日期,t_R_UserInfo.Name 收样人" + " FROM t_M_SampleInfor INNER JOIN" + " t_R_UserInfo ON " + " t_R_UserInfo.UserID = t_M_SampleInfor.UserID inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID " + " WHERE 1=1 " + cstr + " ORDER BY t_M_SampleInfor.AccessDate"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); //DataColumn dccc = new DataColumn("分析项目"); //ds.Tables[0].Columns.Add(dccc); DataColumn dcc2 = new DataColumn("监测后样品处理情况"); ds.Tables[0].Columns.Add(dcc2); foreach (DataRow dr in ds.Tables[0].Rows) { string getitemstr = "select AIName,AICode,MonitorItem,xcflag from t_MonitorItemDetail inner join t_M_ANItemInf on t_M_ANItemInf.id=t_MonitorItemDetail.MonitorItem where SampleID='" + dr["id"].ToString() + "' and delflag=0"; DataSet dsitem = new MyDataOp(getitemstr).CreateDataSet(); if (dsitem != null && dsitem.Tables.Count > 0) { foreach (DataRow drr in dsitem.Tables[0].Rows) { dr["监测项目"] += drr[0].ToString() + ","; } } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }