Пример #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtProductID.Text))
            {
                strErr += "产品ID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtisHost.Text))
            {
                strErr += "主机个数 0表示主机个数不限制格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtisTtl.Text))
            {
                strErr += "TTL值 0表示TTL值不限制格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtisMonitor.Text))
            {
                strErr += "宕机检测个数 0表示无宕机检测功能格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtisGroupID.Text))
            {
                strErr += "NS组 表示默认开通的服务器组格式错误!\\n";
            }
            if (this.txtRemark.Text.Trim().Length == 0)
            {
                strErr += "备注不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    Id        = int.Parse(this.lblId.Text);
            int    ProductID = int.Parse(this.txtProductID.Text);
            int    isHost    = int.Parse(this.txtisHost.Text);
            int    isTtl     = int.Parse(this.txtisTtl.Text);
            int    isMonitor = int.Parse(this.txtisMonitor.Text);
            int    isGroupID = int.Parse(this.txtisGroupID.Text);
            string Remark    = this.txtRemark.Text;


            DNSABC.Model.DNSABC_ProductModelDns model = new DNSABC.Model.DNSABC_ProductModelDns();
            model.Id        = Id;
            model.ProductID = ProductID;
            model.isHost    = isHost;
            model.isTtl     = isTtl;
            model.isMonitor = isMonitor;
            model.isGroupID = isGroupID;
            model.Remark    = Remark;

            DNSABC.BLL.DNSABC_ProductModelDns bll = new DNSABC.BLL.DNSABC_ProductModelDns();
            bll.Update(model);
            ROYcms.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Пример #2
0
 private void ShowInfo(int Id)
 {
     DNSABC.BLL.DNSABC_ProductModelDns   bll   = new DNSABC.BLL.DNSABC_ProductModelDns();
     DNSABC.Model.DNSABC_ProductModelDns model = bll.GetModel(Id);
     this.lblId.Text        = model.Id.ToString();
     this.lblProductID.Text = model.ProductID.ToString();
     this.lblisHost.Text    = model.isHost.ToString();
     this.lblisTtl.Text     = model.isTtl.ToString();
     this.lblisMonitor.Text = model.isMonitor.ToString();
     this.lblisGroupID.Text = model.isGroupID.ToString();
     this.lblRemark.Text    = model.Remark;
 }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DNSABC.Model.DNSABC_ProductModelDns GetModel(int ProductID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,ProductID,isHost,isTtl,isMonitor,isGroupID,Remark from DNSABC_ProductModelDns ");
            strSql.Append(" where ProductID=@ProductID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ProductID;

            DNSABC.Model.DNSABC_ProductModelDns model = new DNSABC.Model.DNSABC_ProductModelDns();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ProductID"] != null && ds.Tables[0].Rows[0]["ProductID"].ToString() != "")
                {
                    model.ProductID = int.Parse(ds.Tables[0].Rows[0]["ProductID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["isHost"] != null && ds.Tables[0].Rows[0]["isHost"].ToString() != "")
                {
                    model.isHost = int.Parse(ds.Tables[0].Rows[0]["isHost"].ToString());
                }
                if (ds.Tables[0].Rows[0]["isTtl"] != null && ds.Tables[0].Rows[0]["isTtl"].ToString() != "")
                {
                    model.isTtl = int.Parse(ds.Tables[0].Rows[0]["isTtl"].ToString());
                }
                if (ds.Tables[0].Rows[0]["isMonitor"] != null && ds.Tables[0].Rows[0]["isMonitor"].ToString() != "")
                {
                    model.isMonitor = int.Parse(ds.Tables[0].Rows[0]["isMonitor"].ToString());
                }
                if (ds.Tables[0].Rows[0]["isGroupID"] != null && ds.Tables[0].Rows[0]["isGroupID"].ToString() != "")
                {
                    model.isGroupID = int.Parse(ds.Tables[0].Rows[0]["isGroupID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null && ds.Tables[0].Rows[0]["Remark"].ToString() != "")
                {
                    model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(DNSABC.Model.DNSABC_ProductModelDns model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update DNSABC_ProductModelDns set ");
            strSql.Append("ProductID=@ProductID,");
            strSql.Append("isHost=@isHost,");
            strSql.Append("isTtl=@isTtl,");
            strSql.Append("isMonitor=@isMonitor,");
            strSql.Append("isGroupID=@isGroupID,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ProductID=@ProductID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductID", SqlDbType.Int,       4),
                new SqlParameter("@isHost",    SqlDbType.Int,       4),
                new SqlParameter("@isTtl",     SqlDbType.Int,       4),
                new SqlParameter("@isMonitor", SqlDbType.Int,       4),
                new SqlParameter("@isGroupID", SqlDbType.Int,       4),
                new SqlParameter("@Remark",    SqlDbType.VarChar, 500),
                new SqlParameter("@Id",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ProductID;
            parameters[1].Value = model.isHost;
            parameters[2].Value = model.isTtl;
            parameters[3].Value = model.isMonitor;
            parameters[4].Value = model.isGroupID;
            parameters[5].Value = model.Remark;
            parameters[6].Value = model.ProductID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(DNSABC.Model.DNSABC_ProductModelDns model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into DNSABC_ProductModelDns(");
            strSql.Append("ProductID,isHost,isTtl,isMonitor,isGroupID,Remark)");
            strSql.Append(" values (");
            strSql.Append("@ProductID,@isHost,@isTtl,@isMonitor,@isGroupID,@Remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductID", SqlDbType.Int,     4),
                new SqlParameter("@isHost",    SqlDbType.Int,     4),
                new SqlParameter("@isTtl",     SqlDbType.Int,     4),
                new SqlParameter("@isMonitor", SqlDbType.Int,     4),
                new SqlParameter("@isGroupID", SqlDbType.Int,     4),
                new SqlParameter("@Remark",    SqlDbType.VarChar, 500)
            };
            parameters[0].Value = model.ProductID;
            parameters[1].Value = model.isHost;
            parameters[2].Value = model.isTtl;
            parameters[3].Value = model.isMonitor;
            parameters[4].Value = model.isGroupID;
            parameters[5].Value = model.Remark;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }