Exemplo n.º 1
0
        //绑定信息
        private void BindInfo()
        {
            ClassLibrary.Model.SystemArticle systemArticleModel = systemArticleBLL.GetModel(articleID);

            dataTitle   = systemArticleModel.Title;
            dataContent = systemArticleModel.Content;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">SystemArticle对象</param>
        /// <returns>影响行数</returns>
        public int Update(ClassLibrary.Model.SystemArticle model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(string.Format("UPDATE {0} SET ", table));
            strSql.Append("classID=@classID,");
            strSql.Append("Title=@Title,");
            strSql.Append("Content=@Content,");
            strSql.Append("CreatedTime=@CreatedTime");
            strSql.Append(" WHERE ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",          SqlDbType.Int,       4),
                new SqlParameter("@classID",     SqlDbType.Int,       4),
                new SqlParameter("@Title",       SqlDbType.NVarChar, 60),
                new SqlParameter("@Content",     SqlDbType.Text),
                new SqlParameter("@CreatedTime", SqlDbType.DateTime, 8)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.classID;
            parameters[2].Value = model.Title;
            parameters[3].Value = model.Content;
            parameters[4].Value = model.CreatedTime;
            return(SQLHelper.Execute(strSql.ToString(), parameters));
        }
Exemplo n.º 3
0
        //修改信息
        private void Edit()
        {
            ClassLibrary.Model.SystemArticle systemArticleModel = new ClassLibrary.Model.SystemArticle();

            systemArticleModel.ID      = Convert.ToInt32(Request.Form["ID"]);
            systemArticleModel.Title   = Request.Form["Title"];
            systemArticleModel.Content = Request.Form["Content"];

            systemArticleModel.Content = systemArticleModel.Content.Replace("©", "&copy;");

            if (systemArticleBLL.Update(systemArticleModel) > 0)
            {
                Function.goMessagePage("添加系统文章", "操作成功", "SystemArticle/ArticleEdit.aspx?id=" + articleID);
            }
            else
            {
                Function.goMessagePage("添加系统文章", "操作失败", "SystemArticle/ArticleEdit.aspx?id=" + articleID);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">SystemArticle对象</param>
        public int Add(ClassLibrary.Model.SystemArticle model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(string.Format("INSERT INTO {0}(", table));
            strSql.Append("classID,Title,Content,CreatedTime");
            strSql.Append(") VALUES (");
            strSql.Append("@classID,@Title,@Content,@CreatedTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@classID",     SqlDbType.Int,       4),
                new SqlParameter("@Title",       SqlDbType.NVarChar, 60),
                new SqlParameter("@Content",     SqlDbType.Text),
                new SqlParameter("@CreatedTime", SqlDbType.DateTime, 8)
            };
            parameters[0].Value = model.classID;
            parameters[1].Value = model.Title;
            parameters[2].Value = model.Content;
            parameters[3].Value = model.CreatedTime;
            return(SQLHelper.Execute(strSql.ToString(), parameters));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        /// <param name="ID">主键ID</param>
        /// <returns>SystemArticle对象</returns>
        public ClassLibrary.Model.SystemArticle GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT ID,classID,Title,Content,CreatedTime");
            strSql.Append(" FROM ");
            strSql.Append(table);
            strSql.Append(string.Format(" WHERE {0}=@{0}", pk));
            SqlParameter[] parameters =
            {
                new SqlParameter("@" + pk, SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;
            ClassLibrary.Model.SystemArticle model = new ClassLibrary.Model.SystemArticle();
            DataTable dt = SQLHelper.Query(strSql.ToString(), parameters);

            model.ID = ID;
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["classID"] != DBNull.Value)
                {
                    model.classID = Convert.ToInt32(dt.Rows[0]["classID"]);
                }
                if (dt.Rows[0]["Title"] != DBNull.Value)
                {
                    model.Title = Convert.ToString(dt.Rows[0]["Title"]);
                }
                if (dt.Rows[0]["Content"] != DBNull.Value)
                {
                    model.Content = Convert.ToString(dt.Rows[0]["Content"]);
                }
                if (dt.Rows[0]["CreatedTime"] != DBNull.Value)
                {
                    model.CreatedTime = Convert.ToDateTime(dt.Rows[0]["CreatedTime"]);
                }
            }
            return(model);
        }
Exemplo n.º 6
0
 private void BindInfo()
 {
     ClassLibrary.BLL.SystemArticle   bll   = new ClassLibrary.BLL.SystemArticle();
     ClassLibrary.Model.SystemArticle model = bll.GetModel((int)SysConfig.SystemArticle.关于我们);
     dataAbout = model.Content.Replace(SysConfig.webSite, SysConfig.webSiteApp);
 }
Exemplo n.º 7
0
        private void BindBooking()
        {
            ClassLibrary.Model.SystemArticle samodel = saBll.GetModel((int)SysConfig.SystemArticle.如何预订);
            if (samodel != null)
            {
                bookinginfo = samodel.Content;
            }
            DateTime dnow = DateTime.Now;

            //StringBuilder sb = new StringBuilder();

            if (route.DateType)
            {
                if (route.DatePrice != "")
                {
                    string[]  dp         = route.DatePrice.Split('|');
                    Hashtable pricetable = new Hashtable();
                    foreach (string pi in dp)
                    {
                        if (pi.Trim() == "")
                        {
                            continue;
                        }
                        string[] dpi     = pi.Split(',');
                        string[] tpd     = dpi[0].Split('-');
                        DateTime tmpDate = new DateTime(Convert.ToInt32(tpd[0]), Convert.ToInt32(tpd[1]), Convert.ToInt32(tpd[2]));
                        if (tmpDate < DateTime.Now)
                        {
                            continue;
                        }
                        pricetable.Add(tmpDate, dpi[1] + "," + dpi[2]);
                    }
                    if (pricetable.Count > 0)
                    {
                        ArrayList priceList = new ArrayList(pricetable.Keys);
                        priceList.Sort();  //从小到大排序
                        //priceList.Reverse(); 顺序反转
                        foreach (DateTime dtitem in priceList)
                        {
                            bookingday = dtitem.Year + "-" + dtitem.Month + "-" + dtitem.Day;
                            string[] cprice = pricetable[dtitem].ToString().Split(',');
                            bookingAdultPrice = Convert.ToInt32(cprice[0]);
                            bookingChildPrice = Convert.ToInt32(cprice[1]);
                            if (bookingAdultPrice != 0)
                            {
                                strAdultPrice = bookingAdultPrice + "元";
                            }
                            break;
                        }
                    }
                }
                if (bookingday == "")
                {
                    dnow       = dnow.AddDays(1);
                    bookingday = dnow.Year + "-" + dnow.Month + "-" + dnow.Day;
                }
            }
            else
            {
                dnow              = dnow.AddDays(1);
                bookingday        = dnow.Year + "-" + dnow.Month + "-" + dnow.Day;
                bookingAdultPrice = Convert.ToInt32(route.Price);
                bookingChildPrice = Convert.ToInt32(route.ChildPrice);
                if (bookingAdultPrice != 0)
                {
                    strAdultPrice = bookingAdultPrice + "元";
                }
            }
        }
Exemplo n.º 8
0
 private void BindInfo()
 {
     ClassLibrary.BLL.SystemArticle bll = new ClassLibrary.BLL.SystemArticle();
     model = bll.GetModel(systemArticleID);
 }