Exemple #1
0
        /// <summary>
        /// 添加设备信息
        /// </summary>
        /// <param name="dev"></param>
        /// <param name="devBll"></param>
        private static bool AddDevInfo(DevInfoBackup dev, DevInfoBll devBll)
        {
            try
            {
                DevInfo devInfo = GetDevInfo(dev);
                DevPos  devPos  = GetDevPos(dev);
                devInfo.SetPos(devPos);
                //if (string.IsNullOrEmpty(devInfo.Local_DevID))
                //{

                //}
                DevInfo infoTemp = devBll.Find(i => i.Local_DevID == devInfo.Local_DevID);
                if (infoTemp == null)
                {
                    return(devBll.Add(devInfo));//新设备,加入
                }
                else
                {
                    UpgradeDevInfo(infoTemp, devInfo);//已经存在的设备,更新
                    bool value = devBll.Edit(infoTemp);
                    if (!value)
                    {
                        Log.Info("Error: EditDevinfo Error");
                    }
                    return(value);
                }
            }
            catch (Exception e)
            {
                Log.Info("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
                return(false);
            }
        }
Exemple #2
0
        public TEntity Put(TEntity item)
        {
            var dbItem = item.ToDbModel();

            dbItem.ModifyTime      = DateTime.Now;
            dbItem.ModifyTimeStamp = TimeConvert.DateTimeToTimeStamp(dbItem.ModifyTime);
            var result = dbSet.Edit(dbItem);

            return(result ? dbItem.ToTModel() : null);
        }