Пример #1
0
        protected void btEdit_Click(object sender, EventArgs e)
        {
            RestaurantName = Request.QueryString["RestaurantName"].ToString();
            CityID         = int.Parse(Request.QueryString["CityID"].ToString());
            PageStart      = int.Parse(Request.QueryString["PageStart"].ToString());
            RestaurantID   = int.Parse(Request.QueryString["RestaurantID"].ToString());

            RestaurantInfoBLL  _ResInfoBLL  = new RestaurantInfoBLL();
            RestaurantFoodInfo _ResFoodInfo = new RestaurantFoodInfo();

            _ResFoodInfo.FoodName = this.txtFoodName.Text.Trim();
            if (this.txtFoodPrice.Text.Trim() != "")
            {
                _ResFoodInfo.FoodPrice = float.Parse(this.txtFoodPrice.Text.Trim());
            }
            else
            {
                _ResFoodInfo.FoodPrice = 0.0f;
            }
            _ResFoodInfo.RestaurantID = RestaurantID;

            if (_ResInfoBLL.AddResFood(_ResFoodInfo))
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('添加成功');");
                Response.Write("document.location.href='RestaurantFoodList.aspx?&CityID=" + CityID.ToString() + "&RestaurantID=" + RestaurantID.ToString() + "&PageStart=" + PageStart.ToString() + "&RestaurantName=" + RestaurantName + "';");
                Response.Write("</script>");
            }
        }
Пример #2
0
        protected void DropDownRes_SelectedIndexChanged(object sender, EventArgs e)
        {
            RestaurantID = int.Parse(this.DropDownRes.SelectedValue.ToString());
            RestaurantInfoBLL _ResInfoBLL = new RestaurantInfoBLL();

            CityID = _ResInfoBLL.GetResCityByResID(RestaurantID);
            this.DrpDownCity.SelectedValue = CityID.ToString();
        }
Пример #3
0
        private void RestaurantBind(int CityID)
        {
            RestaurantInfoBLL _ResBLL = new RestaurantInfoBLL();
            DataTable         ResDT   = _ResBLL.GetCityRes(CityID);

            this.DropDownRes.Items.Clear();
            this.DropDownRes.DataSource     = ResDT;
            this.DropDownRes.DataTextField  = "RestaurantName";
            this.DropDownRes.DataValueField = "RestaurantID";
            this.DropDownRes.DataBind();
        }
Пример #4
0
        private void FoodBind(int RestaurantID)
        {
            RestaurantInfoBLL _ResBLL = new RestaurantInfoBLL();
            DataTable         DT      = _ResBLL.GetResFood(RestaurantID);

            this.DrpDownFood.Items.Clear();
            this.DrpDownFood.DataSource     = DT;
            this.DrpDownFood.DataTextField  = "FoodName";
            this.DrpDownFood.DataValueField = "FoodID";
            this.DrpDownFood.DataBind();
        }
Пример #5
0
        protected void btEdit_Click(object sender, EventArgs e)
        {
            RestaurantInfo    _Res    = new RestaurantInfo();
            RestaurantInfoBLL _ResBLL = new RestaurantInfoBLL();


            _Res.Introduction = this.TxtResIntroduce.Text.Trim();
            _Res.Local        = this.TxtResLoc.Text.Trim();
            _Res.OpenTime     = this.txtOpenTime.Text.Trim();
            _Res.PhoneNum     = this.TxtResNum.Text.Trim();

            if (this.txtResLgt.Text.Trim() != "")
            {
                _Res.SLongitude = float.Parse(txtResLgt.Text.Trim().ToString());
            }
            else
            {
                _Res.SLongitude = 0.0f;
            }

            if (this.txtResLat.Text.Trim() != "")
            {
                _Res.SLongitude = float.Parse(txtResLat.Text.Trim().ToString());
            }
            else
            {
                _Res.Slatitude = 0.0f;
            }

            if (Request.QueryString["CityID"] != null)
            {
                CityID = int.Parse(Request.QueryString["CityID"].ToString());
            }
            if (Request.QueryString["CityName"] != null)
            {
                CityName = Request.QueryString["CityName"].ToString();
            }
            if (Request.QueryString["PageStart"] != null)
            {
                PageStart = int.Parse(Request.QueryString["PageStart"].ToString());
            }
            int ResID = int.Parse(Request.QueryString["RestaurantID"].ToString());

            if (_ResBLL.UpdResInfo(ResID, _Res))
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('更新成功');");
                Response.Write("document.location.href='ResInfoList.aspx?&CityID=" + CityID.ToString() + "&CityName=" + CityName + "&PageStart=" + PageStart.ToString() + "';");
                Response.Write("</script>");
            }
        }
Пример #6
0
        protected void DrpDownCity_SelectedIndexChanged(object sender, EventArgs e)
        {
            CityID = int.Parse(this.DrpDownCity.SelectedValue.ToString());
            this.CityBind();
            this.DrpDownCity.SelectedValue = CityID.ToString();
            this.RestaurantBind(CityID);
            RestaurantInfoBLL _ResInfoBLL = new RestaurantInfoBLL();

            if (_ResInfoBLL.GetCityRes(CityID).Rows.Count > 0)
            {
                RestaurantID = int.Parse(this.DropDownRes.SelectedValue.ToString());
            }
            else
            {
                RestaurantID = 0;
            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //////判断权限
            bool IsSysAdmin = true;
            bool IsSceAdmin = true;

            if (null == Session["IsSYS"] || (Boolean)Session["IsSYS"] != true)
            {
                IsSysAdmin = false;
                IsSceAdmin = false;

                AdminInfoBLL _AdminInfoBLL = new AdminInfoBLL();
                RoleBLL      _RoleBLL      = new RoleBLL();
                int          AdminID       = int.Parse(Session["AdminID"].ToString());
                int          RoleID        = _RoleBLL.GetRoleIDByAdminID(AdminID);
                IsSceAdmin = _AdminInfoBLL.CheckFunction(RoleID, "餐馆管理");
            }

            if (!(IsSysAdmin || IsSceAdmin))
            {
                Response.Redirect("../../NotAllowed.aspx");
            }

            ////////////////
            if (!IsPostBack)
            {
                this.CityBind();
                CityID = int.Parse(this.DrpDownCity.SelectedValue.ToString());
                this.RestaurantBind(CityID);
                RestaurantID = int.Parse(this.DropDownRes.SelectedValue.ToString());
                if (Request.QueryString["RestaurantID"] != null)
                {
                    RestaurantID = int.Parse(Request.QueryString["RestaurantID"].ToString());
                    RestaurantInfoBLL _ResInfoBLL = new RestaurantInfoBLL();
                    CityID = _ResInfoBLL.GetResCityByResID(RestaurantID);
                    this.DrpDownCity.SelectedValue = CityID.ToString();
                    this.DropDownRes.SelectedValue = RestaurantID.ToString();
                }
            }
            else
            {
            }
        }
Пример #8
0
        private void Bind()
        {
            //绑定餐馆信息
            RestaurantInfoBLL _ResBll = new RestaurantInfoBLL();
            int ResID = 0;

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

            DataTable DT = _ResBll.GetResInfo(ResID);

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

            this.TxtResLoc.Text = DT.Rows[0]["Local"].ToString();
            this.TxtResNum.Text = DT.Rows[0]["PhoneNum"].ToString();

            this.TxtResIntroduce.Text = DT.Rows[0]["Introduction"].ToString();

            if (float.Parse(DT.Rows[0]["SLongitude"].ToString()) == 0.0f)
            {
                this.txtResLgt.Text = "";
            }
            else
            {
                this.txtResLgt.Text = DT.Rows[0]["SLongitude"].ToString().Substring(0, 6);
            }
            if (float.Parse(DT.Rows[0]["Slatitude"].ToString()) == 0.0f)
            {
                this.txtResLat.Text = "";
            }
            else
            {
                this.txtResLat.Text = DT.Rows[0]["Slatitude"].ToString().Substring(0, 6);
            }

            this.txtOpenTime.Text = DT.Rows[0]["OpenTime"].ToString();
        }
        //根据餐馆ID删除餐馆信息
        protected void deleteThis()
        {
            int CityID    = int.Parse(Request.QueryString["CityID"].ToString());
            int PageStart = int.Parse(Request.QueryString["PageStart"].ToString());

            try
            {
                Array delWitch      = rqid.Split('|');
                bool  isTrue        = false;
                bool  isResPicTrue  = false;
                bool  IsFoodTrue    = false;
                bool  IsFoodPicTrue = false;

                for (int i = 0; i < delWitch.Length - 1; i++)
                {
                    int delid = Convert.ToInt32(delWitch.GetValue(i));

                    RestaurantInfoBLL _ResBLL = new RestaurantInfoBLL();
                    if (_ResBLL.DelResInfo(delid))
                    {
                        isTrue = true;
                    }
                    else
                    {
                        isTrue = false;
                    }
                    if (isTrue == false)
                    {
                        break;
                    }


                    //删除菜单
                    DataTable FoodDT = _ResBLL.GetResFood(delid);
                    if (FoodDT.Rows.Count > 0)
                    {
                        for (int j = 0; j < FoodDT.Rows.Count; j++)
                        {
                            int FoodID = int.Parse(FoodDT.Rows[j]["FoodID"].ToString());
                            if (_ResBLL.DelFoodByFoodID(FoodID))
                            {
                                IsFoodTrue = true;
                            }
                            else
                            {
                                IsFoodTrue = false;
                                break;
                            }
                        }
                    }
                    else
                    {
                        IsFoodTrue = true;
                    }
                    if (IsFoodTrue == false)
                    {
                        break;
                    }

                    PicInfoBLL _PicInfoBLL = new PicInfoBLL();
                    //删除菜图片(考虑为0的情况)
                    if (FoodDT.Rows.Count > 0)
                    {
                        //删除每个菜的图片
                        for (int k = 0; k < FoodDT.Rows.Count; k++)
                        {
                            int       FoodTempID = int.Parse(FoodDT.Rows[k]["FoodID"].ToString());
                            DataTable FoodPicDT  = _PicInfoBLL.GetFoodPicByFID(FoodTempID);
                            if (FoodPicDT.Rows.Count > 0)
                            {
                                for (int l = 0; l < FoodPicDT.Rows.Count; l++)
                                {
                                    int TempPicID = int.Parse(FoodPicDT.Rows[l]["PicID"].ToString());
                                    if (_PicInfoBLL.DelFoodPicByPicID(TempPicID) && _PicInfoBLL.DelPicByID(TempPicID))
                                    {
                                        IsFoodPicTrue = true;
                                    }
                                    else
                                    {
                                        IsFoodPicTrue = false;
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                IsFoodPicTrue = true;
                            }

                            if (IsFoodPicTrue == false)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        IsFoodPicTrue = true;
                    }

                    if (IsFoodPicTrue == false)
                    {
                        break;
                    }

                    //删除餐馆图片(考虑为0的情况)
                    DataTable ResPicDT = _PicInfoBLL.GetResPicByID(delid);
                    if (ResPicDT.Rows.Count > 0)
                    {
                        for (int m = 0; m < ResPicDT.Rows.Count; m++)
                        {
                            int TempResPic = int.Parse(ResPicDT.Rows[m]["PicID"].ToString());
                            if (_PicInfoBLL.DelResPicByPicID(TempResPic) && _PicInfoBLL.DelPicByID(TempResPic))
                            {
                                isResPicTrue = true;
                            }
                            else
                            {
                                isResPicTrue = false;
                                break;
                            }
                        }
                    }
                    else
                    {
                        isResPicTrue = true;
                    }
                    if (isResPicTrue == false)
                    {
                        break;
                    }
                }

                if (!(isTrue == false || IsFoodTrue == false || IsFoodPicTrue == false || isResPicTrue == false))
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除成功!');");
                    Response.Write("document.location.href='ResInfoList.aspx?CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';");
                    Response.Write("</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除失败!');");
                    Response.Write("document.location.href='ResInfoList.aspx?CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';");
                    Response.Write("</script>");
                }
            }
            catch
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('删除失败!');");
                Response.Write("document.location.href='ResInfoList.aspx?CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';");
                Response.Write("</script>");
            }
        }
Пример #10
0
        /// <summary>
        /// 更新餐馆看了又看
        /// </summary>
        public bool UpdResSeeAndSee()
        {
            List <SeeCount> list = new List <SeeCount>();


            RestaurantInfoBLL _RestaurantInfoBLL = new RestaurantInfoBLL();
            ClickLogBLL       _ClickLogBLL       = new ClickLogBLL();
            DataTable         ResDT = _RestaurantInfoBLL.GetCityRes(1);

            for (int k = 0; k < ResDT.Rows.Count; k++)
            {
                int CurrentResID = int.Parse(ResDT.Rows[k]["RestaurantID"].ToString());
                list.Clear();
                //1.查询出所有餐馆信息 并加入链表
                for (int i = 0; i < ResDT.Rows.Count; i++)
                {
                    SeeCount _SeeCount = new SeeCount();
                    _SeeCount.KeyName = ResDT.Rows[i]["RestaurantName"].ToString();
                    _SeeCount.KeyID   = int.Parse(ResDT.Rows[i]["RestaurantID"].ToString());
                    list.Add(_SeeCount);
                }

                //2.查询出看了当前餐馆用户IP
                DataTable     ViewerIPDT = _ClickLogBLL.GetSeeResIDPeople(CurrentResID);
                List <String> IPList     = new List <String>();
                for (int j = 0; j < ViewerIPDT.Rows.Count; j++)
                {
                    if (!IPList.Contains(ViewerIPDT.Rows[j]["IP"].ToString()))
                    {
                        IPList.Add(ViewerIPDT.Rows[j]["IP"].ToString());
                    }
                }
                //3.查询出当前IP 看过的餐馆 并统计次数
                for (int l = 0; l < IPList.Count; l++)
                {
                    DataTable CurrentResDT = _ClickLogBLL.GetAllOneSee(IPList[l], "餐馆");
                    //将餐馆合并
                    List <int> ResList = new List <int>();
                    for (int m = 0; m < CurrentResDT.Rows.Count; m++)
                    {
                        if (!ResList.Contains(int.Parse(CurrentResDT.Rows[m]["ContentFlag"].ToString())))
                        {
                            ResList.Add(int.Parse(CurrentResDT.Rows[m]["ContentFlag"].ToString()));
                        }
                    }

                    for (int p = 0; p < ResList.Count; p++)
                    {
                        for (int n = 0; n < list.Count; n++)
                        {
                            if (list[n].KeyID == ResList[p])
                            {
                                list[n].Count++;
                            }
                        }
                    }
                }
                //4.先删除当前餐馆ID再根据次数排序
                for (int a = 0; a < list.Count; a++)
                {
                    if (list[a].KeyID == CurrentResID)
                    {
                        list.RemoveAt(a);
                    }
                }
                //先根据餐馆ID删除该餐馆的看了又看  然后按次序执行插入

                _LookAnotherBLL.DelByIDType(CurrentResID, "餐馆");



                ;
                for (int v = 0; v < 1; v++)
                {
                    LookAnotherInfo _LookAnotherInfo = new LookAnotherInfo();
                    _LookAnotherInfo.KeyID         = CurrentResID;
                    _LookAnotherInfo.AnotherLookID = list[v].KeyID;
                    _LookAnotherInfo.GoalType      = "餐馆";

                    _LookAnotherBLL.AddLookAnother(_LookAnotherInfo);
                }
            }
            return(true);
        }
Пример #11
0
        //根据美食ID删除美食信息
        protected void deleteThis()
        {
            int    CityID         = int.Parse(Request.QueryString["CityID"].ToString());
            int    PageStart      = int.Parse(Request.QueryString["PageStart"].ToString());
            String RestaurantName = Request.QueryString["RestaurantName"].ToString();
            int    RestaurantID   = int.Parse(Request.QueryString["RestaurantID"].ToString());

            try
            {
                Array delWitch  = rqid.Split('|');
                bool  isPicTrue = false;
                bool  isTrue    = false;

                for (int i = 0; i < delWitch.Length - 1; i++)
                {
                    int delid = Convert.ToInt32(delWitch.GetValue(i));

                    RestaurantInfoBLL _ResBLL     = new RestaurantInfoBLL();
                    PicInfoBLL        _PicInfoBLL = new PicInfoBLL();
                    if (_ResBLL.DelFoodByFoodID(delid))
                    {
                        isTrue = true;
                    }
                    else
                    {
                        isTrue = false;
                    }


                    if (isTrue == false)
                    {
                        break;
                    }
                    //删除美食图片
                    DataTable FoodDT = _PicInfoBLL.GetFoodPicByFID(delid);
                    if (FoodDT.Rows.Count > 0)
                    {
                        for (int j = 0; j < FoodDT.Rows.Count; j++)
                        {
                            int PicTempID = int.Parse(FoodDT.Rows[j]["PicID"].ToString());

                            if (_PicInfoBLL.DelFoodPicByPicID(PicTempID) && _PicInfoBLL.DelPicByID(PicTempID))
                            {
                                isPicTrue = true;
                            }
                            else
                            {
                                isPicTrue = false;
                                break;
                            }
                        }
                    }
                    else
                    {
                        isPicTrue = true;
                    }
                    if (isPicTrue == false)
                    {
                        break;
                    }
                }

                if (!(isTrue == false || isPicTrue == false))
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除成功!');");
                    Response.Write("document.location.href='RestaurantFoodList.aspx?RestaurantID=" + RestaurantID.ToString() + "&RestaurantName=" + RestaurantName + "&CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';");
                    Response.Write("</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>");
                    Response.Write("alert('删除失败!');");
                    Response.Write("document.location.href='RestaurantFoodList.aspx?RestaurantID=" + RestaurantID.ToString() + "&RestaurantName=" + RestaurantName + "&CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';");
                    Response.Write("</script>");
                }
            }
            catch
            {
                Response.Write("<script language='javascript'>");
                Response.Write("alert('删除失败!');");
                Response.Write("document.location.href='RestaurantFoodList.aspx?RestaurantID=" + RestaurantID.ToString() + "&RestaurantName=" + RestaurantName + "&CityID=" + CityID.ToString() + "&PageStart=" + PageStart.ToString() + "';");
                Response.Write("</script>");
            }
        }