/// <summary> /// 用检测编号和次数查询一条检测数据 /// </summary> /// <param name="jcbh">检测编号</param> /// <param name="jccs">检测次数</param> /// <returns>ASM检测数据Model</returns> public ZYJSseconds Get_ZyjsDataSeconds(string CLID) { DateTime a; string sql = "select * from ZYJS_DATASECONDS where CLID=@CLID"; SqlParameter[] spr = { new SqlParameter("@CLID", CLID) }; try { ZYJSseconds asm = new ZYJSseconds(); DataTable dt = DBHelperSQL.GetDataTable(sql, CommandType.Text, spr); if (dt.Rows.Count > 0) { asm.CLID = dt.Rows[0]["CLID"].ToString();//1 asm.CLHP = dt.Rows[0]["CLHP"].ToString(); asm.JCSJ = DateTime.Parse(dt.Rows[0]["JCSJ"].ToString()); asm.MMTIME = dt.Rows[0]["MMTIME"].ToString(); asm.MMSX = dt.Rows[0]["MMSX"].ToString(); asm.MMLB = dt.Rows[0]["MMLB"].ToString(); asm.MMZS = dt.Rows[0]["MMZS"].ToString();//6 asm.MMK = dt.Rows[0]["MMK"].ToString(); } else { asm.CLID = "-2"; } return(asm); } catch (Exception) { throw; } }
/// <summary> /// 用JZJS插入逐秒数据 /// </summary> /// <param name="JZJS">JZJS</param> /// <returns>int 0为失败,1为插入成功,2为更新成功</returns> public int Save_ZYJSseconds(ZYJSseconds jzjs) { string sqli = "insert into ZYJS_DATASECONDS(JYLSH,JYCS,CYDS,CLID,CLHP,JCSJ,MMTIME,MMSX,MMLB,MMZS,MMYW,MMK) values(@JYLSH,@JYCS,@CYDS,@CLID,@CLHP,@JCSJ,@MMTIME,@MMSX,@MMLB,@MMZS,@MMYW,@MMK)"; string sqlu = "update ZYJS_DATASECONDS set JYLSH=@JYLSH,JYCS=@JYCS,CYDS=@CYDS,CLHP=@CLHP,JCSJ=@JCSJ,MMTIME=@MMTIME,MMSX=@MMSX,MMLB=@MMLB,MMZS=@MMZS,MMYW=@MMYW,MMK=@MMK where CLID=@CLID"; SqlParameter[] spr = { new SqlParameter("@JYLSH", jzjs.JYLSH), new SqlParameter("@JYCS", jzjs.JYCS), new SqlParameter("@CYDS", jzjs.CYDS), new SqlParameter("@CLID", jzjs.CLID), //1 new SqlParameter("@CLHP", jzjs.CLHP), new SqlParameter("@JCSJ", jzjs.JCSJ), new SqlParameter("@MMTIME", jzjs.MMTIME), new SqlParameter("@MMSX", jzjs.MMSX), new SqlParameter("@MMLB", jzjs.MMLB), //6 new SqlParameter("@MMZS", jzjs.MMZS), new SqlParameter("@MMYW", jzjs.MMYW), new SqlParameter("@MMK", jzjs.MMK) //47 }; try { if (Have_Zyjsseconds(jzjs.CLID)) { if (DBHelperSQL.Execute(sqlu, spr) > 0) { return(2); } else { return(0); } } else { if (DBHelperSQL.Execute(sqli, spr) > 0) { return(1); } else { return(0); } } } catch (Exception) { throw; return(0); } }
public ZYJSseconds Get_ZyjsDataSeconds(string clhp, DateTime jcsj) { DateTime a; string sql = "select * from ZYJS_DATASECONDS where clhp=@clhp and convert(varchar(50),jcsj,120)=convert(varchar(50),@jcsj,120)"; SqlParameter[] spr = { new SqlParameter("@clhp", clhp), new SqlParameter("@jcsj", jcsj.ToString("yyyy-MM-dd HH:mm:ss")) }; try { ZYJSseconds asm = new ZYJSseconds(); DataTable dt = DBHelperSQL.GetDataTable(sql, CommandType.Text, spr); if (dt.Rows.Count > 0) { asm.CLID = dt.Rows[0]["CLID"].ToString();//1 asm.CLHP = dt.Rows[0]["CLHP"].ToString(); asm.JCSJ = DateTime.Parse(dt.Rows[0]["JCSJ"].ToString()); asm.MMTIME = dt.Rows[0]["MMTIME"].ToString(); asm.MMSX = dt.Rows[0]["MMSX"].ToString(); asm.MMLB = dt.Rows[0]["MMLB"].ToString(); asm.MMZS = dt.Rows[0]["MMZS"].ToString();//6 asm.MMK = dt.Rows[0]["MMK"].ToString(); } else { asm.CLID = "-2"; } return(asm); } catch (Exception) { throw; } }