public virtual void Initializer() { //Add a client to be removed by our test. //Instantiate a new context. using (var context = new MainContext()) { //Create a repository based on the context. var myRepo = new Repository<Address>(context); //Have to provide valid info. MyNewAddress = new Address { AddressLine1 = "Barão de Mesquita Street", AddressLine2 = "Tijuca", Country = MyCountryTest, State = "RJ", Zip = "20540-156" }; myRepo.Add(MyNewAddress); myRepo.Save(); } }
public void Delete() { using (var context = new MainContext()) { var myRepo = new Repository<Core.Customer>(context); TotalCustomersBeforeTestRuns = myRepo.GetAll().Count(); var allEntities = myRepo.GetAll().ToList(); if (allEntities.Count > 0) { //Find an entity to be removed. var firstClientInTheDb = allEntities.FirstOrDefault(); //Check if there is an entity to be removed if (firstClientInTheDb != null) { myRepo.Remove(firstClientInTheDb.Id); myRepo.Save(); TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count(); // Check if the total number of entites was reduced by one. Assert.AreEqual(TotalCustomersBeforeTestRuns - 1, TotalOfClientsAfterTheTestRuns); } } } }
public ActionResult Index() { var context = new MainContext(); var samples = context.Samples.Select(s => s); var model = Mapper.Map<IEnumerable<SampleViewModel>>(samples); return View(model); }
public void Insert() { using (var context = new MainContext()) { var myRepo = new Repository<Address>(context); TotalAdresssBeforeTestRuns = myRepo.GetAll().Count(); //Have to provide a valid name and e-mail address MyNewAddress = new Address { AddressLine1 = "Barão de Mesquita Street", AddressLine2 = "Tijuca", Country = MyCountryTest, State = "RJ", Zip = "20540-156" }; myRepo.Add(MyNewAddress); myRepo.Save(); TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count(); //Assert that the number of clients increase by 1 Assert.AreEqual(TotalAdresssBeforeTestRuns + 1, TotalOfClientsAfterTheTestRuns); } }
public IEnumerable<Tournament> GetAllTournaments() { using (var context = new MainContext()) { return Enumerable.ToList(context.Tournaments); } }
public Tournament GetTournament(int id) { using (var context = new MainContext()) { return context.Tournaments.Find(id); } }
public Comment GetComment(int id) { using (var context = new MainContext()) { return context.Comments.Find(id); } }
public User GetUser(int id) { using (var context = new MainContext()) { return context.Users.Find(id); } }
public SimpleMembershipInitializer() { Database.SetInitializer<MainContext>(null); try { using (var context = new MainContext()) { if (!context.Database.Exists()) { // Create the SimpleMembership database without Entity Framework migration schema ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); } } WebSecurity.InitializeDatabaseConnection( Config.ConnectionStringName, Config.UsersTableName, Config.UsersPrimaryKeyColumnName, Config.UsersUserNameColumnName, autoCreateTables: true); } catch (Exception ex) { throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex); } }
public void SaveUser(User user) { using (var context = new MainContext()) { UpdateEntity(context, user); context.SaveChanges(); } }
protected override void InternalSave(MainContext context, TransactionScope transaction) { var user = context.Users.Where(u => u.LoginName == LoginName).Select(u => new { u.Id, u.Password, u.Role }).FirstOrDefault(); if (user == null || user.Password != CommonHelper.GetMd5Hash(Password)) throw new ApplicationException("Invalid user credentials"); UserId = user.Id; Role = (EUserRole)user.Role; }
public void SaveTournament(Tournament tournament) { using (var context = new MainContext()) { UpdateEntity(context, tournament); context.SaveChanges(); } }
public void SaveComment(Comment comment) { using (var context = new MainContext()) { UpdateEntity(context, comment); context.SaveChanges(); } }
public ActionResult Create(SampleViewModel model) { var entity = Mapper.Map<Sample>(model); var context = new MainContext(); context.Samples.Add(entity); context.SaveChanges(); return RedirectToAction("Index"); }
public ActionResult Edit(int id) { var context = new MainContext(); var sample = context.Samples.FirstOrDefault(s => s.Id == id); var model = Mapper.Map<SampleViewModel>(sample); model.Image.Width = 100; model.Image.Height = 100; return View(model); }
public ActionResult Edit(int id, SampleViewModel model) { var context = new MainContext(); var sample = context.Samples.FirstOrDefault(s => s.Id == id); sample = Mapper.Map(model, sample); context.SaveChanges(); return RedirectToAction("Index"); }
public void DeleteTournament(int id) { var tournament = GetTournament(id); using (var context = new MainContext()) { context.Entry(tournament).State = EntityState.Deleted; context.SaveChanges(); } }
public void DeleteUser(int id) { var user = GetUser(id); using (var context = new MainContext()) { context.Entry(user).State = EntityState.Deleted; context.SaveChanges(); } }
public virtual void A_SetUpCountryRepo() { using (var context = new MainContext()) { //Get the country. var myCountryRepo = new Repository<Country>(context); MyCountryTest = myCountryRepo.GetById(1); } }
public IEnumerable<User> GetAllUsers() { using (var context = new MainContext()) { //извините за эту тупость. кто может - решите. var users = context.Users.Include("UserStats").ToList(); var list = users.OrderByDescending(x => x.LastUserStats.Elo).ToList(); return list; } }
protected override void InternalLoad(MainContext context) { DateTypeList = CreateDateTypeList(); var type = Properties.Settings.Default["ChartDateType"] as ETargetDateType?; if (type != null) { dateType = type.Value; date = Properties.Settings.Default.ChartDate; } else { dateType = ETargetDateType.Current; date = DateTime.Now; } }
public virtual void Dispose() { //Clean the database using (var context = new MainContext()) { var myRepo = new Repository<Address>(context); //Get the Address to be removed. MyNewAddress = myRepo.Query(s => s.AddressLine1 == MyNewAddress.AddressLine1).FirstOrDefault(); if (myRepo.GetAll().Any()) { myRepo.Remove(MyNewAddress); myRepo.Save(); } } }
public void Insert() { using (var context = new MainContext()) { var myRepo = new Repository<Customer>(context); TotalCustomersBeforeTestRuns = myRepo.GetAll().Count(); //Have to provide a valid name and e-mail address MyNewCustomer = new Customer {Name = "Rafael", Email = "*****@*****.**"}; myRepo.Add(MyNewCustomer); myRepo.Save(); TotalOfClientsAfterTheTestRuns = myRepo.GetAll().Count(); //Assert that the number of clients increase by 1 Assert.AreEqual(TotalCustomersBeforeTestRuns + 1, TotalOfClientsAfterTheTestRuns); } }
protected override void InternalSave(MainContext context, TransactionScope transaction) { var weekDay = Date.DayOfWeek == DayOfWeek.Saturday || Date.DayOfWeek == DayOfWeek.Sunday; var updateKey = IsHoliday != weekDay; int id = context.WorkCalendar.Where(c => c.Day == Date).Select(c => c.Id).FirstOrDefault(); if (updateKey) { if (id <= 0) { var item = context.WorkCalendar.Create(); item.Day = Date; item.IsHoliday = IsHoliday; context.WorkCalendar.Add(item); } else context.WorkCalendar.Where(c => c.Id == id).Update(c => new WorkCalendar() { IsHoliday = IsHoliday }); CalendarDayConverter.UpdateItem(Date, IsHoliday); } else if (id > 0) { context.WorkCalendar.Where(c => c.Id == id).Delete(); CalendarDayConverter.DeleteItem(Date); } }
public void Update() { const string newName = "Rafael Fernandes"; using (var context = new MainContext()) { var myRepo = new Repository<Core.Customer>(context); var firstClientInTheDb = myRepo.GetAll().FirstOrDefault(); if (firstClientInTheDb != null) { //Find an entity to be updated. var myClient = myRepo.GetById(firstClientInTheDb.Id); myClient.Name = newName; myRepo.Update(myClient); myRepo.Save(); //Compare if the name changed in the database Assert.AreEqual(myRepo.GetById(firstClientInTheDb.Id).Name, newName); } } }
protected override void InternalLoad(MainContext context) { if (ForEdit) { Name = Item.Name; Coeff = Item.Coeff.ToString(); Color = Item.Color; } else Coeff = "1"; }
public StudentsClassRepository(MainContext dbContext) : base(dbContext) { }
public PhotoTransmitsRepository(MainContext context, ILoggerFactory loggerFactory) { Context = context; Logger = loggerFactory.CreateLogger(nameof(PhotoTransmitsRepository)); }
protected virtual void InternalSave(MainContext context, TransactionScope transaction) { throw new NotImplementedException(); }
public PostController(MainContext context) { dbContext = context; }
protected void uxAddButton_Click(object sender, EventArgs e) { MainContext.RedirectMainControl("ContentAdd.ascx", ""); }
public ContatoRepository(MainContext mainContext) : base(mainContext) { }
public CompanyController() { _db = new MainContext(); }
public bool CriarOuAlteraFormularioTable() { var context = new MainContext(); var json = @"{ 'name': 'decisionpadrao', 'title': 'DecisionPadrao', 'internal': false, 'fields': [ { 'name': 'nf', 'type': 'Integer', 'label': 'NF', 'size': '100%', 'order': 0, 'required': false, 'validationRegex': '', 'mask': '0', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'valor_solicitado_r', 'type': 'Double', 'label': 'Valor Solicitado R$', 'size': '100%', 'order': 1, 'required': false, 'validationRegex': '', 'mask': '2', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'valor_aprovado_r', 'type': 'Double', 'label': 'Valor Aprovado (R$)', 'size': '100%', 'order': 2, 'required': false, 'validationRegex': '', 'mask': '2', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'observacao', 'type': 'String', 'label': 'Observacao', 'size': '100%', 'order': 3, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo01', 'type': 'String', 'label': 'CAMPO01', 'size': '50%', 'order': 4, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo02', 'type': 'String', 'label': 'CAMPO02', 'size': '50%', 'order': 5, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo03', 'type': 'String', 'label': 'CAMPO03', 'size': '50%', 'order': 6, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo04', 'type': 'String', 'label': 'CAMPO04', 'size': '100%', 'order': 7, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo05', 'type': 'String', 'label': 'CAMPO05', 'size': '50%', 'order': 8, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo06', 'type': 'String', 'label': 'CAMPO06', 'size': '50%', 'order': 9, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo07', 'type': 'String', 'label': 'CAMPO07', 'size': '50%', 'order': 10, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo08', 'type': 'String', 'label': 'CAMPO08', 'size': '50%', 'order': 11, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo09', 'type': 'String', 'label': 'CAMPO09', 'size': '50%', 'order': 12, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo10', 'type': 'String', 'label': 'CAMPO10', 'size': '50%', 'order': 13, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo11', 'type': 'String', 'label': 'CAMPO11', 'size': '50%', 'order': 14, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo12', 'type': 'String', 'label': 'CAMPO12', 'size': '50%', 'order': 15, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo13', 'type': 'String', 'label': 'CAMPO13', 'size': '50%', 'order': 16, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo14', 'type': 'String', 'label': 'CAMPO14', 'size': '50%', 'order': 17, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo15', 'type': 'String', 'label': 'CAMPO15', 'size': '50%', 'order': 18, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo16', 'type': 'String', 'label': 'CAMPO15', 'size': '50%', 'order': 18, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo17', 'type': 'String', 'label': 'CAMPO15', 'size': '50%', 'order': 18, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false }, { 'name': 'campo18', 'type': 'String', 'label': 'CAMPO15', 'size': '50%', 'order': 18, 'required': false, 'validationRegex': '', 'mask': '', 'appWorkflow': true, 'isBreakLine': false } ] }"; var tableJson = JsonConvert.DeserializeObject <Formulario>(json); var schemaProvider = context.DataProvider.GetSchemaProvider(); var schema = schemaProvider.GetSchema(context, new GetSchemaOptions()); var tableScheme = schema.Tables.Where(c => c.TableName == tableJson.Name).FirstOrDefault(); var comandoRealizadoComSucesso = true; if (tableScheme == null) { TableClass tableClass = new TableClass(tableJson.Name, tableJson.Fields); var createTable = tableClass.GenerateScript(); comandoRealizadoComSucesso = context.Execute(createTable) > 0; } else { List <Campos> camposNovos = new List <Campos>(); foreach (var field in tableJson.Fields) { if (!tableScheme.Columns.Where(c => c.ColumnName == field.Name).Any()) { camposNovos.Add(field); } } if (camposNovos.Count > 0) { var AltersTable = new AlterTable(tableJson.Name, camposNovos).GenerateScript(); comandoRealizadoComSucesso = context.Execute(AltersTable) > 0; } } return(comandoRealizadoComSucesso); }
public LinkService(MainContext mainContext, UserVM actor) { FillData(mainContext, actor); }
public CategoriesController(MainContext context, IHostingEnvironment hostingEnvironment) { _context = context; this.hostingEnvironment = hostingEnvironment; }
public CityController() { _db = new MainContext(); }
public ConnectionController(MainContext context) { _context = context; }
static void Main(string[] args) { while (true) { IReaderController reader = new ReaderController(); IWebScannerController scaner = new WebScannerController(); IWriterController writerController = new WriterController(); var db = new MainContext(); var savedLinks = reader.ReadLinksFromDB(); // reader.ReadLinks(); var linkDao = new LinksDao(); foreach (var savedLink in savedLinks) { Console.WriteLine(savedLink); var links = scaner.FindLinks(savedLink, savedLink); writerController.WriteLinks(links); //TODO - Read new links //TODO Mails var mails = scaner.FindMails(savedLink, savedLink); writerController.WriteEmails(mails); foreach (var link in links) { mails = scaner.FindMails(link, ""); writerController.WriteEmails(mails); } ////TODO H1 var h1Texts = scaner.FindH1(savedLink, savedLink); writerController.WriteH1(h1Texts, savedLink); //foreach (var link in links) //{ // h1Texts = scaner.FindH1(link, ""); // writerController.WriteH1(mails); //} //Save Link as Scanned var scannedLink = new Link(savedLink, true); linkDao.SetScanned(scannedLink, true); } //var links = scaner.FindLinks("https://www.xo.gr/dir-az/A/Antallaktika-Aftokiniton-Eidi-kai-Axesouar/", "https://www.xo.gr"); //writerController.WriteLinks(links); ////TODO - Read new links ////TODO Mails //var mails = scaner.FindMails("https://www.xo.gr/dir-az/A/Antallaktika-Aftokiniton-Eidi-kai-Axesouar/", "https://www.xo.gr"); //writerController.WriteEmails(mails); //foreach(var link in links) //{ // mails = scaner.FindMails(link, ""); // writerController.WriteEmails(mails); //} } }
public AccountRepository(MainContext context) => m_context = context;
public MainWindow() { try { Core.UpdateVersion.LicenseIsActive = ReadLicence(); if (Core.UpdateVersion.LicenseIsActive == UpdateVersion.LicenceActivation.enabled) { DataContext = new MainContext(); InitializeComponent(); this.Title = (!Core.UpdateVersion.License.ExtranetOnly) ? "Prestaconnect pour Sage " + Core.UpdateVersion.SageFolder(Core.UpdateVersion.CurrentSageVersion) + " et Prestashop " + Core.UpdateVersion.PrestaShopFolder(Core.UpdateVersion.CurrentPrestaShopVersion) : "Module Extranet pour Sage " + Core.UpdateVersion.SageFolder(Core.UpdateVersion.CurrentSageVersion); if (Core.UpdateVersion.License.ExtranetOnly) { Core.Global.GetConfig().UpdateConfigBtoCBtoB(false, true); Core.Global.GetConfig().UpdateConfigMailActive(true); } this.SyncSupply(); String[] Args = Environment.GetCommandLineArgs(); if (Args.Length > 1) { Core.Global.UILaunch = false; this.ExecWithArgs(Args); } else { Core.Global.UILaunch = true; #region Theme Model.Local.ConfigRepository ConfigRepository = new Model.Local.ConfigRepository(); if (ConfigRepository.ExistName(Core.Global.ConfigTheme)) { Model.Local.Config Config = ConfigRepository.ReadName(Core.Global.ConfigTheme); foreach (ComboBoxItem ComboBoxItem in this.ComboBoxTheme.Items) { if (ComboBoxItem.Content.ToString() == Config.Con_Value) { this.ComboBoxTheme.SelectedItem = ComboBoxItem; break; } } } #endregion #region Infos Prestashop Model.Prestashop.PsConfigurationRepository PsConfigurationRepository = new Model.Prestashop.PsConfigurationRepository(); Model.Prestashop.PsConfiguration PsConfiguration = new Model.Prestashop.PsConfiguration(); PsConfiguration = new Model.Prestashop.PsConfiguration(); Model.Prestashop.PsShopURLRepository PsShopURLRepository = new Model.Prestashop.PsShopURLRepository(); Model.Prestashop.PsShopURL PsShopURL = PsShopURLRepository.ReadShopId(Global.CurrentShop.IDShop); //TODO vérification du domaine pour création hyperlien if (PsShopURL != null) { Global.URL_Prestashop = String.Format("http://{0}{1}{2}", PsShopURL.Domain, PsShopURL.PhysicalUri, PsShopURL.VirtualUri); while (Global.URL_Prestashop.EndsWith("/")) { Global.URL_Prestashop = Global.URL_Prestashop.Substring(0, Global.URL_Prestashop.Length - 1); } string logoUri = string.Empty; //try //{ // if (PsConfigurationRepository.ExistNameShop(Core.Global.PrestaShopLogo)) // { // logoUri = "img/" + PsConfigurationRepository.ReadNameShop(Core.Global.PrestaShopLogo).Value; // } //} //catch (Exception) { if (PsConfigurationRepository.ExistName(Core.Global.PrestaShopLogo)) { logoUri = "/img/" + PsConfigurationRepository.ReadName(Core.Global.PrestaShopLogo).Value; } else if (PsConfigurationRepository.ExistNameShop(Core.Global.PrestaShopLogo)) { logoUri = "/img/" + PsConfigurationRepository.ReadNameShop(Core.Global.PrestaShopLogo).Value; } else { logoUri = (PsShopURL.IDShop == 1) ? "/img/logo.jpg" : "/img/logo-" + PsShopURL.IDShop + ".jpg"; } } LabelPrestashopLink.NavigateUri = new Uri(Global.URL_Prestashop); LabelPrestashopLink.ToolTip = Global.URL_Prestashop; ImagePrestashopLogo.Source = new BitmapImage(new Uri(Global.URL_Prestashop + logoUri)); ImagePrestashopLogo.ToolTip = Global.URL_Prestashop; } #endregion #region liste commandes/clients this.LoadOrdersAndCustomers(); #endregion this.ReadVersion(); this.ActiveSupplierMenuItem(); if (Core.Global.GetConfig().UIMaximizeWindow) { this.WindowState = System.Windows.WindowState.Maximized; Core.Temp.Current = System.Windows.WindowState.Maximized; } } } } catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); } }
protected RepositoryBase(MainContext context) { _context = context; _dbSet = DataContext.Set <T>(); }
public MainPage(MainContext context) { InitializeComponent(); BindingContext = new MainPageViewModel(context); }
public EFUnitOfWork(string connectionString) { db = new MainContext(connectionString); }
public EmployeeRepository(MainContext MainContext) : base(MainContext) { }
private string GetResponseString(HttpListenerRequest Request) { string rowUrl = Request.RawUrl; String ResponseString = ""; StreamWriter SW = new StreamWriter(MainContext.logfile, true); SW.WriteLine(DateTime.Now.ToString() + "; " + rowUrl); SW.Close(); if (rowUrl == "/") { ResponseString = MainPage.getPage(); MainContext.increaseStartPage(); } else if (rowUrl == "/startQuize") { UserData user = UserCasheTools.getNewUser(); ResponseString = WordPage.GetPage(user, 1); } else if (rowUrl.IndexOf("/quize") > -1) { string sid = Request.QueryString["sid"]; int page = int.Parse(Request.QueryString["page"]); string ansver = Request.QueryString["ansver"]; UserData user = UserCasheTools.getUser(sid); if (user == null) { throw new PageNotFoundExeption(); } if (user.quizSet.Count >= page) { Quiz q = user.quizSet[page - 1]; if ((ansver != null) && (q.ansvers.Count == 0)) { int numAnsver = int.Parse(ansver); if (q.ansvers.Where(x => x == numAnsver).ToList().Count == 0) { q.ansvers.Add(numAnsver); } } } ResponseString = WordPage.GetPage(user, page); } else if (rowUrl.IndexOf("/result") > -1) { string sid = Request.QueryString["sid"]; UserData user = UserCasheTools.getUser(sid); if (user == null) { throw new PageNotFoundExeption(); } ResponseString = ResultPage.GetPage(user); MainContext.increaseEndPage(); } else if (rowUrl.IndexOf("/stat") > -1) { ResponseString = "start: " + MainContext.startPage.ToString() + ", end: " + MainContext.endPage.ToString() + ", fb posts: " + MainContext.endFB.ToString(); } else if (rowUrl.IndexOf("/fb") > -1) { MainContext.endFB++; ResponseString = "СПАСИБО!"; } else { throw new PageNotFoundExeption(); } return(ResponseString); }
protected virtual void InternalLoad(MainContext context) { throw new NotImplementedException(); }
public SponsorController(MainContext context) { _context = context; }
protected DisposableContainer ConditialNewContext(out MainContext context) { if (connectNeed) context = Context == null ? CommonHelper.CreateMainContext() : Context; else context = null; var result = new DisposableContainer(); result.DisposeNeed = connectNeed && Context == null; result.Object = context; return result; }
public DeviceActionsRepository(MainContext context, ILoggerFactory loggerFactory) { Context = context; Logger = loggerFactory.CreateLogger(nameof(DeviceActionsRepository)); }
public HomeController(MainContext context, IConfiguration configuration) { _context = context; _configuration = configuration; }
public GuardiansController(MainContext context) { _context = context; }
protected void uxCancelButton_Click(object sender, EventArgs e) { MainContext.RedirectMainControl("ContentMenuItemList.ascx"); }
public BookingHelperController(IConfiguration config, MainContext mainContext) { _mainContext = mainContext; _config = config; _urlMain = config["UrlApi:Maint"]; }
protected override void InternalSave(MainContext context, TransactionScope transaction) { Item.Name = Name; Item.Coeff = double.Parse(Coeff); Item.Color = Color.Value; }
public ProjectService() { _db = new MainContext(); }
public ExploreTrailsScreen(MainContext context) { InitializeComponent(); BindingContext = new ExploreTrailsScreenViewModel(context); }
public ProjectService(MainContext db) { _db = db; }
public bool SalvaConteudoFormulario() { var context = new MainContext(); var comandoRealizadoComSucesso = true; var json = @"{ '@odata.context': '$metadata#decisionpadrao', 'value': [ { 'id': 1, 'processInstanceId': 73, 'nf': 1233, 'valor_solicitado_r': 25212.55, 'valor_aprovado_r': null, 'observacao': '22222', 'campo01': null, 'campo02': null, 'campo03': null, 'campo04': null, 'campo05': null, 'campo06': null, 'campo07': null, 'campo08': null, 'campo09': null, 'campo10': null, 'campo11': null, 'campo12': null, 'campo13': null, 'campo14': null, 'campo15': null }, { 'id': 2, 'processInstanceId': 75, 'nf': 1233, 'valor_solicitado_r': 111421.11, 'valor_aprovado_r': null, 'observacao': 'jkhjkhkjhkjhk', 'campo01': null, 'campo02': null, 'campo03': null, 'campo04': null, 'campo05': null, 'campo06': null, 'campo07': null, 'campo08': null, 'campo09': null, 'campo10': null, 'campo11': null, 'campo12': null, 'campo13': null, 'campo14': null, 'campo15': null }, { 'id': 3, 'processInstanceId': 79, 'nf': 111111, 'valor_solicitado_r': 10000, 'valor_aprovado_r': 1.11, 'observacao': 'teste Ederson', 'campo01': null, 'campo02': null, 'campo03': null, 'campo04': null, 'campo05': null, 'campo06': null, 'campo07': null, 'campo08': null, 'campo09': null, 'campo10': null, 'campo11': null, 'campo12': null, 'campo13': null, 'campo14': null, 'campo15': null }, { 'id': 4, 'processInstanceId': 84, 'nf': 1233, 'valor_solicitado_r': 21215.45, 'valor_aprovado_r': null, 'observacao': '12121231', 'campo01': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo02': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo03': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo04': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo05': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo06': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo07': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo08': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo09': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo10': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo11': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo12': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo13': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo14': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo15': 'UMa Nova CHANCE - GRANDES Oportunidades' }, { 'id': 5, 'processInstanceId': 102, 'nf': 0, 'valor_solicitado_r': 1.11, 'valor_aprovado_r': null, 'observacao': 'dasd', 'campo01': null, 'campo02': null, 'campo03': null, 'campo04': null, 'campo05': null, 'campo06': null, 'campo07': null, 'campo08': null, 'campo09': null, 'campo10': null, 'campo11': null, 'campo12': null, 'campo13': null, 'campo14': null, 'campo15': null }, { 'id': 6, 'processInstanceId': 200, 'nf': 1233, 'valor_solicitado_r': 21215.45, 'valor_aprovado_r': null, 'observacao': '22222', 'campo01': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo02': '1121', 'campo03': '1212', 'campo04': '12121', 'campo05': null, 'campo06': null, 'campo07': null, 'campo08': null, 'campo09': null, 'campo10': null, 'campo11': null, 'campo12': null, 'campo13': null, 'campo14': null, 'campo15': null }, { 'id': 7, 'processInstanceId': 203, 'nf': 1233, 'valor_solicitado_r': 21215.45, 'valor_aprovado_r': 30000, 'observacao': '22222', 'campo01': 'UMa Nova CHANCE - GRANDES Oportunidades', 'campo02': '1121', 'campo03': null, 'campo04': '12121', 'campo05': '112454', 'campo06': null, 'campo07': null, 'campo08': null, 'campo09': '5454', 'campo10': null, 'campo11': '45645', 'campo12': null, 'campo13': null, 'campo14': null, 'campo15': null } ] }"; var dictionario = deserializeToDictionary(json); var insertScript = new Insert("decisionpadrao", dictionario); var scriptInsert = insertScript.GenerateScript(); context.Execute(scriptInsert); return(comandoRealizadoComSucesso); }
private void FillData(MainContext mainContext, UserVM actor) { this.mainContext = mainContext; this.Actor = actor; this.userLanguageService = new UserLanguageService(mainContext, actor); }