Exemplo n.º 1
0
    /// <summary>
    /// 获取一条AddNumber类信息
    /// </summary>
    /// <param name="AddNumberID">登录编号</param>
    /// <returns>一条AddNumber类记录</returns>
    public AddNumber GetAddNumber(string AddNumberID)
    {
        AddNumber addNumber = new AddNumber();
        Guide2Mgr g2Mgr     = new Guide2Mgr();
        GuideMgr  gMgr      = new GuideMgr();
        PersonMgr pMgr      = new PersonMgr();
        ClientMgr cMgr      = new ClientMgr();

        string    strSQL = "SELECT Top 1 * FROM Sys_AddNumber WHERE AddNumberID = " + AddNumberID;
        DataTable dt     = CMMgr.GetDataTable(strSQL);

        if (dt.Rows.Count > 0)
        {
            DataRow row = dt.Rows[0];
            addNumber.AddNumberID = int.Parse(row["AddNumberID"].ToString());
            addNumber.Title       = row["Title"].ToString();
            addNumber.Content     = row["Content"].ToString();
            addNumber.IsAudi      = row["IsAudi"].ToString();
            addNumber.Person      = pMgr.GetPerson(row["PersonID"].ToString());
            addNumber.Client      = cMgr.GetClient(row["ClientID"].ToString());
            addNumber.Guide2      = g2Mgr.GetGuide2(row["Guide2ID"].ToString());
            addNumber.Guide       = gMgr.GetGuide(row["GuideID"].ToString());
            addNumber.AddInt      = int.Parse(row["AddInt"].ToString());

            return(addNumber);
        }
        else
        {
            return(addNumber);
        }
    }
Exemplo n.º 2
0
    protected void dgList_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        ClientMgr sMgr = new ClientMgr();

        sMgr.DelClient(e.Item.Cells[0].Text);
        this.initForm();
    }
