示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtTitle.Text.Trim().Length == 0)
            {
                strErr += "广告位名称不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtWidth.Text))
            {
                strErr += "宽度必须为数字!\\n";
            }
            if (!PageValidate.IsNumber(txtHeight.Text))
            {
                strErr += "高度必须为数字!\\n";
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            hm.Model.ad_pos model = new hm.Model.ad_pos();
            model.title  = this.txtTitle.Text;
            model.types  = int.Parse(ddlTypes.SelectedValue);
            model.width  = int.Parse(txtWidth.Text);
            model.height = int.Parse(txtHeight.Text);
            model.click  = 0;

            hm.BLL.ad_pos bll = new hm.BLL.ad_pos();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
示例#2
0
 private void ShowInfo(int siId)
 {
     hm.BLL.ad_pos   bll   = new hm.BLL.ad_pos();
     hm.Model.ad_pos model = bll.GetModel(siId);
     lblId.Text             = model.id.ToString();
     txtTitle.Text          = model.title;
     txtWidth.Text          = model.width.ToString();
     txtHeight.Text         = model.height.ToString();
     ddlTypes.SelectedValue = model.types.ToString();
 }