示例#1
0
        /// <summary>
        /// 修改图片
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public virtual bool Update(MScenicImg item)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("declare @imgAddress nvarchar(500)");
            sql.Append(" select @imgAddress = Address from tbl_ScenicImg WHERE ImgId = @id AND ImgType = @type");
            sql.AppendFormat(" if @imgAddress <> '{0}'", item.Address);
            sql.Append(" begin");
            sql.AppendFormat(" INSERT INTO tbl_SysDeletedFileQue(FilePath,FileState) VALUES(@imgAddress,0)");
            sql.Append(" UPDATE tbl_ScenicImg SET Address = @address,ThumbAddress=@ThumbAddress,Description = @des WHERE ImgId = @id AND ImgType = @type");
            sql.Append(" end");
            sql.Append(" else begin");
            sql.Append(" UPDATE tbl_ScenicImg SET Description = @des WHERE ImgId = @id AND ImgType = @type");
            sql.Append(" end");

            DbCommand comm = this._db.GetSqlStringCommand(sql.ToString());

            this._db.AddInParameter(comm, "@address", DbType.String, item.Address);
            this._db.AddInParameter(comm, "@ThumbAddress", DbType.String, item.ThumbAddress);
            this._db.AddInParameter(comm, "@des", DbType.String, item.Description);
            this._db.AddInParameter(comm, "@id", DbType.AnsiStringFixedLength, item.ImgId);
            this._db.AddInParameter(comm, "@type", DbType.Byte, (int)item.ImgType);

            return(DbHelper.ExecuteSql(comm, this._db) > 0 ? true : false);
        }
示例#2
0
        /// <summary>
        /// 获取景区图片
        /// </summary>
        /// <param name="scenicId">景区编号</param>
        /// <returns></returns>
        public virtual IList <MScenicImg> GetList(string scenicId)
        {
            string    sql  = "SELECT a.ImgId,a.ImgType,a.Address,a.ThumbAddress,a.Description,a.CompanyId,b.ScenicName,b.Id FROM tbl_ScenicImg a inner join tbl_ScenicArea b on a.ScenicId = b.ScenicId WHERE a.ScenicId = @ScenicId order by ImgType";
            DbCommand comm = this._db.GetSqlStringCommand(sql);

            this._db.AddInParameter(comm, "@ScenicId", DbType.AnsiStringFixedLength, scenicId);

            IList <MScenicImg> list = new List <MScenicImg>();
            MScenicImg         item = null;

            using (IDataReader reader = DbHelper.ExecuteReader(comm, this._db))
            {
                while (reader.Read())
                {
                    list.Add(
                        item = new MScenicImg()
                    {
                        Id           = long.Parse(reader["Id"].ToString()),
                        ImgId        = reader["ImgId"].ToString(),
                        ImgType      = (ScenicImgType)Enum.Parse(typeof(ScenicImgType), reader["ImgType"].ToString()),
                        Address      = reader["Address"].ToString(),
                        ThumbAddress = reader.IsDBNull(reader.GetOrdinal("ThumbAddress")) ? string.Empty : reader["ThumbAddress"].ToString(),
                        Description  = reader.IsDBNull(reader.GetOrdinal("Description")) ? string.Empty : reader["Description"].ToString(),
                        ScenicId     = scenicId,
                        CompanyId    = reader["CompanyId"].ToString(),
                        ScenicName   = reader["ScenicName"].ToString()
                    });
                }
            }
            return(list);
        }
