Esempio n. 1
0
        /// <summary>
        /// 根据主键删除实例
        /// </summary>
        /// <param name="oldEntity">设置了主键Id的对象</param>
        /// <returns></returns>
        public bool Delete(MACHINEMST entity)
        {
            SQLEntities context = new SQLEntities();
            bool        success = false;

            using (TransactionScope trans = new TransactionScope())
            {
                try
                {
                    //删除操作

                    trans.Complete();
                    success = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            try
            {
                if (success)
                {
                    //提交保存
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            context.Dispose();

            return(success);
        }
Esempio n. 2
0
        /// <summary>
        /// 复制对象
        /// </summary>
        /// <param name="source">源对象</param>
        /// <returns></returns>
        public MACHINEMST Copy(MACHINEMST source)
        {
            MACHINEMST target = new MACHINEMST();

            //字段复制操作

            return(target);
        }
Esempio n. 3
0
 /// <summary>
 /// 根据用户名称查询唯一用户
 /// </summary>
 /// <param name="searchInfo">带有PatrolNo的查询对象</param>
 /// <returns>指定UserCD值的个人信息</returns>
 public static MACHINEMST Select(MACHINEMST searchInfo)
 {
     if (searchInfo == null)
     {
         return(null);
     }
     return(controller.Select(searchInfo));
 }
Esempio n. 4
0
 /// <summary>
 /// 删除记录
 /// </summary>
 /// <param name="entity">删除对象 主键必须设置</param>
 /// <returns></returns>
 public static bool Delete(MACHINEMST entity)
 {
     if (entity != null)
     {
         return(controller.Delete(entity));
     }
     return(false);
 }
Esempio n. 5
0
 /// <summary>
 /// 更新记录
 /// </summary>
 /// <param name="entity">要更新对象</param>
 /// <param name="updateKeys">更新列表</param>
 /// <returns>true=成功,false=失败</returns>
 public static bool Update(MACHINEMST entity, Hashtable updateKeys)
 {
     if (entity != null && updateKeys != null && updateKeys.Count > 0)
     {
         return(controller.Update(entity, updateKeys));
     }
     return(false);
 }
Esempio n. 6
0
 /// <summary>
 /// 新增记录
 /// </summary>
 /// <param name="entity">新增对象</param>
 /// <returns>true=成功,false=失败</returns>
 public static bool Insert(MACHINEMST entity)
 {
     if (entity != null)
     {
         return(controller.Insert(entity));
     }
     return(false);
 }
Esempio n. 7
0
 /// <summary>
 /// 记录需要更新的字段
 /// </summary>
 /// <param name="update"></param>
 private static void SetUpdateValue(MACHINEMST current, Hashtable updateKeys)
 {
     foreach (DictionaryEntry item in updateKeys)
     {
         switch (item.Key.ToString().ToLower())
         {
         //字段更新对应
         default:
             break;
         }
     }
 }
Esempio n. 8
0
        /// <summary>
        /// 根据查询条件查询单条记录
        /// </summary>
        /// <param name="searchInfo">查询条件,主键查询</param>
        /// <returns></returns>
        public MACHINEMST Select(MACHINEMST searchInfo)
        {
            MACHINEMST instance = null;

            try
            {
                SQLEntities context = new SQLEntities();

                //查询单个用户

                context.Dispose();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(instance);
        }