コード例 #1
0
ファイル: start.aspx.cs プロジェクト: pyteach/Learnsite
    private void showhouse()
    {
        string pcroom = tcook.Hroom;

        if (!LearnSite.Common.XmlHelp.GetHouseMode())
        {
            LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
            DDLhouse.DataSource     = cbll.CmpRoom();
            DDLhouse.DataTextField  = "Pm";
            DDLhouse.DataValueField = "Pm";
            DDLhouse.DataBind();
            HyperLinkSeat.Visible = false;
        }
        else
        {
            HyperLinkSeat.Visible = true;
            LearnSite.BLL.House hbll = new LearnSite.BLL.House();
            DDLhouse.DataSource     = hbll.GetListHouse();
            DDLhouse.DataTextField  = "Hname";
            DDLhouse.DataValueField = "Hid";
            DDLhouse.DataBind();
        }
        if (DDLhouse.Items.FindByValue(pcroom) != null)
        {
            DDLhouse.SelectedValue = pcroom;
        }
    }
コード例 #2
0
 private void showIpMachine()
 {
     LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
     GVComputer.DataSource = cbll.GetListOrderBy(Radiobtnorder.SelectedValue);
     GVComputer.DataBind();
     CheckBoxhostname.Checked = LearnSite.Common.XmlHelp.GetAutoHostName();
 }
コード例 #3
0
ファイル: myseat.aspx.cs プロジェクト: pyteach/Learnsite
 private void showhouse()
 {
     LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
     DDLhouse.DataSource     = cbll.CmpRoom();
     DDLhouse.DataTextField  = "Pm";
     DDLhouse.DataValueField = "Pm";
     DDLhouse.DataBind();
 }
コード例 #4
0
ファイル: myseat.aspx.cs プロジェクト: pyteach/Learnsite
    private void showSeat()
    {
        string croom = DDLhouse.SelectedValue;

        if (!string.IsNullOrEmpty(croom))
        {
            LearnSite.BLL.Computers     cbll  = new LearnSite.BLL.Computers();
            LearnSite.Model.SeatCollect seact = new LearnSite.Model.SeatCollect();
            seact = cbll.GetSeat(croom);//select Pip,Pmachine,Px,Py from Computers
            DataList1.DataSource = seact.Dt;
            DataList1.DataBind();
            DataList1.RepeatColumns = seact.Column;
            Labelnum.Text           = "当前机房电脑数量:" + seact.Online.ToString() + "台  列数为" + seact.Column.ToString();
        }
    }
コード例 #5
0
 protected void BtnDelAll_Click(object sender, EventArgs e)
 {
     if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
     {
         LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
         cbll.DeleteAll();
         System.Threading.Thread.Sleep(500);
         showIpMachine();
     }
     else
     {
         string ch = "请登录后执行操作!";
         LearnSite.Common.WordProcess.Alert(ch, this.Page);
     }
 }
コード例 #6
0
    protected void GVComputer_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
        {
            if (e.CommandName.Equals("Lock"))
            {
                string myPid = e.CommandArgument.ToString();
                LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
                cbll.UpLock(Int32.Parse(myPid));
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
            if (e.CommandName.Equals("Del"))
            {
                string myPid = e.CommandArgument.ToString();
                LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
                cbll.Delete(Int32.Parse(myPid));
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
            if (e.CommandName.Equals("Upd"))
            {
                string myPid = e.CommandArgument.ToString();
                int    i     = ((GridViewRow)((Button)e.CommandSource).NamingContainer).RowIndex;
                //(该方法不需要html中的绑定,取id.刚刚看到的,加上来,好方法.......)

                TextBox tb = (TextBox)GVComputer.Rows[i].FindControl("TextBoxp");
                LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
                cbll.UpdateByPid(Int32.Parse(myPid), tb.Text.Trim());
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
            if (e.CommandName.Equals("Can"))
            {
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
        }
        else
        {
            string ch = "请登录后执行操作!";
            LearnSite.Common.WordProcess.Alert(ch, this.Page);
        }
    }
コード例 #7
0
ファイル: index.aspx.cs プロジェクト: WaterCountry/Learnsite
    /// <summary>
    /// 获取IP对应机器名,返回主机名
    /// </summary>
    /// <param name="Pip"></param>
    /// <returns></returns>
    private string GetHostNameMy(string aPip)
    {
        string msg = "否";//表示不自动获取主机名

        if (!string.IsNullOrEmpty(aPip))
        {
            LearnSite.BLL.Computers   cbll   = new LearnSite.BLL.Computers();
            LearnSite.Model.Computers cmodel = new LearnSite.Model.Computers();
            cmodel = cbll.GetModelByIp(aPip);

            bool autohostname = LearnSite.Common.XmlHelp.GetAutoHostName(); //自动取主机名开关
            if (cmodel != null)                                             //如果存在
            {
                msg = cmodel.Pmachine;                                      //获取主机名
                if (!cmodel.Plock && autohostname)                          //如果未锁定,更新主机名并锁定
                {
                    string newMachine = LearnSite.Common.Computer.GetGuestHost(aPip);
                    cbll.UpdateByPid(cmodel.Pid, newMachine);
                    msg = newMachine;//返回新主机名
                }
            }
            else
            {
                if (autohostname)
                {
                    LearnSite.Model.Computers newmodel = new LearnSite.Model.Computers();//会丢失?不能过早定义?
                    newmodel.Pip   = aPip;
                    newmodel.Plock = true;
                    string addMachine = LearnSite.Common.Computer.GetGuestHost(aPip);
                    newmodel.Pmachine = addMachine;
                    newmodel.Pdate    = DateTime.Now;
                    cbll.Add(newmodel);
                    msg = addMachine;
                }
            }
        }
        else
        {
            msg = "空";//表示获取不到IP,反回主机名为空
        }
        return(msg);
    }
コード例 #8
0
ファイル: Computers.cs プロジェクト: pyteach/Learnsite
        /// <summary>
        /// 根据IP更新主机名,不存在则添加
        /// </summary>
        public bool UpdateIp(string Pip, string Pmachine)
        {
            bool isok = false;

            if (!ExistsIp(Pip))
            {
                Model.Computers cmodel = new Model.Computers();
                cmodel.Pdate    = DateTime.Now;
                cmodel.Pip      = Pip;
                cmodel.Plock    = true;
                cmodel.Pmachine = Pmachine;
                BLL.Computers cbll = new Computers();
                if (cbll.Add(cmodel) > 0)
                {
                    isok = true;
                }
            }
            else
            {
                isok = dal.UpdateIp(Pip, Pmachine);
            }
            return(isok);
        }