private void Dispose(bool disposing) { if (disposing) { if (_context != null) { _context.Dispose(); _context = null; } } }
public static JsonObject ToJsonForGetExpansions(AppDataContext appDataContext) { JsonObject root = new Windows.Data.Json.JsonObject(); JsonArray expansionArray = new JsonArray(); foreach (var expansion in appDataContext.Expansions) { JsonObject expansionObject = new JsonObject(); expansionObject.Add("name", JsonValue.CreateStringValue(expansion.DominionExpansion.ToProgramaticName())); expansionObject.Add("present", JsonValue.CreateBooleanValue(expansion.IsEnabled.Value)); expansionArray.Add(expansionObject); } root.Add(jsonNameRequiredExpansions, expansionArray); return root; }
public MainPage() { MainPage.appDataContextStatic = new AppDataContext(this); this.appDataContext = MainPage.appDataContextStatic; this.InitializeComponent(); this.DataContext = this.appDataContext; this.CurrentCards.CurrentCardsChanged += this.AllCards.UpdateAllCardsListSelection; this.appDataContext.CurrentDeck.PropertyChanged += UpdateCommonCardsFromKingdom; this.appDataContext.StrategyReport.PropertyChanged += StrategyReport_PropertyChanged; this.appDataContext.UseShelters.PropertyChanged += UpdateCommonCardsFromKingdom; this.appDataContext.UseColonyPlatinum.PropertyChanged += UpdateCommonCardsFromKingdom; this.appDataContext.CurrentDeck.SortByCost(); this.appDataContext.AllCards.SortByName(); this.Loaded += MainPage_Loaded; }
public DeleteManyHandler(AppDataContext context) { _context = context; }
public QuestionRepository(AppDataContext context) { this._context = context; }
public ReplyRepository(AppDataContext context) { this._context = context; }
public LocalizacaoRepository(AppDataContext context) { this._context = context; }
public DetailsHandler(AppDataContext context) { _context = context; }
public PostRepository(AppDataContext context) : base(context) { }
public AddressRepository(AppDataContext context) { this._context = context; }
public FormationRepository(AppDataContext context) { this._context = context; }
public EvaluationCoacheeRepository(AppDataContext context) { this._context = context; }
public CoacheeRepository(AppDataContext context) { this._context = context; }
public PerformanceIndicatorRepository(AppDataContext context) { this._context = context; }
public UserRepository(AppDataContext context, ApplicationUserManager userManager) { this._context = context; this._userManager = userManager; }
static void Main(string[] args) { #region Objetos var informatica = new Categoria { Id = 1, Titulo = "Informática" }; var artesMarciais = new Categoria { Id = 2, Titulo = "Artes Marciais" }; var ciencias = new Categoria { Id = 3, Titulo = "Ciências" }; var andre = new Autor { Id = 1, Nome = "André Baltieri" }; var bruce = new Autor { Id = 2, Nome = "Bruce Wayne" }; var peter = new Autor { Id = 3, Nome = "Peter Parker" }; var tony = new Autor { Id = 4, Nome = "Tony Stark" }; var devapi = new Livro { Id = 1, Titulo = "Desenvolvendo APIs com WebApi", CategoriaId = 1 }; var ninjitsu = new Livro { Id = 2, Titulo = "Os segredos do Ninjitsu", CategoriaId = 2 }; var aranhas = new Livro { Id = 3, Titulo = "O segredo das aranhas", CategoriaId = 3 }; var robotica = new Livro { Id = 4, Titulo = "Robótica avançada", CategoriaId = 3 }; #endregion #region Context using (AppDataContext db = new AppDataContext()) { db.Categorias.Add(informatica); db.Categorias.Add(artesMarciais); db.Categorias.Add(ciencias); db.Autores.Add(andre); db.Autores.Add(bruce); db.Autores.Add(peter); db.Autores.Add(tony); db.Livros.Add(devapi); db.Livros.Add(ninjitsu); db.Livros.Add(aranhas); db.Livros.Add(robotica); devapi.Autores.Add(andre); devapi.Autores.Add(tony); devapi.Autores.Add(bruce); ninjitsu.Autores.Add(bruce); devapi.Autores.Add(tony); aranhas.Autores.Add(peter); devapi.Autores.Add(tony); robotica.Autores.Add(tony); db.SaveChanges(); } #endregion #region Categorias using (AppDataContext db = new AppDataContext()) { Console.WriteLine("Categorias"); foreach (Categoria categoria in db.Categorias) { Console.WriteLine( String.Format("{0} - {1}", categoria.Id, categoria.Titulo)); } } #endregion Console.WriteLine(Environment.NewLine); #region Autores using (AppDataContext db = new AppDataContext()) { Console.WriteLine("Autores"); foreach (Autor autor in db.Autores) { Console.WriteLine( String.Format("{0} - {1}", autor.Id, autor.Nome)); } } #endregion Console.WriteLine(Environment.NewLine); #region Livros using (AppDataContext db = new AppDataContext()) { Console.WriteLine("Livros"); foreach (Livro livro in db.Livros) { Console.WriteLine( String.Format("{0} - {1}", livro.Id, livro.Titulo)); } } #endregion Console.WriteLine(Environment.NewLine); #region Tudo using (AppDataContext db = new AppDataContext()) { Console.WriteLine("Tudo"); foreach (Categoria categoria in db.Categorias.Include("Livros") .Include("Livros.Autores") .ToList()) { Console.WriteLine("Categoria: " + categoria.Titulo); foreach (Livro livro in categoria.Livros) { Console.WriteLine("\tLivro: " + livro.Titulo); foreach (Autor autor in livro.Autores) { Console.WriteLine("\t\tAutor: " + autor.Nome); } } Console.WriteLine(Environment.NewLine); } } #endregion Console.ReadKey(); }
internal ModelQueryProvider(IDataProvider dataProvider, AppDataContext appDataContext, Type elementType) { _dataProvider = dataProvider; _appDataContext = appDataContext; _elementType = elementType; }
public ProductRepository(AppDataContext context) { this._context = context; }
public void Dispose() { _context = null; }
public CategoryRepository(AppDataContext context) { this._context = context; }
public ProdutoRepository(AppDataContext context) { _context = context; }
/// <summary> /// A default constructor for the service /// </summary> public CourseServiceProvider() { _db = new AppDataContext(); }
public MarkRepository(AppDataContext context) { this._context = context; }
public ActionPlanRepository(AppDataContext context) { this._context = context; }
public ExerciseTemplatesController(AppDataContext context) { this.context = context; }
public StrongPointRepository(AppDataContext context) { this._context = context; }
public FilledToolCoacheeRepository(AppDataContext context) { this._context = context; }
public UsuarioRepository(AppDataContext context) { this._context = context; }
public BudgetRepository(AppDataContext context) { this._context = context; }
public static async Task SendGameConfigToServer(AppDataContext appDataContext) { GameDescription gameDescription = appDataContext.GetGameConfig().gameDescription; JsonObject json = WebService.ToJson(gameDescription, appDataContext.DeckRating.Value); string parameter = json.Stringify(); var fullUrl = new System.Text.StringBuilder(); fullUrl.Append(WebService.webUrl); fullUrl.Append("?action=RECORD&values="); fullUrl.Append(parameter.Replace(" ", "%20")); try { using (var client = new Windows.Web.Http.HttpClient()) using (var request = new Windows.Web.Http.HttpRequestMessage()) { request.RequestUri = new System.Uri(fullUrl.ToString()); using (Windows.Web.Http.HttpResponseMessage responseMessage = await client.SendRequestAsync(request).AsTask()) { if (responseMessage.IsSuccessStatusCode) { string strResult = await responseMessage.Content.ReadAsStringAsync().AsTask(); System.Diagnostics.Debug.WriteLine("RECORD Reponse from server:"); System.Diagnostics.Debug.WriteLine(strResult); } } } } catch (System.Exception) { } }
public static string GetProcessTable(int alertID) { string tab1 = ""; string tab2 = ""; string tab3 = ""; string tab4 = ""; StringBuilder sb = new StringBuilder(); using (AppDataContext db = new AppDataContext()) { foreach (AlertProcessLog ev in db.AlertProcessLogs.Where(t => t.AlertId == alertID).OrderBy(t => t.UpdateTime).ToList()) { if (ev != null) { if (ev.UserId > 0) { tab1 = Data.User.Select(ev.UserId) == null ? "未知" : Data.User.Select(ev.UserId).UserName; } else { tab1 = "未知"; } tab2 = Misc.GetAlertStatus((AlertStatusType)ev.AlertStatus); tab3 = ev.ChangeReason; tab4 = ev.UpdateTime.ToString("yyyy/MM/dd HH:mm:ss"); sb.AppendFormat(@" <tr> <td> {0} </td> <td> {1} </td> <td> {2} </td> <td> {3} </td> </tr>", tab1, tab2, tab3, tab4); } } if (sb.Length > 0) { sb.Insert(0, @"<table class=""grid alternate fixed"" border=""0"" cellspacing=""0"" cellpadding=""0""> <thead> <th width=200>处理人</th> <th width=200>报警状态</th> <th width=200>处理结果</th> <th width=200>处理时间</th> </thead> "); sb.Append(" </table>"); } } return(sb.ToString()); }
public static async Task<GameDescriptionAndRating> GetGameConfigFomServer(AppDataContext appDataContext) { JsonObject jsonParameter = ToJsonForGetExpansions(appDataContext); string parameter = jsonParameter.Stringify(); var fullUrl = new System.Text.StringBuilder(); fullUrl.Append(WebService.webUrl); fullUrl.Append("?action=GET&values="); fullUrl.Append(parameter.Replace(" ", "%20")); try { using (var client = new Windows.Web.Http.HttpClient()) using (var request = new Windows.Web.Http.HttpRequestMessage()) { request.RequestUri = new System.Uri(fullUrl.ToString()); using (Windows.Web.Http.HttpResponseMessage responseMessage = await client.SendRequestAsync(request).AsTask()) { if (responseMessage.IsSuccessStatusCode) { string strResult = await responseMessage.Content.ReadAsStringAsync().AsTask(); GameDescriptionAndRating description = WebService.GetGameDescriptionFromJson(strResult); System.Diagnostics.Debug.WriteLine("Get Response from server:"); System.Diagnostics.Debug.WriteLine(strResult); return description; } } } } catch (System.Exception) { } return null; }
public AccountDataMapper(AppDataContext db) { _db = db; }
public BaseRepository(AppDataContext AspNetCoreWebApiContext) { _AspNetCoreWebApiContext = AspNetCoreWebApiContext ?? throw new ArgumentNullException(nameof(AspNetCoreWebApiContext)); }
public EvaluationCoachRepository(AppDataContext context) { this._context = context; }
public UserRepository(AppDataContext data) { _data = data; }
public UserCrudOperation(AppDataContext app) { this.dataContext = app; }
public CoachingProcessRepository(AppDataContext context) { this._context = context; }
public AddressesController(AppDataContext context) { _context = context; }
public CauHoisController(AppDataContext context) { _context = context; }
public CreateModel(AppDataContext context) { _context = context; }
public CoursesServiceProvider() { _db = new AppDataContext(); }
public TodoController(AppDataContext context) { _db = context; }
public MessageRepository(AppDataContext context) { this._context = context; }
public AddEditionHandler(AppDataContext context) { _context = context; }
public BlocoController(AppDataContext context) { _context = context; }
public ProductController(AppDataContext context) { _context = context; }
public ProductRepository(AppDataContext context) : base(context) { Context = context; }
public Uow(AppDataContext db) { _db = db; }
public infoesController(AppDataContext context) { _context = context; }
public UnitOfWork(AppDataContext context, UserManager <AppUser> userManager) { _context = context; UserManager = userManager; }
public Todo GetTodo(int TodoId) { var dbContext = new AppDataContext(); return(dbContext.UserTodo.Find(TodoId)); }
public SessionRepository(AppDataContext context) { this._context = context; }
public UserRepository(AppDataContext context) { this._context = context; }
public AuthorRepository(AppDataContext context) { this._context = context; }
public UserRepository() { _context = new AppDataContext(); }
public ModuloRepository(AppDataContext context) { this._context = context; }
public VoteController(AppDataContext context) { _context = context; }
public static object GetData(int alertID) { string id_name = ""; string id_position = ""; string id_type = ""; string id_time = ""; string id_table = ""; NameID[] id_selectResult = null; using (AppDataContext db = new AppDataContext()) { TagAlert _tagAlert = db.TagAlerts.SingleOrDefault(t => t.AlertId == alertID); if (_tagAlert == null) { throw new Exception("报警事件不存在!"); } else { HostTag thisHostTag = HostTag.GetById(_tagAlert.HostId); Tag thisTag = Tag.Select(thisHostTag.TagId); if (thisTag != null) { if (CommonExtension.IsIlltreatTag(_tagAlert.HostId)) { if (Config.Settings.ProjectType == ProjectTypeEnum.NMPrison) { id_position = thisHostTag.HostName; } else { int coorid = CommonExtension.GetCoordinatesId(thisHostTag.Description.Substring(0, thisHostTag.Description.Length - 2)); id_position = Coordinates.GetName(coorid); } } else { id_position = Coordinates.GetName(_tagAlert.CoordinatesId); } //if (Config.Settings.ProjectType == ProjectTypeEnum.NMPrison) //{ // id_position = thisHostTag.HostName; //} //else //{ // int coorid = CommonExtension.GetCoordinatesId(thisHostTag.Description.Substring(0, thisHostTag.Description.Length - 2)); // id_position = Coordinates.GetName(coorid); //} if (LocatingServiceUtil.IsAvailable()) { IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>(); bool boolean = serviceApi.ClearTagStatus(thisTag.TagMac, (SupportEvent)_tagAlert.AlertType); } id_name = thisHostTag.HostName; //id_position = Coordinates.GetName(coorid); id_type = CommonExtension.GetEventDescription((SupportEvent)_tagAlert.AlertType, _tagAlert.HostId); id_time = _tagAlert.WriteTime.ToString("yyyy/MM/dd HH:mm:ss"); id_selectResult = db.ProcessResults.Select(_d => new NameID { ID = _d.ID, Name = _d.Text }).ToArray(); id_table = GetProcessTable(alertID); return(new { id_name, id_position, id_type, id_time, id_table, id_selectResult }); } } } return(""); }