示例#3
0
        /// <summary>
        /// 获取景区形象图片
        /// </summary>
        /// <param name="topNum"></param>
        /// <returns></returns>
        public virtual IList <MScenicImg> GetList(int topNum)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat("select top {0} A.Id, A.ScenicId,A.ScenicName,B.Address,B.ThumbAddress,A.CompanyId from tbl_ScenicArea A", topNum);
            sql.AppendFormat(" left join tbl_ScenicImg B on A.ScenicId = B.ScenicId and B.ImgType = {0}", (int)ScenicImgType.景区形象);
            sql.AppendFormat(" where A.Status = {0} AND A.B2B = {1}", (int)ExamineStatus.已审核, (int)ScenicB2BDisplay.列表置顶);
            sql.Append(" order by A.LastUpdateTime DESC");
            DbCommand comm = this._db.GetSqlStringCommand(sql.ToString());

            IList <MScenicImg> list = new List <MScenicImg>();
            MScenicImg         item = null;

            using (IDataReader reader = DbHelper.ExecuteReader(comm, this._db))
            {
                while (reader.Read())
                {
                    list.Add(item = new MScenicImg()
                    {
                        Id           = long.Parse(reader["Id"].ToString()),
                        ScenicId     = reader["ScenicId"].ToString(),
                        ScenicName   = reader["ScenicName"].ToString(),
                        ThumbAddress = reader.IsDBNull(reader.GetOrdinal("ThumbAddress")) ? string.Empty : reader["ThumbAddress"].ToString(),
                        Address      = reader.IsDBNull(reader.GetOrdinal("Address")) ? string.Empty : reader["Address"].ToString(),
                        CompanyId    = reader.IsDBNull(reader.GetOrdinal("CompanyId")) ? string.Empty : reader["CompanyId"].ToString()
                    });
                }
            }
            return(list);
        }
示例#4
0
        /// <summary>
        /// 更多图片
        /// </summary>
        /// <param name="filevalue">文件路径</param>
        /// <param name="scenicid">景区编号</param>
        /// <returns></returns>
        protected int AddScenicimages(string filevalue, string scenicid, string Description)
        {
            if (!string.IsNullOrEmpty(Description))
            {
                int        biaoshi = 0;
                MScenicImg modeld  = new MScenicImg();
                string[]   Arry    = filevalue.Split('|'); //"ctl00$ContentPlaceHolder1$SfpScenicimages$hidFileName"
                modeld.Address      = Arry[0].ToString();  //SfpScenicimages.FindControl("hidFileName").UniqueID
                modeld.Description  = Description;
                modeld.ThumbAddress = Arry[1].ToString();
                modeld.ImgType      = ScenicImgType.其他;
                modeld.ScenicId     = scenicid;
                modeld.ImgId        = Guid.NewGuid().ToString();
                modeld.CompanyId    = this.SiteUserInfo.CompanyID;
                if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Add(modeld))
                {
                    biaoshi = 1;
                }
                else
                {
                    biaoshi = 2;
                }

                //this.rpt_ImgList.DataSource = GetListByImgType(ScenicImgType.其他);
                //this.rpt_ImgList.DataBind();
                return(biaoshi);
            }
            return(2);
        }
示例#5
0
        /// <summary>
        /// 修改图片
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Update(MScenicImg item)
        {
            bool result = false;

            if (item != null && !string.IsNullOrEmpty(item.Address) &&
                !string.IsNullOrEmpty(item.ImgId))
            {
                result = dal.Update(item);
            }
            return(result);
        }
示例#6
0
        /// <summary>
        /// 添加景区图片
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Add(MScenicImg item)
        {
            bool result = false;

            if (item != null && !string.IsNullOrEmpty(item.CompanyId) && !string.IsNullOrEmpty(item.Address))
            {
                item.ImgId = Guid.NewGuid().ToString();
                result     = dal.Add(item);
            }
            return(result);
        }
示例#7
0
        /// <summary>
        /// 添加景区图片
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public virtual bool Add(MScenicImg item)
        {
            string    sql  = "INSERT INTO tbl_ScenicImg(ImgId,ScenicId,ImgType,Address,ThumbAddress,Description,CompanyId) VALUES(@id,@sid,@type,@address,@ThumbAddress,@des,@com)";
            DbCommand comm = this._db.GetSqlStringCommand(sql);

            this._db.AddInParameter(comm, "@id", DbType.AnsiStringFixedLength, item.ImgId);
            this._db.AddInParameter(comm, "@sid", DbType.AnsiStringFixedLength, item.ScenicId);
            this._db.AddInParameter(comm, "@type", DbType.Byte, (int)item.ImgType);
            this._db.AddInParameter(comm, "@address", DbType.String, item.Address);
            this._db.AddInParameter(comm, "@ThumbAddress", DbType.String, item.ThumbAddress);
            this._db.AddInParameter(comm, "@des", DbType.String, item.Description);
            this._db.AddInParameter(comm, "@com", DbType.AnsiStringFixedLength, item.CompanyId);

            return(DbHelper.ExecuteSql(comm, this._db) > 0 ? true : false);
        }
示例#8
0
        /// <summary>
        /// 指定条数获取景区图片
        /// </summary>
        /// <param name="topNum">获取条数</param>
        /// <param name="companyId">公司编号</param>
        /// <param name="search">搜索实体</param>
        /// <returns></returns>
        public virtual IList <MScenicImg> GetList(int topNum, string companyId, MScenicImgSearch search)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("select ");
            if (topNum > 0)
            {
                sql.AppendFormat(" top({0})", topNum);
            }
            sql.Append(" ImgId,ScenicId,CompanyId,ImgType,Address,ThumbAddress,Description,ScenicName");
            sql.Append(" from view_ScenicImg_Select ");
            sql.AppendFormat(" where CompanyId = '{0}'", companyId);
            if (search != null)
            {
                //图片类型
                if (search.ImgType != null && search.ImgType.Count() > 0)
                {
                    sql.AppendFormat(" and ImgType in {0}", ConvertScenicImgType(search.ImgType));
                }
            }
            sql.Append(" Order By ImgType ASC");
            DbCommand          comm = this._db.GetSqlStringCommand(sql.ToString());
            IList <MScenicImg> list = new List <MScenicImg>();
            MScenicImg         item = null;

            using (IDataReader reader = DbHelper.ExecuteReader(comm, this._db))
            {
                while (reader.Read())
                {
                    list.Add(item = new MScenicImg()
                    {
                        ImgId        = reader["ImgId"].ToString(),
                        ImgType      = (ScenicImgType)Enum.Parse(typeof(ScenicImgType), reader["ImgType"].ToString()),
                        Address      = reader["Address"].ToString(),
                        ThumbAddress = reader.IsDBNull(reader.GetOrdinal("ThumbAddress")) ? string.Empty : reader["ThumbAddress"].ToString(),
                        Description  = reader.IsDBNull(reader.GetOrdinal("Description")) ? string.Empty : reader["Description"].ToString(),
                        ScenicId     = reader["ScenicId"].ToString(),
                        CompanyId    = reader.IsDBNull(reader.GetOrdinal("CompanyId")) ? string.Empty : reader["CompanyId"].ToString(),
                        ScenicName   = reader["ScenicName"].ToString()
                    });
                }
            }
            return(list);
        }
示例#9
0
        /// <summary>
        /// 获取景区图片
        /// </summary>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="companyId">公司编号</param>
        /// <param name="search">搜索实体</param>
        /// <returns></returns>
        public virtual IList <MScenicImg> GetList(int pageSize, int pageIndex, ref int recordCount,
                                                  string companyId, MScenicImgSearch search)
        {
            string        tableName  = "view_ScenicImg_Select";
            string        primaryKey = "ImgId";
            string        orderBy    = "ImgType ASC";
            string        fileds     = "ImgId,ScenicId,CompanyId,ImgType,Address,Description,ThumbAddress,ScenicName";
            StringBuilder query      = new StringBuilder();

            query.AppendFormat(" CompanyId = '{0}'", companyId);
            if (search != null)
            {
                //图片类型
                if (search.ImgType != null && search.ImgType.Count() > 0)
                {
                    query.AppendFormat(" and ImgType in {0}", ConvertScenicImgType(search.ImgType));
                }
            }
            IList <MScenicImg> list = new List <MScenicImg>();
            MScenicImg         item = null;

            using (IDataReader reader = DbHelper.ExecuteReader(this._db, pageSize, pageIndex, ref recordCount,
                                                               tableName, primaryKey, fileds, query.ToString(), orderBy))
            {
                while (reader.Read())
                {
                    list.Add(item = new MScenicImg()
                    {
                        ImgId        = reader["ImgId"].ToString(),
                        ImgType      = (ScenicImgType)Enum.Parse(typeof(ScenicImgType), reader["ImgType"].ToString()),
                        Address      = reader["Address"].ToString(),
                        ThumbAddress = reader.IsDBNull(reader.GetOrdinal("ThumbAddress")) ? string.Empty : reader["ThumbAddress"].ToString(),
                        Description  = reader.IsDBNull(reader.GetOrdinal("Description")) ? string.Empty : reader["Description"].ToString(),
                        ScenicId     = reader["ScenicId"].ToString(),
                        CompanyId    = reader.IsDBNull(reader.GetOrdinal("CompanyId")) ? string.Empty : reader["CompanyId"].ToString(),
                        ScenicName   = reader["ScenicName"].ToString()
                    });
                }
            }

            return(list);
        }
示例#10
0
        /// <summary>
        /// 获取景区照片实体
        /// </summary>
        public void GetScenicPhoto()
        {
            modelScenicImg1 = new MScenicImg();
            modelScenicImg2 = new MScenicImg();
            IList <MScenicImg> nlistScenicImg = new List <MScenicImg>();
            IList <MScenicImg> listScenicImg  = EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().GetList(DpScenicArea.SelectedValue);

            if (listScenicImg.Count > 0)
            {
                foreach (var item in listScenicImg)
                {
                    switch (item.ImgType)
                    {
                    case ScenicImgType.景区导游地图:
                        if (item != null)
                        {
                            modelScenicImg2     = item;
                            Scenicviewdes.Value = scenicname + modelScenicImg2.Description;
                        }
                        break;

                    case ScenicImgType.景区形象:
                        if (item != null)
                        {
                            modelScenicImg1      = item;
                            Scenicimagedes.Value = scenicname + modelScenicImg1.Description;
                        }
                        break;

                    case ScenicImgType.其他:
                        if (item != null)
                        {
                            nlistScenicImg.Add(item);
                        }
                        break;
                    }
                }
            }
            this.RephotoList.DataSource = nlistScenicImg;
            this.RephotoList.DataBind();
        }
示例#11
0
        /// <summary>
        /// 景区导览图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Btn_Scenicview_Click(object sender, EventArgs e)
        {
            MScenicImg modeld = new MScenicImg();

            if (GetListByImgType(ScenicImgType.景区导游地图).Count > 0)
            {
                modeld = GetListByImgType(ScenicImgType.景区导游地图)[0];
            }
            modeld.Address      = Utils.GetFormValue(SfpScenicview.FindControl("hidFileName").UniqueID).Split('|')[0];
            modeld.ThumbAddress = Utils.GetFormValue(SfpScenicview.FindControl("hidFileName").UniqueID).Split('|')[1];
            modeld.ImgType      = ScenicImgType.景区导游地图;
            modeld.ScenicId     = DpScenicArea.SelectedValue;
            modeld.CompanyId    = companyid;
            modeld.Description  = Scenicviewdes.Value;

            if (!string.IsNullOrEmpty(modeld.ImgId))
            {
                if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Update(modeld))
                {
                    MessageBox.Show(Page, "修改景区导游地图成功");
                }
                else
                {
                    MessageBox.Show(Page, "修改景区导游地图失败");
                }
            }
            else
            {
                modeld.ImgId = Guid.NewGuid().ToString();
                if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Add(modeld))
                {
                    MessageBox.Show(Page, "上传景区导游地图成功");
                }
                else
                {
                    MessageBox.Show(Page, "上传景区导游地图失败");
                }
            }
            scenicid = DpScenicArea.SelectedValue;
            GetScenicPhoto();
        }
示例#12
0
        /// <summary>
        /// 景区导览图
        /// </summary>
        /// <param name="filevalue">文件路径</param>
        /// <param name="scenicid">景区编号</param>
        /// <returns></returns>
        protected int UpdateOrAddScenicview(string filevalue, string scenicid)
        {
            int        biaoshi = 0;
            MScenicImg modeld  = new MScenicImg();

            if (GetListByImgType(ScenicImgType.景区导游地图).Count > 0)
            {
                modeld = GetListByImgType(ScenicImgType.景区导游地图)[0];
            }
            string[] Arry = filevalue.Split('|');
            modeld.Address      = Arry[0].ToString();//SfpScenicview.FindControl("hidFileName").UniqueID
            modeld.ThumbAddress = Arry[1].ToString();
            modeld.Description  = this.txtSceniceview.Value;
            modeld.ImgType      = ScenicImgType.景区导游地图;
            modeld.ScenicId     = scenicid;
            modeld.CompanyId    = this.SiteUserInfo.CompanyID;
            if (!string.IsNullOrEmpty(modeld.ImgId))
            {
                if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Update(modeld))
                {
                    biaoshi = 1;
                }
                else
                {
                    biaoshi = 2;
                }
            }
            else
            {
                modeld.ImgId = Guid.NewGuid().ToString();
                if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Add(modeld))
                {
                    biaoshi = 3;
                }
                else
                {
                    biaoshi = 4;
                }
            }
            return(biaoshi);
        }
