Пример #1
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));


                    STypeBLL _STypeBLL = new STypeBLL();

                    if (_STypeBLL.DelSTypebyTID(delid))
                    {
                        if (_STypeBLL.GetSceTypeCountByTID(delid) > 0)
                        {
                            if (_STypeBLL.DelSceneryType(delid))
                            {
                                isTrue = true;
                            }
                        }
                        else
                        {
                            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='STypeList.aspx';");
                    Response.Write("</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除失败!');");
                    Response.Write("document.location.href='STypeList.aspx';");
                    Response.Write("</script>");
                }
            }
            catch
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('删除失败!');");
                Response.Write("document.location.href='STypeList.aspx';");
                Response.Write("</script>");
            }
        }
Пример #2
0
        //景点类型的绑定
        private void Bind()
        {
            STypeBLL  _STypeBLL = new STypeBLL();
            DataTable DT        = _STypeBLL.GetAllSType();

            this.CBoxType.Items.Clear();
            this.CBoxType.DataSource     = DT;
            this.CBoxType.DataTextField  = "TypeName";
            this.CBoxType.DataValueField = "TypeID";
            this.CBoxType.DataBind();
        }
        private void Bind()
        {
            //绑定景点信息
            SceneryInfoBLL _SceneryInfoBLL = new SceneryInfoBLL();
            int            SceneryID       = 0;

            if (Request.QueryString["SceneryID"] != null)
            {
                SceneryID = int.Parse(Request.QueryString["SceneryID"].ToString());
            }

            DataTable DT = _SceneryInfoBLL.GetSceneryInfoByID(SceneryID);

            this.txtSceneryName.Text    = DT.Rows[0]["SceneryName"].ToString();
            this.txtSceneryName.Enabled = false;

            this.txtSceneryPrice.Text = DT.Rows[0]["SceneryPrice"].ToString();
            this.TxtSceneryLoc.Text   = DT.Rows[0]["SceneryLoc"].ToString();

            this.TxtOpenTime.Text = DT.Rows[0]["OpenTime"].ToString();

            this.txtSceneryLat.Text = DT.Rows[0]["SLongitude"].ToString().Substring(0, 8);
            this.txtSceneryLgt.Text = DT.Rows[0]["Slatitude"].ToString().Substring(0, 8);

            this.TxtSceneryIntroduce.Text = DT.Rows[0]["SceneryIntro"].ToString();
            this.TxtScenerySuitTime.Text  = DT.Rows[0]["BestTravel"].ToString();


            //显示景点类型状态
            STypeBLL  _STypeBLL = new STypeBLL();
            DataTable _DT       = _STypeBLL.GetAllSType();

            this.CBoxType.Items.Clear();
            this.CBoxType.DataSource     = _DT;
            this.CBoxType.DataTextField  = "TypeName";
            this.CBoxType.DataValueField = "TypeID";
            this.CBoxType.DataBind();


            DataTable STypeDT = _STypeBLL.GetSceTypeByID(SceneryID);

            for (int i = 0; i < STypeDT.Rows.Count; i++)
            {
                for (int j = 0; j < CBoxType.Items.Count; j++)
                {
                    if (STypeDT.Rows[i]["TypeID"].ToString().Trim() == CBoxType.Items[j].Value.ToString().Trim())
                    {
                        CBoxType.Items[j].Selected = true;
                    }
                }
            }
        }
Пример #4
0
        protected void btAdd_Click(object sender, EventArgs e)
        {
            SType    _SType    = new SType();
            STypeBLL _STypeBLL = new STypeBLL();

            _SType.TypeName = this.txtTypeName.Text.Trim();

            if (_STypeBLL.AddSType(_SType))
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('添加成功');");
                Response.Write("document.location.href='STypeList.aspx';");
                Response.Write("</script>");
            }
            else
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('添加失败');");
                Response.Write("document.location.href='STypeList.aspx';");
                Response.Write("</script>");
            }
        }
Пример #5
0
        //根据市ID删除市信息
        protected void deleteThis()
        {
            try
            {
                Array delWitch  = rqid.Split('|');
                bool  isTrue    = false;
                bool  isPicTrue = false;
                for (int i = 0; i < delWitch.Length - 1; i++)
                {
                    int delid = Convert.ToInt32(delWitch.GetValue(i));


                    SceneryInfoBLL _SceneryInfoBLL = new SceneryInfoBLL();
                    PicInfoBLL     _PicInfoBLL     = new PicInfoBLL();
                    STypeBLL       _STypeBLL       = new STypeBLL();
                    DataTable      ScePicDT;


                    if (_SceneryInfoBLL.DelScenery(delid))
                    {
                        if (_STypeBLL.GetSceTypeCount(delid) > 0)
                        {
                            if (_STypeBLL.DelSType(delid))
                            {
                                isTrue = true;
                            }
                        }
                        else
                        {
                            isTrue = true;
                        }

                        //加入删除图片信息
                        ScePicDT = _PicInfoBLL.GetPicBySceID(delid);
                        if (ScePicDT.Rows.Count > 0)
                        {
                            for (int j = 0; j < ScePicDT.Rows.Count; j++)
                            {
                                int PicTempID = int.Parse(ScePicDT.Rows[j]["PicID"].ToString());
                                if (_PicInfoBLL.DelPicByID(PicTempID) && _PicInfoBLL.DelScePicByID(PicTempID))
                                {
                                    isPicTrue = true;
                                }
                                else
                                {
                                    isPicTrue = false;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            isPicTrue = true;
                        }
                    }
                    else
                    {
                        isTrue = false;
                    }


                    if (isTrue == false || isPicTrue == false)
                    {
                        break;
                    }
                }
                if (!(isTrue == false || isPicTrue == false))
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除成功!');");
                    Response.Write("document.location.href='SceneryInfoList.aspx';");
                    Response.Write("</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除失败!');");
                    Response.Write("document.location.href='SceneryInfoList.aspx';");
                    Response.Write("</script>");
                }
            }
            catch
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('删除失败!');");
                Response.Write("document.location.href='SceneryInfoList.aspx';");
                Response.Write("</script>");
            }
        }
Пример #6
0
        protected void btEdit_Click(object sender, EventArgs e)
        {
            //添加景点信息
            STypeBLL       _STypeBLL       = new STypeBLL();
            SceneryInfoBLL _SceneryInfoBLL = new SceneryInfoBLL();
            SceneryInfo    _SceneryInfo    = new SceneryInfo();

            _SceneryInfo.SceneryName = this.txtSceneryName.Text.Trim();
            _SceneryInfo.CityID      = int.Parse(Request.QueryString["CityID"].ToString());

            _SceneryInfo.SceneryPrice = this.txtSceneryPrice.Text.Trim();
            _SceneryInfo.SceneryLoc   = this.TxtSceneryLoc.Text.Trim();
            _SceneryInfo.OpenTime     = this.TxtOpenTime.Text.Trim();
            _SceneryInfo.SceneryIntro = this.TxtSceneryIntroduce.Text.Trim();
            _SceneryInfo.BestTravel   = this.TxtScenerySuitTime.Text.Trim();

            if (txtSceneryLgt.Text.Trim() != "")
            {
                _SceneryInfo.SLongitude = float.Parse(txtSceneryLgt.Text.Trim().ToString());
            }
            else
            {
                _SceneryInfo.SLongitude = 0.0f;
            }

            if (txtSceneryLat.Text.Trim() != "")
            {
                _SceneryInfo.Slatitude = float.Parse(txtSceneryLat.Text.Trim().ToString());
            }
            else
            {
                _SceneryInfo.Slatitude = 0.0f;
            }

            //添加景点类型
            ArrayList TypeList = new ArrayList();

            for (int i = 0; i < this.CBoxType.Items.Count; i++)
            {
                if (this.CBoxType.Items[i].Selected)
                {
                    TypeList.Add(this.CBoxType.Items[i].Value);
                }
            }

            bool IsSType = true;

            for (int j = 0; j < TypeList.Count; j++)
            {
                if (!_STypeBLL.AddSceneryType(int.Parse(TypeList[j].ToString()), _SceneryInfo.CityID))
                {
                    IsSType = false;
                    break;
                }
            }

            //判断是否添加成功
            if (_SceneryInfoBLL.AddScenery(_SceneryInfo) && IsSType)
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('添加成功');");
                Response.Write("document.location.href='SceneryInfoList.aspx';");
                Response.Write("</script>");
            }
        }
        protected void btEdit_Click(object sender, EventArgs e)
        {
            //根据景点信息跟新景点
            SceneryInfoBLL _SceneryInfoBLL = new SceneryInfoBLL();
            SceneryInfo    _SceneryInfo    = new SceneryInfo();


            _SceneryInfo.SceneryPrice = this.txtSceneryPrice.Text.Trim();
            _SceneryInfo.SceneryLoc   = this.TxtSceneryLoc.Text.Trim();
            _SceneryInfo.OpenTime     = this.TxtOpenTime.Text.Trim();
            _SceneryInfo.SceneryIntro = this.TxtSceneryIntroduce.Text.Trim();
            _SceneryInfo.BestTravel   = this.TxtScenerySuitTime.Text.Trim();

            if (txtSceneryLgt.Text.Trim() != "")
            {
                _SceneryInfo.SLongitude = float.Parse(txtSceneryLgt.Text.Trim().ToString());
            }
            else
            {
                _SceneryInfo.SLongitude = 0.0f;
            }

            if (txtSceneryLat.Text.Trim() != "")
            {
                _SceneryInfo.Slatitude = float.Parse(txtSceneryLat.Text.Trim().ToString());
            }
            else
            {
                _SceneryInfo.Slatitude = 0.0f;
            }

            //更新景点信息

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

            //更新景点类型  先把景点类型都删除然后
            bool      TypeFlag  = true;
            STypeBLL  _STypeBLL = new STypeBLL();
            ArrayList TypeList  = new ArrayList();

            for (int i = 0; i < this.CBoxType.Items.Count; i++)
            {
                if (this.CBoxType.Items[i].Selected)
                {
                    TypeList.Add(this.CBoxType.Items[i].Value);
                }
            }
            if (_STypeBLL.GetSceTypeCount(SceneryID) > 0)
            {
                _STypeBLL.DelSType(SceneryID);
            }

            for (int j = 0; j < TypeList.Count; j++)
            {
                if (!_STypeBLL.AddSceneryType(int.Parse(TypeList[j].ToString()), SceneryID))
                {
                    TypeFlag = false;
                }
            }

            if (_SceneryInfoBLL.UpdSceneryInfoByID(SceneryID, _SceneryInfo) && TypeFlag)
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('更新成功');");
                Response.Write("document.location.href='SceneryInfoList.aspx?CityID=" + CityID.ToString() + "';");
                Response.Write("</script>");
            }
        }