Exemplo n.º 3
0
    /// <summary>
    /// 获取一条Rewrite类信息
    /// </summary>
    /// <param name="RewriteID">登录编号</param>
    /// <returns>一条Rewrite类记录</returns>
    public Rewrite GetRewrite(string RewriteID)
    {
        Rewrite   rewrite = new Rewrite();
        ClientMgr g2Mgr   = new ClientMgr();
        PersonMgr pMgr    = new PersonMgr();

        string    strSQL = "SELECT Top 1 * FROM Sys_Rewrite WHERE RewriteID = " + RewriteID;
        DataTable dt     = CMMgr.GetDataTable(strSQL);

        if (dt.Rows.Count > 0)
        {
            DataRow row = dt.Rows[0];
            rewrite.RewriteID = int.Parse(row["RewriteID"].ToString());
            rewrite.Title     = row["Title"].ToString();
            rewrite.Content   = row["Content"].ToString();
            rewrite.InputDate = DateTime.Parse(row["InputDate"].ToString());
            rewrite.Person    = pMgr.GetPerson(row["PersonID"].ToString());
            rewrite.Client    = g2Mgr.GetClient(row["ClientID"].ToString());
            rewrite.ReContent = row["ReContent"].ToString();

            return(rewrite);
        }
        else
        {
            return(rewrite);
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// 初始化窗体信息
 /// </summary>
 private void initForm()
 {
     if (this.txtClientID.Text != "")
     {
         this.txtClientID.ReadOnly = true;
         ClientMgr pMgr   = new ClientMgr();
         Client    client = pMgr.GetClient(this.txtClientID.Text);
         if (client.ClientID != "")
         {
             this.txtClientName.Text = client.ClientName;
             this.lstSex.ClearSelection();
             if (this.lstSex.Items.FindByValue(client.Sex) != null)
             {
                 this.lstSex.Items.FindByValue(client.Sex).Selected = true;
             }
             this.lstSpecID.ClearSelection();
             if (this.lstSpecID.Items.FindByValue(client.Spec.SpecID.ToString()) != null)
             {
                 this.lstSpecID.Items.FindByValue(client.Spec.SpecID.ToString()).Selected = true;
             }
         }
         else
         {
             this.btnOK.Enabled = false;
             this.SendMessage("没有找到该人员信息");
         }
     }
 }
Exemplo n.º 5
0
        protected override void SaveClient(ClientBase client)
        {
            GameClient gClient = client as GameClient;

            ClientMgr.AddClient(gClient);

            gClient.ClientDisconnectHandler += new ClientBase.ClientDisconnectedDelegate(gClient_ClientDisconnectHandler);
        }
Exemplo n.º 6
0
    void OnDestroy()
    {
        Ins = null;

        if (ClientSocketMgr.GetIns().BeConnect())
        {
            ClientSocketMgr.GetIns().Close("scn destroy");
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 初始化人员列表信息
    /// </summary>
    private void initForm()
    {
        ClientMgr sMgr     = new ClientMgr();
        DataTable dtNumber = sMgr.GetClientList(this.txtClientID.Text.Trim(),
                                                this.txtClientName.Text.Trim());

        this.dgList.DataSource = dtNumber;
        this.lblNumber.Text    = "共" + dtNumber.Rows.Count.ToString() + "条记录";
        this.dgList.DataBind();
    }
Exemplo n.º 8
0
        public void Input(Snapshot snapshot)
        {
            this.RunEvent(snapshot);

            if (!ServerMgr.Active)
            {
                ClientMgr.Input(snapshot);
            }
            else
            {
                ServerMgr.Input(this.fd, snapshot, false);
            }
        }
Exemplo n.º 9
0
        void gClient_ClientDisconnectHandler(ClientBase client)
        {
            GameClient gClient = client as GameClient;

            gClient.ClientDisconnectHandler -= new ClientBase.ClientDisconnectedDelegate(gClient_ClientDisconnectHandler);

            ClientMgr.RemoveClient(gClient);

            if (gClient.Socket != null)
            {
                byte[] temp = gClient.Socket.SendBuffer;
                gClient.Socket.SendBuffer = null;
                BufferMgr.ReleaseBuffer(temp);

                temp = gClient.Socket.ReceiveBuffer;
                gClient.Socket.ReceiveBuffer = null;
                BufferMgr.ReleaseBuffer(temp);
            }
        }
Exemplo n.º 10
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        ClientMgr sMgr   = new ClientMgr();
        Client    client = new Client();

        if (this.txtClientID.ReadOnly == false)
        {
            if (sMgr.ExistsClient(this.txtClientID.Text))
            {
                this.SendMessage("该登录名称已经存在");
                return;
            }
            client.Password = "******";
        }
        else
        {
            client = sMgr.GetClient(this.txtClientID.Text);
        }

        client.ClientID    = this.txtClientID.Text.Trim();
        client.ClientName  = this.txtClientName.Text.Trim();
        client.Spec.SpecID = int.Parse(this.lstSpecID.SelectedValue);
        client.Sex         = this.lstSex.SelectedValue;
        if (this.txtPassword.Text != "")
        {
            client.Password = this.txtPassword.Text;
        }



        sMgr.UpdateClient(client);
        this.SendMessage("信息编辑成功");
        if (!this.txtClientID.ReadOnly)
        {
            this.ClearTextData(this);
        }
    }
Exemplo n.º 11
0
        public Form1()
        {
            InitializeComponent();

            bool isStart = true;

            ClientMgr client = new ClientMgr();

            client.Init();
            client.StartServer();



            ProtocolMgr.RegisterProtocol(ProtocolMgr.UDP_Hello, (resp) =>
            {
                UdpResponseHelloTest pack = (UdpResponseHelloTest)resp;
                pack.DeSerialize();
                MethodInvoker mi = new MethodInvoker(() =>
                {
                    textBox1.Text = pack.HelloWorld;
                });

                mi.Invoke();
            });


            TaskPoolHelper.Instance.StartALongTask(() =>
            {
                while (isStart)
                {
                    Thread.Sleep(100);
                    client.Update();
                }
            });

            UdpRequestHelloTest package = ProtocolMgr.GetPackageRequest <UdpRequestHelloTest>(-1);

            client.SendUdpMessage(package);

            this.FormClosed += new FormClosedEventHandler((e, obj) =>
            {
                isStart = false;
            });


            //helper = new MPHelper();
            //helper.player = axWindowsMediaPlayer1;
            //LogAgent.Log("我试试!!!");
            //helper.Init((msg) =>
            //{
            //    try
            //    {
            //        LogAgent.Log("我播放完成啦!!!");
            //        throw new Exception("我是一个错");
            //    }
            //    catch (System.Exception ex)
            //    {
            //        LogAgent.LogError(ex.StackTrace);
            //    }
            //});
            //helper.Play("L:\\ABCD.mkv");
        }
Exemplo n.º 12
0
 void Awake()
 {
     Ins = this;
 }
Exemplo n.º 13
0
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        switch (this.lstLoginType.SelectedValue)
        {
        case "管理员":
            AdminMgr aMgr  = new AdminMgr();
            Admin    admin = aMgr.GetAdmin(this.txtLoginName.Text);
            if (admin.AdminID != "")
            {
                if (this.txtPassword.Text == admin.Password)
                {
                    this.eUserID   = admin.AdminID;
                    this.eUserName = admin.AdminName;
                    this.eUserType = "管理员";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该教师");
            }
            break;

        case "教师":
            ClientMgr pMgr   = new ClientMgr();
            Client    client = pMgr.GetClient(this.txtLoginName.Text);
            if (client.ClientID != "")
            {
                if (this.txtPassword.Text == client.Password)
                {
                    this.eUserID   = client.ClientID;
                    this.eUserName = client.ClientName;
                    this.eUserType = "教师";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该教师");
            }
            break;

        case "学生":
            PersonMgr cMgr   = new PersonMgr();
            Person    person = cMgr.GetPerson(this.txtLoginName.Text);
            if (person.PersonID != "")
            {
                if (this.txtPassword.Text == person.Password)
                {
                    this.eUserID   = person.PersonID;
                    this.eUserName = person.PersonName;
                    this.eUserType = "学生";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该学生");
            }
            break;
        }
    }