コード例 #1
0
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_context != null)
         {
             _context.Dispose();
             _context = null;
         }
     }
 }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 public DeleteManyHandler(AppDataContext context)
 {
     _context = context;
 }
コード例 #5
0
 public QuestionRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #6
0
 public ReplyRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #7
0
 public LocalizacaoRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #8
0
ファイル: DetailsHandler.cs プロジェクト: cemiyet/backend
 public DetailsHandler(AppDataContext context)
 {
     _context = context;
 }
コード例 #9
0
 public PostRepository(AppDataContext context) : base(context)
 {
 }
コード例 #10
0
 public AddressRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #11
0
 public FormationRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #12
0
 public EvaluationCoacheeRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #13
0
 public CoacheeRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #14
0
 public PerformanceIndicatorRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #15
0
 public UserRepository(AppDataContext context, ApplicationUserManager userManager)
 {
     this._context = context;
     this._userManager = userManager;
 }
コード例 #16
0
        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();
        }
コード例 #17
0
 internal ModelQueryProvider(IDataProvider dataProvider, AppDataContext appDataContext, Type elementType)
 {
     _dataProvider   = dataProvider;
     _appDataContext = appDataContext;
     _elementType    = elementType;
 }
コード例 #18
0
 public ProductRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #19
0
 public void Dispose()
 {
     _context = null;
 }
コード例 #20
0
 public CategoryRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #21
0
 public ProdutoRepository(AppDataContext context)
 {
     _context = context;
 }
コード例 #22
0
 /// <summary>
 /// A default constructor for the service
 /// </summary>
 public CourseServiceProvider()
 {
     _db = new AppDataContext();
 }
コード例 #23
0
 public MarkRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #24
0
 public ActionPlanRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #25
0
 public ExerciseTemplatesController(AppDataContext context)
 {
     this.context = context;
 }
コード例 #26
0
 public StrongPointRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #27
0
 public FilledToolCoacheeRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #28
0
 public UsuarioRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #29
0
 public BudgetRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #30
0
        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)
            { }
        }
コード例 #31
0
        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());
        }
コード例 #32
0
        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;
        }
コード例 #33
0
ファイル: AccountDataMapper.cs プロジェクト: atlit06/Honn
 public AccountDataMapper(AppDataContext db)
 {
     _db = db;
 }
コード例 #34
0
 public BaseRepository(AppDataContext AspNetCoreWebApiContext)
 {
     _AspNetCoreWebApiContext = AspNetCoreWebApiContext ?? throw new ArgumentNullException(nameof(AspNetCoreWebApiContext));
 }
コード例 #35
0
 public EvaluationCoachRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #36
0
 public UserRepository(AppDataContext data)
 {
     _data = data;
 }
コード例 #37
0
 public UserCrudOperation(AppDataContext app)
 {
     this.dataContext = app;
 }
コード例 #38
0
 public CoachingProcessRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #39
0
 public AddressesController(AppDataContext context)
 {
     _context = context;
 }
コード例 #40
0
 public CauHoisController(AppDataContext context)
 {
     _context = context;
 }
コード例 #41
0
 public CreateModel(AppDataContext context)
 {
     _context = context;
 }
コード例 #42
0
 public CoursesServiceProvider()
 {
     _db = new AppDataContext();
 }
コード例 #43
0
ファイル: TodoController.cs プロジェクト: VegasoftTI/1960
 public TodoController(AppDataContext context)
 {
     _db = context;
 }
コード例 #44
0
 public MessageRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #45
0
ファイル: AddEditionHandler.cs プロジェクト: cemiyet/backend
 public AddEditionHandler(AppDataContext context)
 {
     _context = context;
 }
コード例 #46
0
 public BlocoController(AppDataContext context)
 {
     _context = context;
 }
コード例 #47
0
 public ProductController(AppDataContext context)
 {
     _context = context;
 }
コード例 #48
0
 public ProductRepository(AppDataContext context) : base(context)
 {
     Context = context;
 }
コード例 #49
0
 public Uow(AppDataContext db)
 {
     _db = db;
 }
コード例 #50
0
 public infoesController(AppDataContext context)
 {
     _context = context;
 }
コード例 #51
0
 public UnitOfWork(AppDataContext context, UserManager <AppUser> userManager)
 {
     _context    = context;
     UserManager = userManager;
 }
コード例 #52
0
        public Todo GetTodo(int TodoId)
        {
            var dbContext = new AppDataContext();

            return(dbContext.UserTodo.Find(TodoId));
        }
コード例 #53
0
 public SessionRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #54
0
 public UserRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #55
0
 public AuthorRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #56
0
 public UserRepository()
 {
     _context = new AppDataContext();
 }
コード例 #57
0
 public ModuloRepository(AppDataContext context)
 {
     this._context = context;
 }
コード例 #58
0
 public VoteController(AppDataContext context)
 {
     _context = context;
 }
コード例 #59
0
 public void Dispose()
 {
     _context = null;
 }
コード例 #60
0
        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("");
        }