public async Task Deletar(StatusConfig statusConfig) { using (KurosawaConfigContext contexto = new KurosawaConfigContext()) { contexto.StatusConfig.Remove(statusConfig); await contexto.SaveChangesAsync(); } }
private void StatusDataGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { StatusConfig statusConfigs = (StatusConfig)((DataGridRow)sender).Item; StatusCod.Text = statusConfigs.Cod.ToString(); StatusName.Text = statusConfigs.StatusJogo; StatusUrl.Text = statusConfigs.StatusUrl; StatusTipo.SelectedIndex = (int)statusConfigs.TipoDeStatus; }
protected override void OnModelCreating(ModelBuilder modelBuilder) { // Geographic Entities ContinentConfig.SetEntityBuilder(modelBuilder.Entity <Continent>()); CountryConfig.SetEntityBuilder(modelBuilder.Entity <Country>()); RegionConfig.SetEntityBuilder(modelBuilder.Entity <Region>()); // Administrative Entities AdminConfig.SetEntityBuilder(modelBuilder.Entity <Admin>()); EventConfig.SetEntityBuilder(modelBuilder.Entity <Event>()); // Measures Entities SanitaryMeasureConfig.SetEntityBuilder(modelBuilder.Entity <SanitaryMeasure>()); ContainmentMeasureConfig.SetEntityBuilder(modelBuilder.Entity <ContainmentMeasure>()); CmByCountry.SetEntityBuilder(modelBuilder.Entity <CountryContainmentMeasures>()); SmByCountry.SetEntityBuilder(modelBuilder.Entity <CountrySanitaryMeasures>()); // Hospital Entities HospitalConfig.SetEntityBuilder(modelBuilder.Entity <Hospital>()); HEmployeeConfig.SetEntityBuilder(modelBuilder.Entity <HospitalEmployee>()); MedicationConfig.SetEntityBuilder(modelBuilder.Entity <Medication>()); // Person Entities PatientConfig.SetEntityBuilder(modelBuilder.Entity <Patient>()); P_MedicationConfig.SetEntityBuilder(modelBuilder.Entity <PatientMedications>()); Pt_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PatientPathologies>()); PersonConfig.SetEntityBuilder(modelBuilder.Entity <ContactedPerson>()); Ps_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PersonPathologies>()); ContactsByPatientConfig.SetEntityBuilder(modelBuilder.Entity <PersonsContactedByPatient>()); // Not related Entities PathologiesConfig.SetEntityBuilder(modelBuilder.Entity <Pathology>()); Pharm_CompanyConfig.SetEntityBuilder(modelBuilder.Entity <PharmaceuticalCompany>()); StatusConfig.SetEntityBuilder(modelBuilder.Entity <PatientStatus>()); // Views and Stored Procedures modelBuilder.Entity <PatientView>().HasNoKey().ToView(null); modelBuilder.Entity <ExportPatient>().HasNoKey().ToView(null); modelBuilder.Entity <CasesView>().HasNoKey().ToView(null); modelBuilder.Entity <ReportView>().HasNoKey().ToView(null); modelBuilder.Entity <MeasureView>().HasNoKey().ToView(null); modelBuilder.Entity <MedicationView>().HasNoKey().ToView(null); modelBuilder.Entity <PatientMedicationView>().HasNoKey().ToView(null); modelBuilder.Entity <PathologyView>().HasNoKey().ToView(null); modelBuilder.Entity <ContactView>().HasNoKey().ToView(null); }
private async Task CriarDB() { if (await new KurosawaConfigContext().Database.EnsureCreatedAsync()) { AConsole.WriteLine("Definindo as Configurações do Bot:", Color.Yellow); Config = new BaseConfig(); Console.Write("Token Bot: "); Config.Token = Console.ReadLine(); Console.Write("ID Dono: "); Config.IdDono = ulong.Parse(Console.ReadLine()); Console.Write("Prefixo: "); Config.Prefixo = Console.ReadLine(); await new BaseConfigDAO().Adicionar(Config); DbConfig = new DBConfig(); AConsole.WriteLine("Configurar o Database:", Color.Yellow); Console.Write("IP: "); DbConfig.IP = Console.ReadLine(); Console.Write("Porta: "); DbConfig.Porta = uint.Parse(Console.ReadLine()); Console.Write("Database: "); DbConfig.Database = Console.ReadLine(); Console.Write("User: "******"Senha: "); DbConfig.Senha = Console.ReadLine(); DBConfigDAO DBDAO = new DBConfigDAO(); await DBDAO.Adicionar(DbConfig); AConsole.WriteLine("Definindo as Configurações das Apis (0 no nome termina as adições):", Color.Yellow); ApiConfigDAO api = new ApiConfigDAO(); List <ApiConfig> temp = new List <ApiConfig>(); while (true) { ApiConfig configapi = new ApiConfig(); Console.Write("Nome da Api: "); configapi.Nome = Console.ReadLine(); if (configapi.Nome == "0") { break; } Console.Write("Key da Api: "); configapi.Key = Console.ReadLine(); temp.Add(configapi); } ApiConfig = temp.ToArray(); await api.Adicionar(ApiConfig); AConsole.WriteLine("Definindo as Configurações dos Status (0 no nome termina as adições):", Color.Yellow); StatusConfigDAO statusdao = new StatusConfigDAO(); List <StatusConfig> status = new List <StatusConfig>(); while (true) { StatusConfig configtemp = new StatusConfig(); Console.Write("Nome do Status: "); configtemp.StatusJogo = Console.ReadLine(); if (configtemp.StatusJogo == "0") { break; } status.Add(configtemp); } Status = status.ToArray(); await statusdao.Adicionar(Status); } else { Config = await new BaseConfigDAO().Ler(); ApiConfig = await new ApiConfigDAO().Ler(); DbConfig = await new DBConfigDAO().Ler(); Status = await new StatusConfigDAO().Ler(); } Console.ResetColor(); }
/// <summary> /// 检查单个角色条件 /// </summary> public virtual bool checkOneRoleCondition(int[] args, bool needNotice) { switch (args[0]) { case RoleConditionType.Level: { if (me.role.getLevel() < args[1]) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needLevel); } return(false); } } break; case RoleConditionType.FunctionOpen: { if (!me.func.isFunctionOpen(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_functionNotOpen, FunctionConfig.get(args[1]).showName); } return(false); } } break; case RoleConditionType.NeedUnion: { if (!me.union.hasUnion()) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needUnion); } return(false); } } break; case RoleConditionType.QuestComplete: { if (!me.quest.isQuestComplete(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needCompleteQuest, QuestConfig.get(args[1]).name); } return(false); } } break; case RoleConditionType.OnStatus: { if (!me.character.getCurrentCharacterUseLogic().getFightLogic().status.getStatus(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needOnStatus, StatusConfig.getShowName(args[1])); } return(false); } } break; case RoleConditionType.OffStatus: { if (me.character.getCurrentCharacterUseLogic().getFightLogic().status.getStatus(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needOffStatus, StatusConfig.getShowName(args[1])); } return(false); } } break; } return(true); }