/// <summary> /// 对象编辑 /// </summary> /// <param name="tMisContractPointFreq_UpdateSet">UpdateSet用户对象</param> /// <param name="tMisContractPointFreq_UpdateWhere">UpdateWhere用户对象</param> /// <returns>是否成功</returns> public bool Edit(TMisContractPointFreqVo tMisContractPointFreq_UpdateSet, TMisContractPointFreqVo tMisContractPointFreq_UpdateWhere) { string strSQL = SqlHelper.BuildUpdateExpress(tMisContractPointFreq_UpdateSet, TMisContractPointFreqVo.T_MIS_CONTRACT_POINT_FREQ_TABLE); strSQL += this.BuildWhereStatement(tMisContractPointFreq_UpdateWhere); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 插入委托书监测点位频次信息 /// </summary> /// <param name="dt"></param> /// <param name="dtDict"></param> /// <param name="task_id"></param> /// <returns></returns> public bool CreatePlanPoint(DataTable dt, DataTable dtDict, string task_id) { TMisContractPointFreqVo tMisContractPointFreq = new TMisContractPointFreqVo(); int IntFreq = 0; ArrayList arrVo = new ArrayList(); foreach (DataRow drr in dt.Rows) { if (!String.IsNullOrEmpty(drr["FREQ"].ToString())) { IntFreq = Convert.ToInt32(drr["FREQ"].ToString().ToString()); } else { IntFreq = 1; } if (IntFreq > 0) { for (int i = 0; i < IntFreq; i++) { tMisContractPointFreq.ID = GetSerialNumber("t_mis_contractplanfreqID"); tMisContractPointFreq.CONTRACT_ID = task_id; tMisContractPointFreq.FREQ = drr["FREQ"].ToString(); //tMisContractPointFreq.FREQ = (i + 1).ToString(); tMisContractPointFreq.CONTRACT_POINT_ID = drr["ID"].ToString(); tMisContractPointFreq.NUM = (i + 1).ToString(); tMisContractPointFreq.IF_PLAN = "0"; tMisContractPointFreq.SAMPLENUM = drr["SAMPLENUM"].ToString(); string strSQL = String.Format("INSERT INTO T_MIS_CONTRACT_POINT_FREQ(ID,CONTRACT_ID,CONTRACT_POINT_ID,FREQ,NUM,IF_PLAN,SAMPLENUM) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", tMisContractPointFreq.ID, tMisContractPointFreq.CONTRACT_ID, tMisContractPointFreq.CONTRACT_POINT_ID, tMisContractPointFreq.FREQ, tMisContractPointFreq.NUM, tMisContractPointFreq.IF_PLAN, tMisContractPointFreq.SAMPLENUM); arrVo.Add(strSQL); } } } return(SqlHelper.ExecuteSQLByTransaction(arrVo)); }
/// <summary> /// 获取委托书下当前委托计划下监测点位的监测类别 Create By Castle (胡方扬) 2013-04-01 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable GetPointMonitorInforForPlan(TMisContractPointFreqVo tMisContractPointFreq, string strPlanId) { string strSQL = String.Format("SELECT DISTINCT (C.ID),C.MONITOR_TYPE_NAME FROM dbo.T_MIS_CONTRACT_POINT_FREQ A" + " INNER JOIN dbo.T_MIS_CONTRACT_POINT B ON A.CONTRACT_POINT_ID=B.ID" + " INNER JOIN dbo.T_BASE_MONITOR_TYPE_INFO C ON C.ID=B.MONITOR_ID "); if (!String.IsNullOrEmpty(strPlanId)) { strSQL += String.Format(" INNER JOIN dbo.T_MIS_CONTRACT_PLAN_POINT D ON D.POINT_FREQ_ID=A.ID"); } strSQL += String.Format(" WHERE 1=1"); if (!String.IsNullOrEmpty(tMisContractPointFreq.CONTRACT_ID)) { strSQL += String.Format(" AND A.CONTRACT_ID ='{0}'", tMisContractPointFreq.CONTRACT_ID); } if (!String.IsNullOrEmpty(tMisContractPointFreq.IF_PLAN)) { strSQL += String.Format(" AND A.IF_PLAN='{0}'", tMisContractPointFreq.IF_PLAN); } if (!String.IsNullOrEmpty(strPlanId)) { strSQL += String.Format(" AND D.PLAN_ID='{0}'", strPlanId); } return(SqlHelper.ExecuteDataTable(strSQL)); }
/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tMisContractPointFreq">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TMisContractPointFreqVo tMisContractPointFreq, int iIndex, int iCount) { string strSQL = " select * from T_MIS_CONTRACT_POINT_FREQ {0} "; strSQL = String.Format(strSQL, BuildWhereStatement(tMisContractPointFreq)); return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tMisContractPointFreq">用户对象</param> /// <returns>是否成功</returns> public bool Edit(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = SqlHelper.BuildUpdateExpress(tMisContractPointFreq, TMisContractPointFreqVo.T_MIS_CONTRACT_POINT_FREQ_TABLE); strSQL += string.Format(" where ID='{0}' ", tMisContractPointFreq.ID); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 对象删除 /// </summary> /// <param name="Id">ID</param> /// <returns>是否成功</returns> public bool Delete(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = "delete from T_MIS_CONTRACT_POINT_FREQ "; strSQL += this.BuildWhereStatement(tMisContractPointFreq); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 获取委托书下下有监测点位的所有监测类别 Create By Castle (胡方扬) 2012-12-21 /// </summary> /// <returns></returns> private string GetPointMonitorInfor() { DataTable dt = new DataTable(); TMisContractPointFreqVo objItems = new TMisContractPointFreqVo(); objItems.CONTRACT_ID = Request.QueryString["task_id"].ToString(); dt = new TMisContractPointFreqLogic().GetPointMonitorInforForPlan(objItems, Request.QueryString["strPlanId"].ToString()); return(PageBase.LigerGridDataToJson(dt, dt.Rows.Count)); }
/// <summary> /// 获取当前即将进行的委托书监测点位频次信息 清远需求 胡方扬 2013-03-13 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable GetPointInforForFreq(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = String.Format(@"SELECT * FROM (SELECT A.ID,A.CONTRACT_ID,A.CONTRACT_POINT_ID,A.FREQ, A.NUM FROM dbo.T_MIS_CONTRACT_POINT_FREQ A WHERE A.CONTRACT_ID='{0}' AND A.IF_PLAN='0' AND A.NUM IN (SELECT MIN(CONVERT(INT,B.NUM)) FROM T_MIS_CONTRACT_POINT_FREQ B WHERE B.CONTRACT_ID='{1}' AND B.IF_PLAN='0')) T INNER JOIN dbo.T_MIS_CONTRACT_POINT B ON T.CONTRACT_POINT_ID=B.ID INNER JOIN dbo.T_BASE_MONITOR_TYPE_INFO C ON C.ID=B.MONITOR_ID WHERE 1=1", tMisContractPointFreq.CONTRACT_ID, tMisContractPointFreq.CONTRACT_ID); return(SqlHelper.ExecuteDataTable(strSQL)); }
/// <summary> /// 获取委托书监测点位频次信息 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable GetPointInfor(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = String.Format("SELECT * FROM dbo.T_MIS_CONTRACT_POINT_FREQ A " + " INNER JOIN dbo.T_MIS_CONTRACT_POINT B ON A.CONTRACT_POINT_ID=B.ID" + " INNER JOIN dbo.T_BASE_MONITOR_TYPE_INFO C ON C.ID=B.MONITOR_ID WHERE 1=1"); if (!String.IsNullOrEmpty(tMisContractPointFreq.CONTRACT_ID)) { strSQL += String.Format(" AND A.CONTRACT_ID ='{0}'", tMisContractPointFreq.CONTRACT_ID); } if (!String.IsNullOrEmpty(tMisContractPointFreq.IF_PLAN)) { strSQL += String.Format(" AND A.IF_PLAN='{0}'", tMisContractPointFreq.IF_PLAN); } strSQL += " ORDER BY B.MONITOR_ID,B.NUM,A.NUM"; return(SqlHelper.ExecuteDataTable(strSQL)); }
/// <summary> /// 快捷方式生成委托书信息 插入委托书监测点位频次信息 /// </summary> /// <param name="dt"></param> /// <param name="dtDict"></param> /// <param name="task_id"></param> /// <returns></returns> public bool CreatePlanPointQuck(DataTable dt, string task_id) { TMisContractPointFreqVo tMisContractPointFreq = new TMisContractPointFreqVo(); ArrayList arrVo = new ArrayList(); for (int i = 0; i < dt.Rows.Count; i++) { tMisContractPointFreq.ID = GetSerialNumber("t_mis_contractplanfreqID"); tMisContractPointFreq.CONTRACT_ID = task_id; tMisContractPointFreq.FREQ = "1"; tMisContractPointFreq.CONTRACT_POINT_ID = dt.Rows[i]["ID"].ToString(); tMisContractPointFreq.NUM = "1"; tMisContractPointFreq.IF_PLAN = "0"; string strSQL = String.Format("INSERT INTO T_MIS_CONTRACT_POINT_FREQ(ID,CONTRACT_ID,CONTRACT_POINT_ID,FREQ,NUM,IF_PLAN) VALUES('{0}','{1}','{2}','{3}','{4}','{5}')", tMisContractPointFreq.ID, tMisContractPointFreq.CONTRACT_ID, tMisContractPointFreq.CONTRACT_POINT_ID, tMisContractPointFreq.FREQ, tMisContractPointFreq.NUM, tMisContractPointFreq.IF_PLAN); arrVo.Add(strSQL); } return(SqlHelper.ExecuteSQLByTransaction(arrVo)); }
public int SelectContractPlanInforCount(TMisContractPointFreqVo tMisContractPointFreq, TMisContractVo tMisContract, TMisContractCompanyVo tMisContractCompany) { string strSQL = String.Format("SELECT A.*,E.COMPANY_NAME,F.DICT_TEXT AS AREA FROM dbo.T_MIS_CONTRACT A " + " INNER JOIN " + " (SELECT * FROM (SELECT DISTINCT (B.CONTRACT_ID) FROM dbo.T_MIS_CONTRACT_POINT_FREQ B WHERE IF_PLAN='{0}')T) D" + " ON D.CONTRACT_ID=A.ID" + " LEFT JOIN T_MIS_CONTRACT_COMPANY E ON E.ID=A.TESTED_COMPANY_ID" + " LEFT JOIN dbo.T_SYS_DICT F ON F.DICT_TYPE='administrative_area' AND F.DICT_CODE=E.AREA WHERE 1=1 ", tMisContractPointFreq.IF_PLAN); if (!String.IsNullOrEmpty(tMisContract.CONTRACT_TYPE)) { strSQL += String.Format(" AND A.CONTRACT_TYPE = '{0}'", tMisContract.CONTRACT_TYPE); } if (!String.IsNullOrEmpty(tMisContract.CONTRACT_CODE)) { strSQL += String.Format(" AND A.CONTRACT_CODE LIKE '%{0}%'", tMisContract.CONTRACT_CODE); } if (!String.IsNullOrEmpty(tMisContract.TEST_TYPES)) { strSQL += String.Format(" AND A.TEST_TYPES LIKE '%{0}%'", tMisContract.TEST_TYPES); } if (!String.IsNullOrEmpty(tMisContractCompany.COMPANY_NAME)) { strSQL += String.Format(" AND E.COMPANY_NAME LIKE '%{0}%'", tMisContractCompany.COMPANY_NAME); } if (!String.IsNullOrEmpty(tMisContractCompany.AREA)) { strSQL += String.Format(" AND E.AREA = '{0}'", tMisContractCompany.AREA); } if (!String.IsNullOrEmpty(tMisContract.CONTRACT_STATUS)) { strSQL += String.Format(" AND A.CONTRACT_STATUS = '{0}'", tMisContract.CONTRACT_STATUS); } return(SqlHelper.ExecuteDataTable(strSQL).Rows.Count); }
/// <summary> /// 对象明细 /// </summary> /// <param name="tMisContractPointFreq">对象条件</param> /// <returns>对象</returns> public TMisContractPointFreqVo Details(TMisContractPointFreqVo tMisContractPointFreq) { return(access.Details(tMisContractPointFreq)); }
/// <summary> /// 保存默认监测计划岗位负责人 Create By Castle (胡方扬) 2013-4-1 /// </summary> /// <returns></returns> public static void SavePlanPeopleForEnv(string strPlanId) { DataTable dtMonitor = new DataTable(); TMisContractPointFreqVo objItemspan = new TMisContractPointFreqVo(); objItemspan.IF_PLAN = "0"; dtMonitor = new TMisContractPointFreqLogic().GetPointMonitorInforForPlan(objItemspan, strPlanId); //DataTable dtMonitor = GetPointMonitorInfor(strPlanId); DataTable dtTemple = new DataTable(); TSysDutyVo objItemspan1 = new TSysDutyVo(); objItemspan1.DICT_CODE = "duty_sampling"; dtTemple = new TSysDutyLogic().SelectTableDutyUser(objItemspan1); //DataTable dtTemple = GetMonitorDutyInforTable(); DataTable dtMonitorDutyUser = new DataTable(); dtMonitorDutyUser = dtTemple.Copy(); dtMonitorDutyUser.Clear(); //获取默认负责人 for (int n = 0; n < dtMonitor.Rows.Count; n++) { DataRow[] drowArr = dtTemple.Select(" IF_DEFAULT='0' AND MONITOR_TYPE_ID='" + dtMonitor.Rows[0]["ID"].ToString() + "'"); if (drowArr.Length > 0) { foreach (DataRow drow in drowArr) { dtMonitorDutyUser.ImportRow(drow); } dtMonitorDutyUser.AcceptChanges(); } else { drowArr = dtTemple.Select(" MONITOR_TYPE_ID='" + dtMonitor.Rows[0]["ID"].ToString() + "'"); if (drowArr.Length > 0) { dtMonitorDutyUser.ImportRow(drowArr[0]); } dtMonitorDutyUser.AcceptChanges(); } } //if (drowArr.Length > 0) //{ // foreach (DataRow drow in drowArr) // { // dtMonitorDutyUser.ImportRow(drow); // } // dtMonitorDutyUser.AcceptChanges(); //} string strMonitorId = "", strUserId = ""; foreach (DataRow drr in dtMonitor.Rows) { for (int i = 0; i < dtMonitorDutyUser.Rows.Count; i++) { if (drr["ID"].ToString() == dtMonitorDutyUser.Rows[i]["MONITOR_TYPE_ID"].ToString()) { strMonitorId += drr["ID"].ToString() + ";"; strUserId += dtMonitorDutyUser.Rows[i]["USERID"].ToString() + ";"; } } } TMisContractUserdutyVo objItems = new TMisContractUserdutyVo(); if (!String.IsNullOrEmpty(strPlanId)) { objItems.CONTRACT_PLAN_ID = strPlanId; string[] strMonitArr = null, strUserArr = null; if (!String.IsNullOrEmpty(strMonitorId) && !String.IsNullOrEmpty(strUserId)) { strMonitArr = strMonitorId.Substring(0, strMonitorId.Length - 1).Split(';'); strUserArr = strUserId.Substring(0, strUserId.Length - 1).Split(';'); if (strMonitArr != null && strUserArr != null) { new TMisContractUserdutyLogic().SaveContractPlanDutyForEnv(objItems, strMonitArr, strUserArr); } } } }
public int SelectContractPlanInforCount(TMisContractPointFreqVo tMisContractPointFreq, TMisContractVo tMisContract, TMisContractCompanyVo tMisContractCompany) { return(access.SelectContractPlanInforCount(tMisContractPointFreq, tMisContract, tMisContractCompany)); }
/// <summary> /// 根据对象构造条件语句 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public string BuildWhereStatement(TMisContractPointFreqVo tMisContractPointFreq) { StringBuilder strWhereStatement = new StringBuilder(" Where 1=1 "); if (null != tMisContractPointFreq) { //ID if (!String.IsNullOrEmpty(tMisContractPointFreq.ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND ID = '{0}'", tMisContractPointFreq.ID.ToString())); } //委托书ID if (!String.IsNullOrEmpty(tMisContractPointFreq.CONTRACT_ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND CONTRACT_ID = '{0}'", tMisContractPointFreq.CONTRACT_ID.ToString())); } //委托书监测点位ID if (!String.IsNullOrEmpty(tMisContractPointFreq.CONTRACT_POINT_ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND CONTRACT_POINT_ID = '{0}'", tMisContractPointFreq.CONTRACT_POINT_ID.ToString())); } //采样频次 if (!String.IsNullOrEmpty(tMisContractPointFreq.SAMPLE_FREQ.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND SAMPLE_FREQ = '{0}'", tMisContractPointFreq.SAMPLE_FREQ.ToString())); } //监测频次 if (!String.IsNullOrEmpty(tMisContractPointFreq.FREQ.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND FREQ = '{0}'", tMisContractPointFreq.FREQ.ToString())); } //执行序号 if (!String.IsNullOrEmpty(tMisContractPointFreq.NUM.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND NUM = '{0}'", tMisContractPointFreq.NUM.ToString())); } //是否已预约 if (!String.IsNullOrEmpty(tMisContractPointFreq.IF_PLAN.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND IF_PLAN = '{0}'", tMisContractPointFreq.IF_PLAN.ToString())); } //每次采样样品数 if (!String.IsNullOrEmpty(tMisContractPointFreq.SAMPLENUM.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND SAMPLENUM = '{0}'", tMisContractPointFreq.SAMPLENUM.ToString())); } //备注1 if (!String.IsNullOrEmpty(tMisContractPointFreq.REMARK1.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK1 = '{0}'", tMisContractPointFreq.REMARK1.ToString())); } //备注2 if (!String.IsNullOrEmpty(tMisContractPointFreq.REMARK2.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK2 = '{0}'", tMisContractPointFreq.REMARK2.ToString())); } //备注3 if (!String.IsNullOrEmpty(tMisContractPointFreq.REMARK3.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK3 = '{0}'", tMisContractPointFreq.REMARK3.ToString())); } //备注4 if (!String.IsNullOrEmpty(tMisContractPointFreq.REMARK4.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK4 = '{0}'", tMisContractPointFreq.REMARK4.ToString())); } //备注5 if (!String.IsNullOrEmpty(tMisContractPointFreq.REMARK5.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK5 = '{0}'", tMisContractPointFreq.REMARK5.ToString())); } } return(strWhereStatement.ToString()); }
public TMisContractPointFreqLogic(TMisContractPointFreqVo _tMisContractPointFreq) { tMisContractPointFreq = _tMisContractPointFreq; access = new TMisContractPointFreqAccess(); }
/// <summary> /// 获取委托书下当前委托计划下监测点位的监测类别 Create By Castle (胡方扬) 2013-04-01 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable GetPointMonitorInforForPlan(TMisContractPointFreqVo tMisContractPointFreq, string strPlanId) { return(access.GetPointMonitorInforForPlan(tMisContractPointFreq, strPlanId)); }
/// <summary> /// 对象添加 /// </summary> /// <param name="tMisContractPointFreq">对象</param> /// <returns>是否成功</returns> public bool Create(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = SqlHelper.BuildInsertExpress(tMisContractPointFreq, TMisContractPointFreqVo.T_MIS_CONTRACT_POINT_FREQ_TABLE); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 根据对象获取全部数据,用Table承载 /// 数据量较小时使用【不推荐】 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable SelectByTable(TMisContractPointFreqVo tMisContractPointFreq) { return(access.SelectByTable(tMisContractPointFreq)); }
/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tMisContractPointFreq">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TMisContractPointFreqVo tMisContractPointFreq, int iIndex, int iCount) { return(access.SelectByTable(tMisContractPointFreq, iIndex, iCount)); }
/// <summary> /// 获取对象List /// </summary> /// <param name="tMisContractPointFreq">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public List <TMisContractPointFreqVo> SelectByObject(TMisContractPointFreqVo tMisContractPointFreq, int iIndex, int iCount) { return(access.SelectByObject(tMisContractPointFreq, iIndex, iCount)); }
/// <summary> /// 对象明细 /// </summary> /// <param name="tMisContractPointFreq">对象条件</param> /// <returns>对象</returns> public TMisContractPointFreqVo Details(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = String.Format("select * from T_MIS_CONTRACT_POINT_FREQ " + this.BuildWhereStatement(tMisContractPointFreq)); return(SqlHelper.ExecuteObject(new TMisContractPointFreqVo(), strSQL)); }
/// <summary> /// 获取当前即将进行的委托书监测点位频次信息 清远需求 胡方扬 2013-03-13 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable GetPointInforForFreq(TMisContractPointFreqVo tMisContractPointFreq) { return(access.GetPointInforForFreq(tMisContractPointFreq)); }
public DataTable SelectContractPlanInfor(TMisContractPointFreqVo tMisContractPointFreq, TMisContractVo tMisContract, TMisContractCompanyVo tMisContractCompany, int iIndex, int iCount) { return(access.SelectContractPlanInfor(tMisContractPointFreq, tMisContract, tMisContractCompany, iIndex, iCount)); }
/// <summary> /// 获取对象List /// </summary> /// <param name="tMisContractPointFreq">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public List <TMisContractPointFreqVo> SelectByObject(TMisContractPointFreqVo tMisContractPointFreq, int iIndex, int iCount) { string strSQL = String.Format("select * from T_MIS_CONTRACT_POINT_FREQ " + this.BuildWhereStatement(tMisContractPointFreq)); return(SqlHelper.ExecuteObjectList(tMisContractPointFreq, BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 获取委托书已完成预约的监测点位频次信息 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable GetPlanFinishedPointInfor(TMisContractPointFreqVo tMisContractPointFreq) { return(access.GetPlanFinishedPointInfor(tMisContractPointFreq)); }
/// <summary> /// 根据对象获取全部数据,用Table承载 /// 数据量较小时使用【不推荐】 /// </summary> /// <param name="tMisContractPointFreq"></param> /// <returns></returns> public DataTable SelectByTable(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = "select * from T_MIS_CONTRACT_POINT_FREQ " + this.BuildWhereStatement(tMisContractPointFreq); return(SqlHelper.ExecuteDataTable(strSQL)); }
/// <summary> /// 获得查询结果总行数,用于分页 /// </summary> /// <param name="tMisContractPointFreq">对象</param> /// <returns>返回行数</returns> public int GetSelectResultCount(TMisContractPointFreqVo tMisContractPointFreq) { string strSQL = "select Count(*) from T_MIS_CONTRACT_POINT_FREQ " + this.BuildWhereStatement(tMisContractPointFreq); return(Convert.ToInt32(SqlHelper.ExecuteScalar(strSQL))); }
protected void btnExport_Click(object sender, EventArgs e) { FileStream file = null; if (strType == "QY") { file = new FileStream(HttpContext.Current.Server.MapPath("../Monitor/sampling/template/WorkTaskSheetQY.xls"), FileMode.Open, FileAccess.Read); } else if (strType == "ZZ") { file = new FileStream(HttpContext.Current.Server.MapPath("../Monitor/sampling/template/WorkTaskSheet.xls"), FileMode.Open, FileAccess.Read); } HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); string strTaskType = "", strMonitorList = "", Monitor = "", strWorkContent = ""; DataTable dt = GetPendingPlanDataTable(); //插入委托书单号 if (dt.Rows.Count > 0) { sheet.GetRow(4).GetCell(1).SetCellValue(dt.Rows[0]["TICKET_NUM"].ToString()); sheet.GetRow(4).GetCell(6).SetCellValue(dt.Rows[0]["REPORT_CODE"].ToString()); strTaskType = getDictName(dt.Rows[0]["CONTRACT_TYPE"].ToString(), "Contract_Type"); sheet.GetRow(5).GetCell(1).SetCellValue(strTaskType + "任务"); sheet.GetRow(5).GetCell(7).SetCellValue(dt.Rows[0]["CONTRACT_CODE"].ToString()); string[] strMonitroTypeArr = dt.Rows[0]["TEST_TYPE"].ToString().Split(';'); //string[] strMonitroTypeArr = dt.Rows[0]["TEST_TYPES"].ToString().Split(';'); //foreach (string str in strMonitroTypeArr) { // string strMonitor = ""; // strMonitor = GetMonitorName(str); // strMonitorList += (strMonitor == "水和废水" ? "废水" : (strMonitor == "气和废气" ? "废气" : strMonitor)) + "、"; //} // strMonitorList = strMonitorList.Substring(0, strMonitorList.Length - 1); TMisContractPointFreqVo objItems = new TMisContractPointFreqVo(); objItems.CONTRACT_ID = ""; DataTable dts = new TMisContractPointFreqLogic().GetPointMonitorInforForPlan(objItems, dt.Rows[0]["ID"].ToString()); if (dts.Rows.Count > 0) { strMonitorList = dts.Rows[0][1].ToString(); } sheet.GetRow(7).GetCell(1).SetCellValue(strMonitorList); if (dt.Rows[0]["SAMPLE_SOURCE"].ToString() == "送样") { //strWorkContent += "地表水、地下水(送样)\n"; int intLen = strMonitroTypeArr.Length; int INTSHOWLEN = 0; foreach (string strMonitor in strMonitroTypeArr) { INTSHOWLEN++; strWorkContent += GetMonitorName(strMonitor) + "、"; if (INTSHOWLEN == intLen - 1) { strWorkContent += "(送样)\n"; } } } //获取当前监测类别信息 DataTable dtMonitor = GetPendingPlanDistinctMonitorDataTable(); DataTable dtPoint = GetPendingPlanPointDataTable(); string strOutValuePoint = "", strOutValuePointItems = ""; int IS_SAMPLEDEPT = 0; //是否存在现场监测项目 int IS_CERTIFICATE = 0; //是否存在实验室监测项目 if (dtMonitor.Rows.Count > 0) { foreach (DataRow drr in dtMonitor.Rows) { string strMonitorName = "", strPointName = ""; DataRow[] drPoint = dtPoint.Select("MONITOR_ID='" + drr["MONITOR_ID"].ToString() + "'"); if (drPoint.Length > 0) { foreach (DataRow drrPoint in drPoint) { string strPointNameForItems = "", strPointItems = ""; strMonitorName = drrPoint["MONITOR_TYPE_NAME"].ToString() + ":"; strPointName += drrPoint["POINT_NAME"].ToString() + "、"; //获取当前点位的监测项目 DataTable dtPointItems = GetPendingPlanPointItemsDataTable(drrPoint["CONTRACT_POINT_ID"].ToString()); if (dtPointItems.Rows.Count > 0) { foreach (DataRow drItems in dtPointItems.Rows) { strPointNameForItems = strMonitorName.Substring(0, strMonitorName.Length - 1) + drrPoint["POINT_NAME"] + "(" + (drrPoint["SAMPLE_DAY"].ToString() == "" ? "1" : drrPoint["SAMPLE_DAY"].ToString()) + "天" + (drrPoint["SAMPLE_FREQ"].ToString() == "" ? "1" : drrPoint["SAMPLE_FREQ"].ToString()) + "次):"; strPointItems += drItems["ITEM_NAME"].ToString() + "、"; if (drItems["IS_SAMPLEDEPT"].ToString() == "是") { IS_SAMPLEDEPT = 1; } if (drItems["IS_SAMPLEDEPT"].ToString() == "否") { IS_CERTIFICATE = 1; } } strOutValuePointItems += strPointNameForItems + strPointItems.Substring(0, strPointItems.Length - 1) + ";\n"; } } //获取输出监测类型监测点位信息 strOutValuePoint += strMonitorName + strPointName.Substring(0, strPointName.Length - 1) + ";\n"; } } } strWorkContent += "监测点位:\n" + strOutValuePoint; strWorkContent += "监测因子与频次:\n" + strOutValuePointItems; sheet.GetRow(9).GetCell(1).SetCellValue(strWorkContent); string strLinkPerple = ""; //if (dt.Rows[0]["CONTRACT_TYPE"].ToString() == "02" || dt.Rows[0]["CONTRACT_TYPE"].ToString() == "03")//应急或者管理类的 strMonitorList if (strMonitorList == "02" || strMonitorList == "03")//应急或者管理类的 strMonitorList { strLinkPerple += "联系人:" + dt.Rows[0]["CONTACT_NAME"].ToString() + " \n"; strLinkPerple += "联系电话:" + dt.Rows[0]["PHONE"].ToString() + "\n"; strLinkPerple += "报告编写人:韩永博 \n"; } else { #region//暂不用代码 //string[] strMonitroType = dt.Rows[0]["TEST_TYPE"].ToString().Split(';'); //foreach (string strs in strMonitroType) //{ // string strMonitors = ""; // strMonitors = GetMonitorName(strs); // if (strMonitors == "水和废水") // { // Monitor = "水"; // } // else if (strMonitors == "气和废气") // { // Monitor = "气"; // } // else if (strMonitors == "固废和土壤") // { // Monitor = "固体"; // } // else if (strMonitors.Contains("噪声")) // { // Monitor = "噪声"; // } // Monitor = Monitor + "、"; //} //Monitor = Monitor.Substring(0, Monitor.Length - 1); #endregion if (strMonitorList == "水" || strMonitorList == "固体") { strLinkPerple += "联系人:" + dt.Rows[0]["CONTACT_NAME"].ToString() + " \n"; strLinkPerple += "联系电话:" + dt.Rows[0]["PHONE"].ToString() + "\n"; strLinkPerple += "报告编写人:韩永博 \n"; } else if (strMonitorList == "气" || strMonitorList == "噪声") { strLinkPerple += "联系人:" + dt.Rows[0]["CONTACT_NAME"].ToString() + " \n"; strLinkPerple += "联系电话:" + dt.Rows[0]["PHONE"].ToString() + "\n"; strLinkPerple += "报告编写人:马振芳\n"; } else if (strMonitorList == "水、气、声、固体") { strLinkPerple += "联系人:" + dt.Rows[0]["CONTACT_NAME"].ToString() + " \n"; strLinkPerple += "联系电话:" + dt.Rows[0]["PHONE"].ToString() + "\n"; strLinkPerple += "报告编写人:王志远\n"; } } //strLinkPerple += "联系人:" + dt.Rows[0]["CONTACT_NAME"].ToString() + "\n"; //strLinkPerple += "联系电话:" + dt.Rows[0]["PHONE"].ToString() + "\n"; //if (!String.IsNullOrEmpty(dt.Rows[0]["PROJECT_ID"].ToString())) //{ // strLinkPerple += "项目负责人:" + GetUserName(dt.Rows[0]["PROJECT_ID"].ToString()); //} //else //{ // strLinkPerple += "报告编写:"; //} sheet.GetRow(10).GetCell(1).SetCellValue(strLinkPerple); //任务来源 sheet.GetRow(6).GetCell(1).SetCellValue(dt.Rows[0]["COMPANY_NAME"].ToString()); //接收科室 string strJSKS = ""; strJSKS += "现场室、"; //if (IS_SAMPLEDEPT == 1) //{ // strJSKS += "现场室、"; //} if (IS_CERTIFICATE == 1) { strJSKS += "实验室、"; } sheet.GetRow(8).GetCell(1).SetCellValue(strJSKS.TrimEnd('、')); if (!String.IsNullOrEmpty(dt.Rows[0]["ASKING_DATE"].ToString())) { sheet.GetRow(11).GetCell(1).SetCellValue(DateTime.Parse(dt.Rows[0]["ASKING_DATE"].ToString()).ToString("yyyy-MM-dd")); } //sheet.GetRow(11).GetCell(3).SetCellValue(LogInfo.UserInfo.REAL_NAME); sheet.GetRow(11).GetCell(6).SetCellValue(DateTime.Now.ToString("yyyy-MM-dd")); } using (MemoryStream stream = new MemoryStream()) { hssfworkbook.Write(stream); HttpContext curContext = HttpContext.Current; // 设置编码和附件格式 curContext.Response.ContentType = "application/vnd.ms-excel"; curContext.Response.ContentEncoding = Encoding.UTF8; curContext.Response.Charset = ""; curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("工作任务通知单-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls", Encoding.UTF8)); curContext.Response.BinaryWrite(stream.GetBuffer()); curContext.Response.End(); } }
/// <summary> /// 获得查询结果总行数,用于分页 /// </summary> /// <param name="tMisContractPointFreq">对象</param> /// <returns>返回行数</returns> public int GetSelectResultCount(TMisContractPointFreqVo tMisContractPointFreq) { return(access.GetSelectResultCount(tMisContractPointFreq)); }