示例#13
0
        /// <summary>
        ///  景区形象图片
        /// </summary>
        /// <param name="filevalue">文件路径</param>
        /// <param name="scenicid">景区编号</param>
        /// <returns></returns>
        protected int UpdateOrAddScenicimage(string filevalue, string scenicid)
        {
            int        biaoshi = 0;
            MScenicImg modeld  = new MScenicImg();

            if (GetListByImgType(ScenicImgType.景区形象).Count > 0)
            {
                modeld = GetListByImgType(ScenicImgType.景区形象)[0];
            }
            string[] Array = filevalue.Split('|');
            modeld.Address      = Array[0];
            modeld.ThumbAddress = Array[1];
            modeld.Description  = this.txtSceniceimage.Value;
            modeld.ImgType      = ScenicImgType.景区形象;
            modeld.ScenicId     = scenicid;
            modeld.CompanyId    = this.SiteUserInfo.CompanyID;
            if (!string.IsNullOrEmpty(modeld.ImgId))
            {
                if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Update(modeld))
                {
                    biaoshi = 1;//修改景区形象成功
                }
                else
                {
                    biaoshi = 2;//修改失败
                }
            }
            else
            {
                modeld.ImgId = Guid.NewGuid().ToString();
                if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Add(modeld))
                {
                    biaoshi = 3;//添加成功
                }
                else
                {
                    biaoshi = 4;//添加失败
                }
            }
            return(biaoshi);
        }
示例#14
0
        /// <summary>
        ///  更多图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Btn_Scenicimages_Click(object sender, EventArgs e)
        {
            MScenicImg modeld = new MScenicImg();

            modeld.Address      = Utils.GetFormValue(SfpScenicimages.FindControl("hidFileName").UniqueID).Split('|')[0];
            modeld.ThumbAddress = Utils.GetFormValue(SfpScenicimages.FindControl("hidFileName").UniqueID).Split('|')[1];
            modeld.Description  = Utils.GetFormValue(txtDescription.UniqueID);
            modeld.ImgType      = ScenicImgType.其他;
            modeld.ScenicId     = DpScenicArea.SelectedValue;
            modeld.ImgId        = Guid.NewGuid().ToString();
            modeld.CompanyId    = companyid;
            if (EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().Add(modeld))
            {
                MessageBox.Show(Page, "上传成功");
                txtDescription.Value = "";
            }
            else
            {
                MessageBox.Show(Page, "上传失败");
            }
            GetScenicPhoto();
        }
示例#15
0
        /// <summary>
        /// 获取景区照片实体
        /// </summary>
        public void GetScenicPhoto(string scenicid)
        {
            IList <MScenicImg> nlistScenicImg = new List <MScenicImg>();
            IList <MScenicImg> listScenicImg  = EyouSoft.BLL.ScenicStructure.BScenicImg.CreateInstance().GetList(scenicid);

            if (listScenicImg.Count > 0)
            {
                foreach (EyouSoft.Model.ScenicStructure.MScenicImg item in listScenicImg)
                {
                    switch (item.ImgType)
                    {
                    case ScenicImgType.景区导游地图:
                        if (item != null)
                        {
                            modelScenicImg2 = item;
                        }
                        break;

                    case ScenicImgType.景区形象:
                        if (item != null)
                        {
                            modelScenicImg1 = item;
                        }
                        break;

                    case ScenicImgType.其他:
                        if (item != null)
                        {
                            nlistScenicImg.Add(item);
                        }
                        break;
                    }
                }
            }
            //this.rpt_ImgList.DataSource = nlistScenicImg;
            //this.rpt_ImgList.DataBind();
        }