コード例 #1
0
 /// <summary>
 /// Add a feed url to the system.
 /// </summary>
 /// <exception cref="UserMessageException">If the feed name already exists or the feed is invalid.</exception>
 /// <param name="name">Feed name</param>
 /// <param name="feed">Feed url</param>
 /// <param name="username">Feed Username(Null if none)</param>
 /// <param name="password">Feed Password(Null if none)</param>
 public void AddFeed(string name, string feed, string username, string password)
 {
     try {
         Log.InfoFormat("Validating feed for {0} {1}", name, feed);
         var result = SingletonContext.ValidateFeedUrl(feed, username, password);
         if (result != FeedValidationResult.Valid)
         {
             Log.InfoFormat("Feed not valid for {0} {1}: {2}", name, feed, result);
             throw new UserMessageException("{0} is not a valid feed. {1}", feed, result);
         }
         Log.InfoFormat("Checking if feed name already exists for {0} {1}", name, feed);
         if (FeedProvider.Instance.AllFeeds.Any(x => x.Name.ToLower() == name.ToLower()))
         {
             Log.InfoFormat("Feed name already exists for {0} {1}", name, feed);
             throw new UserMessageException("Feed name {0} already exists.", name);
         }
         Log.InfoFormat("Adding feed {0} {1}", name, feed);
         FeedProvider.Instance.AddFeed(new NamedUrl(name, feed, username, password));
         Log.InfoFormat("Firing update feed list {0} {1}", name, feed);
         this.FireOnUpdateFeedList();
         Log.InfoFormat("Feed {0} {1} added.", name, feed);
     } finally {
         Log.InfoFormat("Finished {0} {1}", name, feed);
     }
 }
コード例 #2
0
 private void ListarDados()
 {
     Context ctx = SingletonContext.GetInstance();
     {
         var consulta = ctx.Medicos;
         dtaProntuario.ItemsSource = consulta.ToList();
     }
 }
コード例 #3
0
        private void BtnSair_Click(object sender, RoutedEventArgs e)
        {
            frmLogin frmLogin = new frmLogin();

            SingletonContext.CloseContext();

            frmLogin.Show();
            this.Close();
        }
コード例 #4
0
        private void ListarDados()
        {
            Context ctx = SingletonContext.GetInstance();
            {
                var consulta = ctx.Pacientes;
                dtgPacientes.ItemsSource = consulta.ToList();

                //dtgPacientes.Columns[0].Header = "id";
                //dtgPacientes.Columns[1].Header = "Nome";
            }
        }
コード例 #5
0
ファイル: UserDal.cs プロジェクト: emresiimseek/MyBlog
        public List <UsersRoleses> GetUsersRoleses(User user)
        {
            MyBlogContext context = SingletonContext <MyBlogContext> .CreateContext();

            var result = from r in context.Users
                         join ur in context.UsersRole on r.Id equals ur.User.Id
                         select new UsersRoleses
            {
                Roles = ur.Role.RoleName
            };

            return(result.ToList());
        }
コード例 #6
0
ファイル: LoggerMssql.cs プロジェクト: arifkoken/log
        public bool DbyeKaydet(FullLogType data)
        {
            var logkaydi = new Logs_Nuget()
            {
                LogIcerik   = data.LogIcerik,
                LogTuru     = data.LogTuru.ToString(),
                LogKategori = data.LogKategori,
                UserEmail   = data.UserKey,
                TarihSaat   = data.TarihSaat
            };

            var db = SingletonContext.GetInstance();

            db.Entry(logkaydi).State = EntityState.Added;
            var sonuc = db.SaveChanges();

            return(sonuc != 0);
        }
コード例 #7
0
ファイル: LoggerMssql.cs プロジェクト: arifkoken/log
        public bool DbyeKaydet(WebApi.Data.FullLogType data)
        {
            var logkaydi = new Logs_Nuget()
            {
                ClientIpAdresi = data.ClientIpAdresi,
                FullUrl        = data.FullUrl,
                Controller     = data.Controller,
                Action         = data.Action,
                Parametre      = data.Parametre,
                LogIcerik      = data.LogIcerik,
                LogTuru        = data.LogTuru.ToString(),
                LogKategori    = data.LogKategori,
                UserEmail      = data.UserKey,
                TarihSaat      = data.TarihSaat
            };

            var db = SingletonContext.GetInstance();

            db.Entry(logkaydi).State = EntityState.Added;
            var sonuc = db.SaveChanges();

            return(sonuc != 0);
        }
コード例 #8
0
 static void Main(string[] args)
 {
     SingletonContext context = SingletonContext.ContextInstance;
     // Multi threat
     SingletonContext contextMulid = SingletonContext.ContextMultiThreatInstance;
 }