Exemple #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtHostId.Text))
            {
                strErr += "HostId格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtFuncType.Text))
            {
                strErr += "FuncType格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtReadTime.Text))
            {
                strErr += "ReadTime格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtState.Text))
            {
                strErr += "State格式错误!\\n";
            }
            if (this.txtDescripion.Text.Trim().Length == 0)
            {
                strErr += "Descripion不能为空!\\n";
            }
            if (this.txtRemark.Text.Trim().Length == 0)
            {
                strErr += "Remark不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      ID         = int.Parse(this.lblID.Text);
            int      HostId     = int.Parse(this.txtHostId.Text);
            int      FuncType   = int.Parse(this.txtFuncType.Text);
            DateTime ReadTime   = DateTime.Parse(this.txtReadTime.Text);
            int      State      = int.Parse(this.txtState.Text);
            string   Descripion = this.txtDescripion.Text;
            string   Remark     = this.txtRemark.Text;


            WebDemo.Model.WebDemo.HostStateLog model = new WebDemo.Model.WebDemo.HostStateLog();
            model.ID         = ID;
            model.HostId     = HostId;
            model.FuncType   = FuncType;
            model.ReadTime   = ReadTime;
            model.State      = State;
            model.Descripion = Descripion;
            model.Remark     = Remark;

            WebDemo.BLL.WebDemo.HostStateLog bll = new WebDemo.BLL.WebDemo.HostStateLog();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Exemple #2
0
 private void ShowInfo(int ID)
 {
     WebDemo.BLL.WebDemo.HostStateLog   bll   = new WebDemo.BLL.WebDemo.HostStateLog();
     WebDemo.Model.WebDemo.HostStateLog model = bll.GetModel(ID);
     this.lblID.Text         = model.ID.ToString();
     this.lblHostId.Text     = model.HostId.ToString();
     this.lblFuncType.Text   = model.FuncType.ToString();
     this.lblReadTime.Text   = model.ReadTime.ToString();
     this.lblState.Text      = model.State.ToString();
     this.lblDescripion.Text = model.Descripion;
     this.lblRemark.Text     = model.Remark;
 }