Esempio n. 1
0
        /// <summary>
        /// 用JZJS插入逐秒数据
        /// </summary>
        /// <param name="JZJS">JZJS</param>
        /// <returns>int 0为失败,1为插入成功,2为更新成功</returns>
        public int Save_SDSSseconds(SDSseconds sds)
        {
            string sqli = "insert into SDS_DATASECONDS(JYLSH,JYCS,CYDS,CLID,CLHP,JCSJ,MMTIME,MMSX,MMLB,MMHC,MMCO,MMO2,MMCO2,MMLAMDA,MMZS,MMYW,MMWD,MMSD,MMDQY) values(@JYLSH,@JYCS,@CYDS,@CLID,@CLHP,@JCSJ,@MMTIME,@MMSX,@MMLB,@MMHC,@MMCO,@MMO2,@MMCO2,@MMLAMDA,@MMZS,@MMYW,@MMWD,@MMSD,@MMDQY)";
            string sqlu = "update SDS_DATASECONDS set JYLSH=@JYLSH,JYCS=@JYCS,CYDS=@CYDS,CLHP=@CLHP,JCSJ=@JCSJ,MMTIME=@MMTIME,MMSX=@MMSX,MMLB=@MMLB,MMHC=@MMHC,MMCO=@MMCO,MMO2=@MMO2,MMCO2=@MMCO2,MMLAMDA=@MMLAMDA,MMZS=@MMZS,MMYW=@MMYW,MMWD=@MMWD,MMSD=@MMSD,MMDQY=@MMDQY where CLID=@CLID";

            SqlParameter[] spr =
            {
                new SqlParameter("@JYLSH",   sds.JYLSH),               //1
                new SqlParameter("@JYCS",    sds.JYCS),                //1
                new SqlParameter("@CYDS",    sds.CYDS),                //1
                new SqlParameter("@CLID",    sds.CLID),                //1
                new SqlParameter("@CLHP",    sds.CLHP),
                new SqlParameter("@JCSJ",    sds.JCSJ),
                new SqlParameter("@MMTIME",  sds.MMTIME),
                new SqlParameter("@MMSX",    sds.MMSX),
                new SqlParameter("@MMLB",    sds.MMLB),               //6
                new SqlParameter("@MMHC",    sds.MMHC),
                new SqlParameter("@MMCO",    sds.MMCO),
                new SqlParameter("@MMO2",    sds.MMO2),
                new SqlParameter("@MMCO2",   sds.MMCO2),
                new SqlParameter("@MMLAMDA", sds.MMLAMDA),
                new SqlParameter("@MMZS",    sds.MMZS),               //6
                new SqlParameter("@MMYW",    sds.MMYW),
                new SqlParameter("@MMWD",    sds.MMWD),
                new SqlParameter("@MMSD",    sds.MMSD),
                new SqlParameter("@MMDQY",   sds.MMDQY)
                //47
            };
            try
            {
                if (Have_SDSseconds(sds.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);
            }
        }
Esempio n. 2
0
        public SDSseconds Get_SDSDataSeconds(string clhp, DateTime jcsj)
        {
            DateTime a;
            string   sql = "select * from SDS_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
            {
                SDSseconds asm = new SDSseconds();
                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.MMHC    = dt.Rows[0]["MMHC"].ToString();//6
                    asm.MMCO    = dt.Rows[0]["MMCO"].ToString();
                    asm.MMO2    = dt.Rows[0]["MMO2"].ToString();
                    asm.MMCO2   = dt.Rows[0]["MMCO2"].ToString();
                    asm.MMLAMDA = dt.Rows[0]["MMLAMDA"].ToString();
                    asm.MMWD    = dt.Rows[0]["MMWD"].ToString();//11
                    asm.MMSD    = dt.Rows[0]["MMSD"].ToString();
                    asm.MMDQY   = dt.Rows[0]["MMDQY"].ToString();
                    asm.MMZS    = dt.Rows[0]["MMZS"].ToString();
                    asm.MMYW    = dt.Rows[0]["MMYW"].ToString();
                }
                else
                {
                    asm.CLID = "-2";
                }
                return(asm);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 用检测编号和次数查询一条检测数据
        /// </summary>
        /// <param name="jcbh">检测编号</param>
        /// <param name="jccs">检测次数</param>
        /// <returns>ASM检测数据Model</returns>
        public SDSseconds Get_SDSDataSeconds(string CLID)
        {
            DateTime a;
            string   sql = "select * from SDS_DATASECONDS where CLID=@CLID";

            SqlParameter[] spr =
            {
                new SqlParameter("@CLID", CLID)
            };
            try
            {
                SDSseconds asm = new SDSseconds();
                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.MMHC    = dt.Rows[0]["MMHC"].ToString();//6
                    asm.MMCO    = dt.Rows[0]["MMCO"].ToString();
                    asm.MMO2    = dt.Rows[0]["MMO2"].ToString();
                    asm.MMCO2   = dt.Rows[0]["MMCO2"].ToString();
                    asm.MMLAMDA = dt.Rows[0]["MMLAMDA"].ToString();
                    asm.MMWD    = dt.Rows[0]["MMWD"].ToString();//11
                    asm.MMSD    = dt.Rows[0]["MMSD"].ToString();
                    asm.MMDQY   = dt.Rows[0]["MMDQY"].ToString();
                    asm.MMZS    = dt.Rows[0]["MMZS"].ToString();
                    asm.MMYW    = dt.Rows[0]["MMYW"].ToString();
                }
                else
                {
                    asm.CLID = "-2";
                }
                return(asm);
            }
            catch (Exception)
            {
                throw;
            }
        }