Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtStatCode.Text.Trim().Length == 0)
            {
                strErr += "StatCode不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtCapTime.Text))
            {
                strErr += "CapTime格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtType.Text))
            {
                strErr += "Type格式错误!\\n";
            }
            if (this.txtFileName.Text.Trim().Length == 0)
            {
                strErr += "FileName不能为空!\\n";
            }
            if (this.txtPath.Text.Trim().Length == 0)
            {
                strErr += "Path不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   StatCode = this.txtStatCode.Text;
            DateTime CapTime  = DateTime.Parse(this.txtCapTime.Text);
            int      Type     = int.Parse(this.txtType.Text);
            string   FileName = this.txtFileName.Text;
            string   Path     = this.txtPath.Text;

            ESMonitor.Model.Files model = new ESMonitor.Model.Files();
            model.StatCode = StatCode;
            model.CapTime  = CapTime;
            model.Type     = Type;
            model.FileName = FileName;
            model.Path     = Path;

            ESMonitor.BLL.Files bll = new ESMonitor.BLL.Files();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }