Пример #1
0
 public void show()
 {
     if (!string.IsNullOrEmpty(id))
     {
         XianZhi = XianZhibll.Find(p => p.XianZhiIPID == id);
         if (XianZhi != null)
         {
             this.txtkaishi.Text = XianZhi.XianZhiIP_StartIP;
             this.txtjieshu.Text = XianZhi.XianZhiIP_EndIP;
         }
     }
 }
Пример #2
0
        /// 保存
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object obj, EventArgs e)
        {
            string msg = string.Empty;

            id = Request["id"];
            if (string.IsNullOrEmpty(id))
            {
                XianZhi.XianZhiIPID = Guid.NewGuid().ToString();

                XianZhi.XianZhiIP_StartIP = this.txtkaishi.Text;
                XianZhi.XianZhiIP_EndIP   = this.txtjieshu.Text;
                XianZhi.XianZhiIP_AddTime = DateTime.Now;
                if (XianZhibll.Add(XianZhi, out msg))
                {
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('添加成功!');coed('1')", true);
                }
                else
                {
                    MessageBox.Show(this, msg);
                }
            }
            else
            {
                XianZhi = XianZhibll.Find(p => p.XianZhiIPID == id);

                XianZhi.XianZhiIP_StartIP = this.txtkaishi.Text;
                XianZhi.XianZhiIP_EndIP   = this.txtjieshu.Text;
                XianZhi.XianZhiIP_AddTime = DateTime.Now;
                if (XianZhibll.Update(XianZhi, out msg))
                {
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('修改成功!');coed('2')", true);
                }
                else
                {
                    MessageBox.Show(this, msg);
                }
            }
        }