public IEnumerable <User> Get()
 {
     using (UserConn entities = new UserConn())
     {
         return(entities.Users.ToList());
     }
 }
示例#2
0
 public FormTableInfo(TreeNode node)
 {
     this.node = node;
     this.conn = node.Parent.Parent.Tag as UserConn;
     this.table = node.Tag as IDataTable;
     InitializeComponent();
 }
示例#3
0
 public FormTableInfo(TreeNode node)
 {
     this.node  = node;
     this.conn  = node.Parent.Parent.Tag as UserConn;
     this.table = node.Tag as IDataTable;
     InitializeComponent();
 }
示例#4
0
        private DataSchema(UserConn conn)
        {
            m_conn       = conn;
            m_initStatus = DataSchemaInitStatus.Initializing;
            m_initError  = String.Empty;

            ThreadPoolX.QueueUserWorkItem(x => InitDataSchema());
        }
示例#5
0
 /// <summary>
 /// 根据用户连接获取到数据库架构
 /// </summary>
 /// <param name="conn"></param>
 /// <returns></returns>
 public static DataSchema GetInstance(UserConn conn)
 {
     if (!s_dataSchemaDict.ContainsKey(conn))
     {
         s_dataSchemaDict.Add(conn, new DataSchema(conn));
     }
     return(s_dataSchemaDict[conn]);
 }
示例#6
0
文件: DataSchema.cs 项目: g992com/esb
        private DataSchema(UserConn conn)
        {
            m_conn = conn;
            m_initStatus = DataSchemaInitStatus.Initializing;
            m_initError = String.Empty;

            ThreadPoolX.QueueUserWorkItem(x => InitDataSchema());
        }
        public IList <User> GetManager()
        {
            using (var userContext = new UserConn())
            {
                var data = userContext.Users.SqlQuery("[dbo].[allManagers]").ToList();

                return(data);
            }
        }
        // GET: api/Profile
        //Get all customers using role
        public IList <User> GetUsers()
        {
            using (var userContext = new UserConn())
            {
                var data = userContext.Users.SqlQuery("[dbo].[allCustomers]").ToList();

                return(data);
            }
            // return db.Users;
        }
示例#9
0
        /// <summary>
        /// 工具栏-移除数据库连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btiRemoveConn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UserConn conn = trvDatabase.SelectedNode.Tag as UserConn;

            if (conn != null)
            {
                if (XtraMessageBox.Show(this, "您确定要移除此连接吗?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    trvDatabase.Nodes.Remove(trvDatabase.SelectedNode);
                    conn.Delete();
                }
            }
        }
示例#10
0
        /// <summary>
        /// 增加一个数据库连接
        /// </summary>
        /// <param name="databaseConn"></param>
        public void AddConn(UserConn conn)
        {
            Database databaseConn = conn.Database;
            TreeNode nodeTable, nodeView;
            TreeNode nodeDatabase = new TreeNode(databaseConn.ConnName, 7, 7, new TreeNode[]{
                nodeTable = new TreeNode("数据表[加载中...]", 6, 6),
                nodeView = new TreeNode("视图[加载中...]", 6, 6)
            });
            nodeDatabase.Tag = conn;
            trvDatabase.Nodes.Add(nodeDatabase);

            DataSchema.InitDataSchema(conn);
        }
示例#11
0
        /// <summary>
        /// 增加一个数据库连接
        /// </summary>
        /// <param name="databaseConn"></param>
        public void AddConn(UserConn conn)
        {
            Database databaseConn = conn.Database;
            TreeNode nodeTable, nodeView;
            TreeNode nodeDatabase = new TreeNode(databaseConn.ConnName, 7, 7, new TreeNode[] {
                nodeTable = new TreeNode("数据表[加载中...]", 6, 6),
                nodeView  = new TreeNode("视图[加载中...]", 6, 6)
            });

            nodeDatabase.Tag = conn;
            trvDatabase.Nodes.Add(nodeDatabase);

            DataSchema.InitDataSchema(conn);
        }
示例#12
0
        /// <summary>
        /// 加载表或者视图数据
        /// </summary>
        /// <param name="curNode"></param>
        private void NodeTableOrViewClick(TreeNode curNode, Boolean isView)
        {
            //--如果数据还在加载,则无需任何处理
            if (!curNode.Text.Contains("加载中..."))
            {
                String   connName = curNode.Parent.Text;
                UserConn conn     = UserConn.FindByUserAndConnName(CurrentUser.UserInfo.OID, connName);

                DAL.AddConnStr(connName, conn.ConnString, null, conn.Database.Provider);
                List <IDataTable> lstTables = DAL.Create(connName).Tables.FindAll(x => x.IsView == isView);
                curNode.Tag = lstTables;

                LoadTableOrViewNodes(curNode, lstTables);
            }
        }
示例#13
0
文件: FormTable.cs 项目: xlfj5211/esb
        private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
        {
            if (e.Page == tabDataEntity)
            {
                List <IDataTable> lstTable   = BindingNode.Parent.Tag as List <IDataTable>;
                UserConn          conn       = BindingNode.Parent.Parent.Tag as UserConn;
                String[]          sourceFile = CodeGen.Render(table.Name, lstTable, new XConfig(XConfig.TEMPLATE_ENTITY_DATA, conn.Database.DatabaseName));

                this.txtDataEntity.Text = sourceFile[0];
            }
            else if (e.Page == tabBizEntity)
            {
                List <IDataTable> lstTable   = BindingNode.Parent.Tag as List <IDataTable>;
                UserConn          conn       = BindingNode.Parent.Parent.Tag as UserConn;
                String[]          sourceFile = CodeGen.Render(table.Name, lstTable, new XConfig(XConfig.TEMPLATE_ENTITY_BIZ, conn.Database.DatabaseName));

                this.txtBizEntity.Text = sourceFile[0];
            }
        }
示例#14
0
        /// <summary>
        /// 点击数据库节点时检测无效的数据库连接
        /// </summary>
        /// <param name="curNode"></param>
        private void NodeDatabaseClick(TreeNode curNode)
        {
            UserConn conn = curNode.Tag as UserConn;

            if (curNode.IsExpanded)
            {
                this.Cursor = Cursors.WaitCursor;
                try
                {
                    DataSchema dataSchema = DataSchema.GetInstance(conn);

                    //--如果数据库架构初始化完成,则更新数据表或则视图节点
                    if (dataSchema.InitStatus == DataSchemaInitStatus.Initialized)
                    {
                        UpdateNodeText(curNode, dataSchema.TableCount, dataSchema.ViewCount);
                    }
                    else //--如果数据库架构没有初始化完成则订阅其完成事件,用以更新数据表或视图节点
                    {
                        dataSchema.AddStatusChangeHandler(new EventHandler <StatusChangeEventArgs>((sender, e) =>
                        {
                            this.Invoke(new DelegateUpdateNodeText(UpdateNodeText), curNode, dataSchema.TableCount, dataSchema.ViewCount);
                        }));
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("此连接已经失效将被移除,具体原因如下:\r\n" + ex.Message,
                                        "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    conn.Database.Delete();
                    conn.Delete();
                    trvDatabase.Nodes.Remove(curNode);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
示例#15
0
        /// <summary>
        /// 确定添加新连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (dxValidationProvider.Validate())
            {
                Database db = GetDatabaseFromUI();
                if (ConnectToDatabase(db))
                {
                    db = Database.FindByConnName(ConnName);
                    if (db == null)
                    {
                        db = GetDatabaseFromUI();
                        db.Insert();
                    }

                    UserConn conn = UserConn.FindByUserAndDatabaseID(CurrentUser.UserInfo.OID, db.OID);
                    if (conn == null)
                    {
                        conn = new UserConn()
                        {
                            OID        = Guid.NewGuid().ToString(),
                            UserID     = CurrentUser.UserInfo.OID,
                            DatabaseID = db.OID,
                            ConnString = db.ConnString
                        };
                        conn.Insert();

                        DatabaseExplorer.AddConn(conn);
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("此连接您已经添加过了!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
示例#16
0
        /// <summary>
        /// 确定添加新连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (dxValidationProvider.Validate())
            {
                Database db = GetDatabaseFromUI();
                if (ConnectToDatabase(db))
                {
                    db = Database.FindByConnName(ConnName);
                    if (db == null)
                    {
                        db = GetDatabaseFromUI();
                        db.Insert();
                    }

                    UserConn conn = UserConn.FindByUserAndDatabaseID(CurrentUser.UserInfo.OID, db.OID);
                    if (conn == null)
                    {
                        conn = new UserConn()
                        {
                            OID = Guid.NewGuid().ToString(),
                            UserID = CurrentUser.UserInfo.OID,
                            DatabaseID = db.OID,
                            ConnString = db.ConnString
                        };
                        conn.Insert();

                        DatabaseExplorer.AddConn(conn);
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("此连接您已经添加过了!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
 public void AddDebugLine(GameScreen s)
 {
     s.DebugDisp.AddLine("DebugMultiplayer", () =>
                         $"SERVER(Ping={ProxyPing.Value:0.0000} | Loss={ProxyPackageLossPerc * 100:00.00}% | State={ConnState} | Mode={Mode} | Packages={packageCount} (l={packageModSize}byte) | Ctr={msgIdWraps:00}:{msgId:000})\n" +
                         $"      (LagBehind={lagBehindTime} | SendFreq={SendFreq.Frequency:00.0} | UserPings=[{string.Join(",", UserConn.Take(SessionCapacity).Select(u => (u.InGamePing.Value*1000).ToString("F0")))}])\n" +
                         $"      (Packages[Out]={SendFreq.HistoryStr})\n" +
                         $"      (Packages[In]={RecieveFreq.HistoryStr})\n" +
                         $"      {_medium.DebugDisplayString}", this);
 }
示例#18
0
 /// <summary>
 /// 初始化数据库架构
 /// </summary>
 /// <param name="conn"></param>
 public static void InitDataSchema(UserConn conn)
 {
     GetInstance(conn);
 }
示例#19
0
 /// <summary>
 /// 判断架构中是否包含指定的连接
 /// </summary>
 /// <param name="conn"></param>
 /// <returns></returns>
 public static Boolean Contains(UserConn conn)
 {
     return(s_dataSchemaDict.ContainsKey(conn));
 }
示例#20
0
文件: DataSchema.cs 项目: g992com/esb
 /// <summary>
 /// 根据用户连接获取到数据库架构
 /// </summary>
 /// <param name="conn"></param>
 /// <returns></returns>
 public static DataSchema GetInstance(UserConn conn)
 {
     if (!s_dataSchemaDict.ContainsKey(conn))
     {
         s_dataSchemaDict.Add(conn, new DataSchema(conn));
     }
     return s_dataSchemaDict[conn];
 }
示例#21
0
文件: DataSchema.cs 项目: g992com/esb
 /// <summary>
 /// 判断架构中是否包含指定的连接
 /// </summary>
 /// <param name="conn"></param>
 /// <returns></returns>
 public static Boolean Contains(UserConn conn)
 {
     return s_dataSchemaDict.ContainsKey(conn);
 }
示例#22
0
文件: DataSchema.cs 项目: g992com/esb
 /// <summary>
 /// 初始化数据库架构
 /// </summary>
 /// <param name="conn"></param>
 public static void InitDataSchema(UserConn conn)
 {
     GetInstance(conn);
 }