Пример #1
0
 /// <summary>
 /// 获取指定标识的液位仪信息
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public LiquidPositionNo QueryByID(long id)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         return((from item in oContext.LiquidPositionNo where item.id == id select item).FirstOrDefault());
     }
 }
Пример #2
0
 /// <summary>
 /// 获取全部液位仪信息
 /// </summary>
 /// <returns></returns>
 public List <LiquidPositionNo> QueryAll()
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         var result = from item in oContext.LiquidPositionNo
                      select item;
         return(result.ToList());
     }
 }
Пример #3
0
 /// <summary>
 /// 查询温度计数据集
 /// </summary>
 /// <returns></returns>
 public List <TemperatureNo> QueryAll()
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         var result = from item in oContext.TemperatureNo
                      select item;
         return(result.ToList());
     }
 }
Пример #4
0
 /// <summary>
 /// 插入液位仪信息
 /// </summary>
 /// <param name="entity"></param>
 public void Insert(LiquidPositionNo entity)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         entity.inputDate = DateTime.Now;
         oContext.LiquidPositionNo.InsertOnSubmit(entity);
         oContext.SubmitChanges();
     }
 }
Пример #5
0
 /// <summary>
 /// 插入温度计信息
 /// </summary>
 /// <param name="entity"></param>
 public void Insert(TemperatureNo entity)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         entity.inputDate = DateTime.Now;
         oContext.TemperatureNo.InsertOnSubmit(entity);
         oContext.SubmitChanges();
     }
 }
Пример #6
0
 /// <summary>
 /// 获取指定标识的温度计信息
 /// </summary>
 /// <param name="id">标识</param>
 /// <returns></returns>
 public TemperatureNo QueryByID(long id)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         var result = from item in oContext.TemperatureNo
                      where item.id == id
                      select item;
         return(result.FirstOrDefault());
     }
 }
Пример #7
0
 /// <summary>
 /// 获取指定标识的流量计信息
 /// </summary>
 /// <param name="id">标识</param>
 /// <returns></returns>
 public FlowmeterNo QueryByID(long id)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(new DasherStation.common.SqlHelper().SqlConn))
     {
         var result = from item in oContext.FlowmeterNo
                      where item.id == id
                      select item;
         return(result.FirstOrDefault());
     }
 }
Пример #8
0
 /// <summary>
 /// 更新流量计设置
 /// </summary>
 /// <param name="entity"></param>
 public void Update(FlowmeterNo entity)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(new DasherStation.common.SqlHelper().SqlConn))
     {
         var _entity = (from item in oContext.FlowmeterNo
                        where entity.id == item.id
                        select item).FirstOrDefault();
         _entity.name     = entity.name;
         _entity.position = entity.position;
         _entity.remark   = entity.remark;
         oContext.SubmitChanges();
     }
 }
Пример #9
0
 /// <summary>
 /// 更新液位仪信息
 /// </summary>
 /// <param name="entity"></param>
 public void Update(LiquidPositionNo entity)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         var _entity = (from item in oContext.LiquidPositionNo
                        where entity.id == item.id
                        select item).FirstOrDefault();
         _entity.name     = entity.name;
         _entity.minValue = entity.minValue;
         _entity.maxValue = entity.maxValue;
         _entity.position = entity.position;
         _entity.remark   = entity.remark;
         oContext.SubmitChanges();
     }
 }
Пример #10
0
 /// <summary>
 /// 判断指定名称是否存在
 /// </summary>
 /// <param name="strName">液位仪名称</param>
 /// <returns></returns>
 public bool IsExistByName(string strName)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         var result = (from item in oContext.LiquidPositionNo
                       where item.name.Trim() == strName.Trim()
                       select item.id).Count();
         if (result > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Пример #11
0
 /// <summary>
 /// 判断指定编号是否存在
 /// </summary>
 /// <param name="strNo">温度计编号</param>
 /// <returns></returns>
 public bool IsExistByNo(string strNo)
 {
     using (MonitorDataContext oContext = new MonitorDataContext(this._strConn))
     {
         var result = (from item in oContext.TemperatureNo
                       where item.no.Trim() == strNo.Trim()
                       select item.id).Count();
         if (result > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Пример #12
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="id"></param>
        public void Delete(int[] id)
        {
            MonitorDataContext oHumanContext = new MonitorDataContext(this._strConn);
            var deleting =
                from item in oHumanContext.LiquidPositionNo
                where id.Contains((int)item.id)
                select item;

            foreach (var item in deleting)
            {
                try
                {
                    oHumanContext.LiquidPositionNo.DeleteOnSubmit(item);
                    oHumanContext.SubmitChanges();
                }
                catch
                {
                }
            }
        }