Example #1
0
        ///<summary>
        ///获取资讯详情
        ///informationID:资讯ID
        /// </summary>
        public Information InformationShow(int InformationID)
        {
            try
            {
                string           sql1 = "UPDATE information set ReadCount=ReadCount+1 where InformationID=@Id";
                string           sql  = "select * from information where InformationID=@Id";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@Id", InformationID)
                };
                MySqlDB.nonquery(sql1, CommandType.Text, para);
                DataTable   dt   = MySqlDB.GetDataTable(sql, CommandType.Text, para);
                Information info = new Information();
                info.InformationID     = (int)dt.Rows[0]["InformationID"];
                info.Title             = dt.Rows[0]["Title"].ToString();
                info.content           = dt.Rows[0]["Content"].ToString();
                info.InfoDate          = dt.Rows[0]["InfoDate"].ToString();
                info.Source            = dt.Rows[0]["Source"].ToString();
                info.Author            = dt.Rows[0]["Author"].ToString();
                info.ReadCount         = (int)dt.Rows[0]["ReadCount"];
                info.InfoKeyWord       = dt.Rows[0]["InfoKeyWord"].ToString();
                info.InformationImgUrl = dt.Rows[0]["InformationImgUrl"].ToString();

                Log4netHelper.WriteLog("日志报告");
                return(info);
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误报告", ex);
                return(null);
            }
        }
Example #2
0
        ///// <summary>
        ///// 根据热度显示资讯列表(分页)
        ///// </summary>
        ///// <param name="pageindex"></param>
        ///// <returns></returns>
        //public List<Information> GetInformationList(int pageindex, int pagesize, out int rowcounts)
        //{
        //    string sql = "SELECT SQL_CALC_FOUND_ROWS * FROM information ORDER BY ReadCount DESC LIMIT " + (pageindex - 1) * pagesize + ", " + pagesize + ";SELECT FOUND_ROWS(); ";
        //    List<Information> list = MySqlDB.GetList<Information>(sql, System.Data.CommandType.Text, null);
        //    foreach (var item in list)
        //    {
        //        if (item.Content.Length > 50)
        //        {
        //            item.Content = item.Content.ToString().Substring(0, 25);
        //        }
        //    }
        //    string sql2 = "select count(1) from information";
        //    rowcounts = MySqlDB.scalar(sql2, System.Data.CommandType.Text, null);
        //    return list;
        //}


        /// <summary>
        /// 活动详情
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public Active ActiveShow(int Id)
        {
            try
            {
                string           sql1 = "update active set HeatID=HeatID+1 where ActiveID=@Id ";
                string           sql  = "select * from active left join areases on active.Site=areases.AreaID where ActiveID=@Id";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@Id", Id)
                };
                MySqlDB.nonquery(sql1, CommandType.Text, para);
                DataTable dt     = MySqlDB.GetDataTable(sql, CommandType.Text, para);
                Active    active = new Active();
                active.ActiveID      = (int)dt.Rows[0]["ActiveID"];
                active.ActiveTitle   = dt.Rows[0]["ActiveTitle"].ToString();
                active.ActiveDate    = dt.Rows[0]["ActiveDate"].ToString();
                active.Site          = Convert.ToInt32(dt.Rows[0]["Site"]);
                active.Datails       = dt.Rows[0]["Datails"].ToString();
                active.ActivePhone   = dt.Rows[0]["ActivePhone"].ToString();
                active.HeatID        = (int)dt.Rows[0]["HeatID"];
                active.AreaID        = (int)dt.Rows[0]["AreaID"];
                active.AreaName      = dt.Rows[0]["AreaName"].ToString();
                active.ActiveKeyWord = dt.Rows[0]["ActiveKeyWord"].ToString();

                Log4netHelper.WriteLog("日至报告");
                return(active);
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误日志", ex);
                return(null);
            }
        }
        ///<summary>
        ///规划详情
        ///<para>Id:规划ID</para>
        /// </summary>
        public StudentProgram StudentShow(int Id)
        {
            try
            {
                string sql1 = "update `studentprogram` set ReadCount=ReadCount+1 where StudentProgramID=" + Id + "";
                MySqlDB.nonquery(sql1, CommandType.Text, null);
                string           sql  = "select * from studentprogram left join country on studentprogram.CountryID=country.CountryID left join educationtype on studentprogram.EducationID=educationtype.EducationID where StudentProgramID = @Id";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@Id", Id)
                };
                DataTable      dt      = MySqlDB.GetDataTable(sql, CommandType.Text, para);
                StudentProgram student = new StudentProgram();
                student.Author = dt.Rows[0]["Author"].ToString();
                //student.Image = Convert.ToBase64String((byte[])dt.Rows[0]["Image"]);
                student.CountryName           = dt.Rows[0]["CountryName"].ToString();
                student.EducationName         = dt.Rows[0]["EducationName"].ToString();
                student.ReadCount             = (int)dt.Rows[0]["ReadCount"];
                student.StudentProgramContent = dt.Rows[0]["StudentProgramContent"].ToString();
                student.StudentProgramTitle   = dt.Rows[0]["StudentProgramTitle"].ToString();
                student.Source         = dt.Rows[0]["Source"].ToString();
                student.StudentKeyWord = dt.Rows[0]["StudentKeyWord"].ToString();
                student.StudentProfile = dt.Rows[0]["StudentProfile"].ToString();
                student.Imageurl       = dt.Rows[0]["Imageurl"].ToString();

                Log4netHelper.WriteLog("日志报告");
                return(student);
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误日志", ex);
                throw ex;
            }
        }
Example #4
0
        ///<summary>
        ///观点详情
        /// </summary>
        public Option OptionShow(int Id)
        {
            try
            {
                string sql1 = "update `optioninfo` set OptionHot=OptionHot+1 where OptionID='" + Id + "'";
                MySqlDB.nonquery(sql1, CommandType.Text, null);
                string    sql = "select * from `optioninfo` where OptionID='" + Id + "' ";
                DataTable dt  = MySqlDB.GetDataTable(sql, CommandType.Text, null);
                Option    op  = MySqlDB.fanshemodel <Option>(dt);
                //DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, null);
                //Option op = new Option();
                //op.OptionTitle = dt.Rows[0]["OptionTitle"].ToString();
                //op.OptionContent = dt.Rows[0]["OptionContent"].ToString();
                //op.Author = dt.Rows[0]["Author"].ToString();
                //op.Source = dt.Rows[0]["Source"].ToString();
                //op.Date = dt.Rows[0]["Date"].ToString();
                //op.OptionHot = (int)dt.Rows[0]["OptionHot"];

                return(op);
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误报告", ex);
                throw ex;
            }
        }
Example #5
0
        public bool EditByModel(NavInfoModel model)
        {
            bool res = false;

            try
            {
                string           sql  = "update NavInfo set NavTitleOne=@NavTitleOne,NavContentOne=@NavContentOne,NavParentID=@NavParentID,NavTypeID=@NavTypeID,NavIsLevel=@NavIsLevel,NavDate=@NavDate,NavCreateBy=@NavCreateBy,NavHeat=@NavHeat,NavTitleTwo=@NavTitleTwo,NavContentTwo=@NavContentTwo,GuoJia=@GuoJia,BuWei=@BuWei,PaiXu=@PaiXu,depth=@depth,LinkFor=@LinkFor,KeyWord=@KeyWord   where NavID=@NavID";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@NavID",         model.NavId),
                    new MySqlParameter("@NavTitleOne",   model.NavTitleOne),
                    new MySqlParameter("@NavContentOne", model.NavContentOne),
                    new MySqlParameter("@NavParentID",   model.NavParentId),
                    new MySqlParameter("@NavTypeID",     model.NavType),
                    new MySqlParameter("@NavIsLevel",    model.NavIsLevel),
                    new MySqlParameter("@NavDate",       model.NavDate),
                    new MySqlParameter("@NavCreateBy",   model.NavCreateBy),
                    new MySqlParameter("@NavHeat",       model.NavHeat),
                    new MySqlParameter("@NavTitleTwo",   model.NavTitleTwo),
                    new MySqlParameter("@NavContentTwo", model.NavContentTwo),
                    new MySqlParameter("@GuoJia",        model.GuoJia),
                    new MySqlParameter("@BuWei",         model.BuWei),
                    new MySqlParameter("@PaiXu",         model.PaiXu),
                    new MySqlParameter("@depth",         model.Depth),
                    new MySqlParameter("@LinkFor",       model.LinkFor),
                    new MySqlParameter("@KeyWord",       model.KeyWord)
                };
                int n = MySqlDB.nonquery(sql, CommandType.Text, para);
                if (n > 0)
                {
                    res = true;
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误报告", ex);
                throw ex;
            }
            return(res);
        }
Example #6
0
        /// <summary>
        /// 添加申请
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public bool Addapply(Apply a)
        {
            string sql = "insert into apply (CountryName,UserName,Phone,GoTime) values(?countryname,?username,?phone,?gotime)";

            MySqlParameter[] pars =
            {
                new MySqlParameter("?countryname", a.CountryName),
                new MySqlParameter("?username",    a.UserName),
                new MySqlParameter("?phone",       a.Phone),
                new MySqlParameter("?gotime",      a.GoTime)
            };
            int i = MySqlDB.nonquery(sql, System.Data.CommandType.Text, pars);

            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #7
0
        public bool AddByModel(NavInfoModel model)
        {
            bool res = false;

            try
            {
                string           sql  = "insert into NavInfo (NavTitleOne,NavContentOne,NavParentID,NavTypeID,NavIsLevel,NavDate,NavCreateBy,NavHeat ,NavTitleTwo,NavContentTwo,GuoJia,BuWei,PaiXu,depth,LinkFor,KeyWord) Values (@NavTitleOne,@NavContentOne,@NavParentID,@NavTypeID,@NavIsLevel,@NavDate,@NavCreateBy,@NavHeat,@NavTitleTwo,@NavContentTwo,@GuoJia,@BuWei,@PaiXu,@depth,@LinkFor,@KeyWord)";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@NavTitleOne",   model.NavTitleOne),
                    new MySqlParameter("@NavContentOne", model.NavContentOne),
                    new MySqlParameter("@NavParentID",   model.NavParentId),
                    new MySqlParameter("@NavTypeID",     model.NavType),
                    new MySqlParameter("@NavIsLevel",    model.NavIsLevel),
                    new MySqlParameter("@NavDate",       model.NavDate),
                    new MySqlParameter("@NavCreateBy",   model.NavCreateBy),
                    new MySqlParameter("@NavHeat",       model.NavHeat),
                    new MySqlParameter("@NavTitleTwo",   model.NavTitleTwo),
                    new MySqlParameter("@NavContentTwo", model.NavContentTwo),
                    new MySqlParameter("@GuoJia",        model.GuoJia),
                    new MySqlParameter("@BuWei",         model.BuWei),
                    new MySqlParameter("@PaiXu",         model.PaiXu),
                    new MySqlParameter("@depth",         model.Depth),
                    new MySqlParameter("@LinkFor",       model.LinkFor),
                    new MySqlParameter("@KeyWord",       model.KeyWord)
                };
                int n = MySqlDB.nonquery(sql, CommandType.Text, para);
                if (n > 0)
                {
                    res = true;
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误报告", ex);
                throw ex;
            }
            return(res);
        }
        /// <summary>
        /// 获取分享详情
        /// </summary>
        /// <returns></returns>
        public JiaJiNewWebModel.Share GetShareContent(int shareid)
        {
            try
            {
                string           sql1 = "update Shares set ShareReadCount=ShareReadCount+1 where ShareID=@Id ";
                string           sql  = "select ShareID,ShareTitle,ShareContent,ShareImg,ShareDate,Pro_Img,ProactiveImg1,ProactiveImg2,Shares.LearnerID,LearnName,Pro_Name,shares.Pro_ID,ShareProfile,ShareKeyword,ShareReadCount from Shares LEFT JOIN projectitem on shares.Pro_ID=projectitem.Pro_ID left join learner on learner.LearnerID=Shares.LearnerID where Shares.ShareID=@Id ";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@Id", shareid)
                };
                MySqlDB.nonquery(sql1, CommandType.Text, para);
                DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, para);
                JiaJiNewWebModel.Share model = new JiaJiNewWebModel.Share();
                model.ShareID        = (int)dt.Rows[0]["ShareID"];
                model.ShareTitle     = dt.Rows[0]["ShareTitle"].ToString();
                model.ShareContent   = dt.Rows[0]["ShareContent"].ToString();
                model.ShareImg       = dt.Rows[0]["ShareImg"].ToString();
                model.ShareDate      = dt.Rows[0]["ShareDate"].ToString();
                model.Pro_Img        = dt.Rows[0]["Pro_Img"].ToString();
                model.ProactiveImg1  = dt.Rows[0]["ProactiveImg1"].ToString();
                model.ProactiveImg2  = dt.Rows[0]["ProactiveImg2"].ToString();
                model.LearnerID      = Convert.ToInt32(dt.Rows[0]["LearnerID"]);
                model.LearnName      = dt.Rows[0]["LearnName"].ToString();
                model.Pro_Name       = dt.Rows[0]["Pro_Name"].ToString();
                model.Pro_ID         = (int)dt.Rows[0]["Pro_ID"];
                model.LearnerID      = Convert.ToInt32(dt.Rows[0]["LearnerID"]);
                model.ShareProfile   = dt.Rows[0]["ShareProfile"].ToString();
                model.ShareKeyword   = dt.Rows[0]["ShareKeyword"].ToString();
                model.ShareReadCount = Convert.ToInt32(dt.Rows[0]["ShareReadCount"]);

                Log4netHelper.WriteLog("系统日志,请求了ProjectItemDAL类下的GetShareList方法");
                return(model);
            }
            catch (System.Exception ex)
            {
                Log4netHelper.WriteLog("错误信息:请求了ProjectItemDAL类下的GetShareList方法", ex);
                return(null);
            }
        }
Example #9
0
        public bool DeleteByModel(NavInfoModel model)
        {
            bool res = false;

            try
            {
                string           sql  = "delete from NavInfo where NavID=@NavID";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@NavID", model.NavId)
                };
                int n = MySqlDB.nonquery(sql, CommandType.Text, para);
                if (n > 0)
                {
                    res = true;
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误报告", ex);
                throw ex;
            }
            return(res);
        }