Example #1
0
 public void TreeInit(TreeView tv)
 {
     tv.Nodes.Clear();
     using (var odbEntities = new DbTigerEntities())
     {
         // 1. Easy example but not very flexible
         //    Select all products without any constraints
         foreach (var union in odbEntities.unions)
         {
             var nod = new TreeNode(union.alias) {Tag = union.UnitId};
             //增加节点TAG属性
             tv.Nodes.Add(nod);
         }
      }
 }
Example #2
0
        /// <summary>
        /// Check the nikname and the password in the users list
        /// </summary>
        /// <param name="nikName"></param>
        /// <param name="password"></param>
        public static void DoLogin(string nikName, string password)
        {
            if (IsExistNikName(nikName))
              {
            if (_user.Password == HashString(password))
            {
              _loggedDefault = true;
            }
              }

              using (var context = new DbTigerEntities())
              {
              try
              {
                  logininfor c = context.logininfors
                                 .First(i => i.username == nikName);
                  if (c.Equals(null))
                  {
                      _loggedDb = false;
                  }
                  else
                  if (c.password == password)
                  {
                          Global.Currentuser = c.username;
                          _loggedDb = true;
                   }
                   else
                   {
                       _loggedDb = false;
                   }
              }
              catch (Exception)
              {

              }
              }

              Logged = (_loggedDefault || _loggedDb);
        }
Example #3
0
 public static IList<union> GetAllUnits()
 {
     var unitDB = new DbTigerEntities();
     IList<union> units = unitDB.unions.ToList();
     return units;
 }