コード例 #1
0
        protected void btAdd_Click(object sender, EventArgs e)
        {
            CityInfoBLL _CityInfoBLL = new CityInfoBLL();

            Model.City.CityInfo _CityInfo = new Model.City.CityInfo();
            _CityInfo.CityName     = this.txtCityName.Text.Trim();
            _CityInfo.Introduction = this.txtCityIntroduce.Text.Trim();

            bool IsExist = _CityInfoBLL.IsCityExist(this.txtCityName.Text.Trim());

            if (IsExist)
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('该市已经录入');");
                Response.Write("document.location.href='CityInfoList.aspx';");
                Response.Write("</script>");
            }

            else
            {
                if (_CityInfoBLL.AddCityInfo(_CityInfo))   //
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('添加成功');");
                    Response.Write("document.location.href='CityInfoList.aspx';");
                    Response.Write("</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('添加失败');");
                    Response.Write("</script>");
                }
            }
        }
コード例 #2
0
        private void Bind()
        {
            //绑定数据
            int         CityID       = int.Parse(Request.QueryString["CityID"].ToString());
            CityInfoBLL _CityInfoBLL = new CityInfoBLL();
            DataTable   DT           = _CityInfoBLL.GetCityInfoByID(CityID);

            this.txtCityName.Text      = DT.Rows[0]["CityName"].ToString();
            this.txtCityIntroduce.Text = DT.Rows[0]["Introduction"].ToString();
        }
コード例 #3
0
        private void CityBind()
        {
            CityInfoBLL _CityInfoBLL = new CityInfoBLL();
            DataTable   CityDT       = _CityInfoBLL.GetAllCityInfo();

            this.DropDownCity.Items.Clear();
            this.DropDownCity.DataSource     = CityDT;
            this.DropDownCity.DataTextField  = "CityName";
            this.DropDownCity.DataValueField = "CityID";
            this.DropDownCity.DataBind();
        }
コード例 #4
0
        //根据市ID删除市信息
        protected void deleteThis()
        {
            try
            {
                Array delWitch = rqid.Split('|');
                bool  isTrue   = false;
                for (int i = 0; i < delWitch.Length - 1; i++)
                {
                    int delid = Convert.ToInt32(delWitch.GetValue(i));

                    CityInfoBLL _CityInfoBLL = new CityInfoBLL();

                    if (_CityInfoBLL.DelCityByID(delid))
                    {
                        isTrue = true;
                    }
                    else
                    {
                        isTrue = false;
                    }


                    if (isTrue == false)
                    {
                        break;
                    }
                }
                if (!(isTrue == false))
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除成功!');");
                    Response.Write("document.location.href='CityInfoList.aspx';");
                    Response.Write("</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除失败!');");
                    Response.Write("document.location.href='CityInfoList.aspx';");
                    Response.Write("</script>");
                }
            }
            catch
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('删除失败!');");
                Response.Write("document.location.href='CityInfoList.aspx';");
                Response.Write("</script>");
            }
        }
コード例 #5
0
        protected void btAdd_Click(object sender, EventArgs e)
        {
            Model.City.CityInfo _CityInfo = new Model.City.CityInfo();

            _CityInfo.CityName     = this.txtCityName.Text.Trim();
            _CityInfo.Introduction = this.txtCityIntroduce.Text.Trim();

            CityInfoBLL _CityInfoBLL = new CityInfoBLL();

            int CityID = int.Parse(Request.QueryString["CityID"].ToString());

            if (_CityInfoBLL.UpdateCityInfoBy(CityID, _CityInfo))
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('更改成功');");
                Response.Write("document.location.href='CityInfoList.aspx';");
                Response.Write("</script>");
            }
        }
コード例 #6
0
        private void DropDownBind()
        {
            //绑定市
            CityInfoBLL _CityInfoBLL = new CityInfoBLL();
            DataTable   CityDT       = _CityInfoBLL.GetAllCityInfo();

            this.DrpDownCity.Items.Clear();
            this.DrpDownCity.DataSource     = CityDT;
            this.DrpDownCity.DataTextField  = "CityName";
            this.DrpDownCity.DataValueField = "CityID";
            this.DrpDownCity.DataBind();
            //绑定景点
            int            CityID          = int.Parse(this.DrpDownCity.SelectedValue);
            SceneryInfoBLL _SceneryInfoBLL = new SceneryInfoBLL();
            DataTable      SceDT           = _SceneryInfoBLL.GetCityScenery(CityID);

            this.DropDownScenery.Items.Clear();
            this.DropDownScenery.DataSource     = SceDT;
            this.DropDownScenery.DataTextField  = "SceneryName";
            this.DropDownScenery.DataValueField = "SceneryID";
            this.DropDownScenery.DataBind();
        }