/// <summary> /// 根据主键删除实例 /// </summary> /// <param name="oldEntity">设置了主键Id的对象</param> /// <returns></returns> public bool Delete(SUBCOMPANYMST 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); }
/// <summary> /// 复制对象 /// </summary> /// <param name="source">源对象</param> /// <returns></returns> public SUBCOMPANYMST Copy(SUBCOMPANYMST source) { SUBCOMPANYMST target = new SUBCOMPANYMST(); //字段复制操作 return(target); }
/// <summary> /// 根据用户名称查询唯一用户 /// </summary> /// <param name="searchInfo">带有PatrolNo的查询对象</param> /// <returns>指定UserCD值的个人信息</returns> public static SUBCOMPANYMST Select(SUBCOMPANYMST searchInfo) { if (searchInfo == null) { return(null); } return(controller.Select(searchInfo)); }
/// <summary> /// 删除记录 /// </summary> /// <param name="entity">删除对象 主键必须设置</param> /// <returns></returns> public static bool Delete(SUBCOMPANYMST entity) { if (entity != null) { return(controller.Delete(entity)); } return(false); }
/// <summary> /// 更新记录 /// </summary> /// <param name="entity">要更新对象</param> /// <param name="updateKeys">更新列表</param> /// <returns>true=成功,false=失败</returns> public static bool Update(SUBCOMPANYMST entity, Hashtable updateKeys) { if (entity != null && updateKeys != null && updateKeys.Count > 0) { return(controller.Update(entity, updateKeys)); } return(false); }
/// <summary> /// 新增记录 /// </summary> /// <param name="entity">新增对象</param> /// <returns>true=成功,false=失败</returns> public static bool Insert(SUBCOMPANYMST entity) { if (entity != null) { return(controller.Insert(entity)); } return(false); }
/// <summary> /// 记录需要更新的字段 /// </summary> /// <param name="update"></param> private static void SetUpdateValue(SUBCOMPANYMST current, Hashtable updateKeys) { foreach (DictionaryEntry item in updateKeys) { switch (item.Key.ToString().ToLower()) { //字段更新对应 default: break; } } }
/// <summary> /// 根据查询条件查询单条记录 /// </summary> /// <param name="searchInfo">查询条件,主键查询</param> /// <returns></returns> public SUBCOMPANYMST Select(SUBCOMPANYMST searchInfo) { SUBCOMPANYMST instance = null; try { SQLEntities context = new SQLEntities(); //查询单个用户 context.Dispose(); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(instance); }