/// <summary> /// 数据绑定 /// </summary> protected void BindData() { sqUserName = "******" + UserName.Text.Trim() + "%"; sqLogin_Name = "%" + Login_Name.Text.Trim() + "%"; sqDeptCode = this.Dept_Code.SelectedValue + "%"; SearchStates(); int iCurPageNo = WPager1.CurrentPageIndex; sSql = @"WITH OrderedOrders AS (select ROW_NUMBER() OVER (ORDER BY Uid) AS 'RowNumber', Uid, Login_name, UserName, Password, Mobile, Contact, Dept, Dept_code, Position_name, Status, Addtime, Email, TaskText, Purview, DeptPurview, Sex, Duty, LoginStatus, DtLastLogin, t_group.Name As GroupName from t_sysuser Left join t_group on t_group.SeqId = t_sysuser.Dept_code Where UserName Like @P3 And Login_Name Like @P4 And Dept_code Like @P5) SELECT * FROM OrderedOrders Where RowNumber BETWEEN @p1 AND @p2; ; Select Count(Uid) From t_sysuser Where UserName Like @P3 And Login_Name Like @P4 And Dept_code Like @P5 "; object[] arrParas = new object[5] { (iCurPageNo - 1) * WPager1.PageSize + 1, iCurPageNo *WPager1.PageSize, sqUserName, sqLogin_Name, sqDeptCode }; _ComData = new CommData(sConnOa); DataSet _ds = _ComData.GetDs(sSql, arrParas); _ComData.CloseConn(); GridView1.DataSource = _ds.Tables[0]; WPager1.RecordCount = Convert.ToInt32((_ds.Tables[1].Rows[0][0])); GridView1.DataBind(); }
public bool SendData(uint service, uint datatype, G2Packet packet) { CommData data = new CommData(service, datatype, packet.Encode(Network.Protocol)); Core.ServiceBandwidth[service].OutPerSec += data.Data.Length; return(SendPacket(data)); }
/// <summary> /// ���ݴ������. /// </summary> /// <param name="client">TcpClient�� ʵ��</param> /// <param name="s">�ڴ�������</param> public void Deal(CommData cd) { cd.Data.Position = 0; if (OnDeal(cd) == false) return; if (next != null) { next.Deal(cd); } return; }
protected void RowCmd(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Detelte") { sSql = "Delete from t_sysuser Where Uid = @P1"; string[] arrParas = new string[1] { (string)e.CommandArgument }; _ComData = new CommData(sConnOa); _ComData.ExecuteNonQuery(sSql, arrParas); _ComData.CloseConn(); BindData(); } }
public void ReceiveData(G2ReceivedPacket embeddedPacket) { // 0 is network packet? CommData data = CommData.Decode(embeddedPacket); if (data == null) { return; } if (Core.ServiceBandwidth.ContainsKey(data.Service)) { Core.ServiceBandwidth[data.Service].InPerSec += data.Data.Length; } if (RudpControl.SessionData.Contains(data.Service, data.DataType)) { RudpControl.SessionData[data.Service, data.DataType].Invoke(this, data.Data); } }
public void SendUnreliable(uint service, uint type, G2Packet packet) { // fast, secure, out-of-band method of sending data // useful for things like VOIP during a file transfer with host // data has got to go out asap, no matter what // check rudp socket is connected if (Status != SessionStatus.Active) { return; } // add to special rudp packet RudpPacket rudp = new RudpPacket(); rudp.SenderID = Network.Local.UserID; rudp.SenderClient = Network.Local.ClientID; rudp.TargetID = UserID; rudp.TargetClient = ClientID; rudp.PeerID = Comm.RemotePeerID; rudp.PacketType = RudpPacketType.Unreliable; CommData data = new CommData(service, type, packet.Encode(Network.Protocol)); rudp.Payload = Utilities.EncryptBytes(data.Encode(Network.Protocol), OutboundEnc.Key); // send Comm.SendPacket(rudp, Comm.PrimaryAddress); // stats Core.ServiceBandwidth[service].OutPerSec += data.Data.Length; PacketLogEntry logEntry = new PacketLogEntry(Core.TimeNow, TransportProtocol.Rudp, DirectionType.Out, Comm.PrimaryAddress.Address, rudp.Payload); Core.Network.LogPacket(logEntry); }
public ListViewItem PackettoItem(PacketLogEntry logEntry) { // hash, protocol, direction, address, type, size string hash = Utilities.BytestoHex(sha.ComputeHash(logEntry.Data), 0, 2, false); string protocol = logEntry.Protocol.ToString(); // Network - Search / Search Req / Store ... - Component // Comm - Data / Ack / Syn // Rudp - Type - Component string name = "?"; G2Header root = new G2Header(logEntry.Data); if (G2Protocol.ReadPacket(root)) { if (logEntry.Protocol == TransportProtocol.Rudp) { name = TransportProtocol.Rudp.ToString() + " - "; name += GetVariableName(typeof(CommPacket), root.Name); if (root.Name == CommPacket.Data) { CommData data = CommData.Decode(root); name += " - " + Network.Core.GetServiceName(data.Service); } } else { name = GetVariableName(typeof(RootPacket), root.Name) + " - "; if (root.Name == RootPacket.Comm) { RudpPacket commPacket = RudpPacket.Decode(root); name += GetVariableName(typeof(RudpPacketType), commPacket.PacketType); } if (root.Name == RootPacket.Network) { NetworkPacket netPacket = NetworkPacket.Decode(root); G2Header internalRoot = new G2Header(netPacket.InternalData); if (G2Protocol.ReadPacket(internalRoot)) { name += GetVariableName(typeof(NetworkPacket), internalRoot.Name); uint id = 0; G2ReceivedPacket wrap = new G2ReceivedPacket(); wrap.Root = internalRoot; // search request / search acks / stores have component types if (internalRoot.Name == NetworkPacket.SearchRequest) { SearchReq req = SearchReq.Decode(wrap); id = req.Service; } if (internalRoot.Name == NetworkPacket.SearchAck) { SearchAck ack = SearchAck.Decode(wrap); id = ack.Service; } if (internalRoot.Name == NetworkPacket.StoreRequest) { StoreReq store = StoreReq.Decode(wrap); id = store.Service; } if (id != 0) { name += " - " + Network.Core.GetServiceName(id); // GetVariableName(typeof(ServiceID), id); } } } } } string time = logEntry.Time.ToString("HH:mm:ss:ff"); string address = (logEntry.Address == null) ? "Broadcast" : logEntry.Address.ToString(); return(new PacketListViewItem(logEntry, new string[] { time, protocol, address, name, logEntry.Data.Length.ToString(), hash }, logEntry.Direction == DirectionType.In)); }
/// <summary> /// ���ݴ������ط���. /// </summary> /// <param name="client">TcpClient�� ʵ��</param> /// <param name="s">�ڴ�������</param> /// <returns>������,�����ϣ������Ĵ��������������ݣ���false,����true;</returns> public virtual bool OnDeal(CommData cd) { return true; }