コード例 #1
0
ファイル: PhotoDAL.cs プロジェクト: WZDotCMS/WZDotCMS
 public override void CreateContent(string _ChannelId, string _ContentId, int _CurrentPage)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT [PhotoUrl],[FirstPage] FROM [jcms_module_photo] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
         DataTable dtContent = _doh.GetDataTable();
         //图片地址分割处理
         string PhotoUrl = dtContent.Rows[0]["PhotoUrl"].ToString().Replace("\r\n", "\r");
         string ContentFirstPage = dtContent.Rows[0]["FirstPage"].ToString();
         dtContent.Clear();
         dtContent.Dispose();
         if (PhotoUrl != "")
         {
             string[] PhotoUrlArr = PhotoUrl.Split(new string[] { "\r" }, StringSplitOptions.RemoveEmptyEntries);
             int pageCount = PhotoUrlArr.Length;
             if (ContentFirstPage.Length == 0)
             {
                 _doh.Reset();
                 _doh.SqlCmd = "UPDATE [jcms_module_photo] SET [FirstPage]='" + Go2View(1, true, _ChannelId, _ContentId, false) + "' WHERE  [ChannelId]=" + _ChannelId + " and [IsPass]=1 and [Id]=" + _ContentId;
                 _doh.ExecuteSqlNonQuery();
             }
             for (int j = 1; j < (pageCount + 1); j++)
             {
                 JumboTCMS.Utils.DirFile.SaveFile(GetContent(_ChannelId, _ContentId, j), Go2View(j, true, _ChannelId, _ContentId, true));
             }
         }
     }
 }
コード例 #2
0
ファイル: ArticleDAL.cs プロジェクト: WZDotCMS/WZDotCMS
 public virtual void CreateContent(string _ChannelId, string _ContentId, int _CurrentPage)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT [Content],[FirstPage] FROM [jcms_module_article] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
         DataTable dtContent = _doh.GetDataTable();
         string ArticleContent = dtContent.Rows[0]["Content"].ToString();
         string ContentFirstPage = dtContent.Rows[0]["FirstPage"].ToString();
         dtContent.Clear();
         dtContent.Dispose();
         if (ArticleContent != "")
         {
             int pageCount = 1;
             //处理文章内容分页
             if (ArticleContent.Contains("[Jumbot_PageBreak]"))
             {
                 string[] ContentArr = ArticleContent.Split(new string[] { "[Jumbot_PageBreak]" }, StringSplitOptions.RemoveEmptyEntries);
                 pageCount = ContentArr.Length;
             }
             if (ContentFirstPage.Length == 0)
             {
                 _doh.Reset();
                 _doh.SqlCmd = "UPDATE [jcms_module_article] SET [FirstPage]='" + Go2View(1, true, _ChannelId, _ContentId, false) + "' WHERE [ChannelId]=" + _ChannelId + " and [IsPass]=1 and [Id]=" + _ContentId;
                 _doh.ExecuteSqlNonQuery();
             }
             for (int j = 1; j < (pageCount + 1); j++)
             {
                 JumboTCMS.Utils.DirFile.SaveFile(GetContent(_ChannelId, _ContentId, j), Go2View(j, true, _ChannelId, _ContentId, true));
             }
         }
     }
 }
コード例 #3
0
ファイル: SoftDAL.cs プロジェクト: WZDotCMS/WZDotCMS
 public override void CreateContent(string _ChannelId, string _ContentId, int _CurrentPage)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT [FirstPage] FROM [jcms_module_soft] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
         DataTable dtContent = _doh.GetDataTable();
         string ContentFirstPage = dtContent.Rows[0]["FirstPage"].ToString();
         dtContent.Clear();
         dtContent.Dispose();
         if (ContentFirstPage.Length == 0)
         {
             _doh.Reset();
             _doh.SqlCmd = "UPDATE [jcms_module_soft] SET [FirstPage]='" + Go2View(1, true, _ChannelId, _ContentId, false) + "' WHERE [ChannelId]=" + _ChannelId + " and [IsPass]=1 and [Id]=" + _ContentId;
             _doh.ExecuteSqlNonQuery();
         }
         JumboTCMS.Utils.DirFile.SaveFile(GetContent(_ChannelId, _ContentId, 1), Go2View(1, true, _ChannelId, _ContentId, true));
     }
 }
コード例 #4
0
ファイル: ArticleDAL.cs プロジェクト: WZDotCMS/WZDotCMS
        /// <summary>
        /// 删除内容页
        /// </summary>
        /// <param name="_ChannelId"></param>
        /// <param name="_ContentId"></param>
        public void DeleteContent(string _ChannelId, string _ContentId)
        {
            JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId);

            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.ConditionExpress = "[ChannelId]=" + _ChannelId + " AND [Id]=" + _ContentId;
                object[] _value = _doh.GetFields("jcms_module_" + _Channel.Type, "AddDate,FirstPage");
                string _date = _value[0].ToString();
                string _firstpage = _value[1].ToString();
                if (_firstpage.Length > 0 && _Channel.IsHtml)
                {
                    string _folderName = String.Format("/{0}{1}/{2}",
                        DateTime.Parse(_date).ToString("yyyy"),
                        DateTime.Parse(_date).ToString("MM"),
                        DateTime.Parse(_date).ToString("dd")
                        );
                    if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(site.Dir + _Channel.Dir + _folderName)))
                    {
                        string htmFile = HttpContext.Current.Server.MapPath(Go2View(1, true, _ChannelId, _ContentId, true));
                        if (System.IO.File.Exists(htmFile))
                            System.IO.File.Delete(htmFile);
                        string[] htmFiles = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath(site.Dir + _Channel.Dir + _folderName), _ContentId + "_*" + site.StaticExt);
                        foreach (string fileName in htmFiles)
                        {
                            if (System.IO.File.Exists(fileName))
                                System.IO.File.Delete(fileName);
                        }
                    }
                    _doh.Reset();
                    _doh.SqlCmd = "UPDATE [jcms_module_" + _Channel.Type + "] SET [FirstPage]='' WHERE [ChannelId]=" + _ChannelId + " AND [Id]=" + _ContentId;
                    _doh.ExecuteSqlNonQuery();
                }
            }
        }
コード例 #5
0
ファイル: UserOrderDAL.cs プロジェクト: WZDotCMS/WZDotCMS
 /// <summary>
 /// 新增订单信息
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_truename"></param>
 /// <param name="_address"></param>
 /// <param name="_zipcode"></param>
 /// <param name="_mobiletel"></param>
 /// <returns></returns>
 public bool NewOrder(string _uid, string _truename, string _address, string _zipcode, string _mobiletel)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _ordernum = GetProductOrderNum();//订单号
         int page = 1;
         int PSize = 1000;
         int countNum = 0;
         string sqlStr = "";
         string joinStr = "A.[ProductId]=B.Id";
         string whereStr1 = "A.State=0 AND A.UserId=" + _uid;
         string whereStr2 = "State=0 AND UserId=" + _uid;
         _doh.Reset();
         _doh.ConditionExpress = whereStr2;
         countNum = _doh.Count("jcms_normal_user_cart");
         sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("A.*,b.points as unitprice,(b.points*a.buycount) as totalprice,b.id as productid,b.title as productname,b.img as productimg", "jcms_normal_user_cart", "jcms_module_product", "Id", PSize, page, "desc", joinStr, whereStr1, whereStr2);
         _doh.Reset();
         _doh.SqlCmd = sqlStr;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count == 0)
             return false;
         float _money = 0;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             JumboTCMS.Entity.Normal_UserGoods _goods = new JumboTCMS.Entity.Normal_UserGoods();
             _goods.UserId = Str2Int(_uid);
             _goods.OrderNum = _ordernum;
             _goods.ProductId = Str2Int(dt.Rows[i]["ProductId"].ToString());
             _goods.ProductName = dt.Rows[i]["ProductName"].ToString();
             _goods.ProductImg = dt.Rows[i]["ProductImg"].ToString();
             _goods.ProductLink = dt.Rows[i]["ProductLink"].ToString();
             _goods.UnitPrice = Convert.ToSingle(dt.Rows[i]["UnitPrice"].ToString());
             _goods.BuyCount = Str2Int(dt.Rows[i]["BuyCount"].ToString());
             _goods.TotalPrice = Convert.ToSingle(dt.Rows[i]["TotalPrice"].ToString());
             new JumboTCMS.DAL.Normal_UserGoodsDAL().NewGoods(_goods);
             _money += _goods.TotalPrice;
         }
         dt.Clear();
         dt.Dispose();
         _doh.Reset();
         _doh.AddFieldItem("UserId", _uid);
         _doh.AddFieldItem("OrderNum", _ordernum);
         _doh.AddFieldItem("TrueName", _truename);
         _doh.AddFieldItem("Address", _address);
         _doh.AddFieldItem("ZipCode", _zipcode);
         _doh.AddFieldItem("MobileTel", _mobiletel);
         _doh.AddFieldItem("Money", _money);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("OrderTime", DateTime.Now.ToString());
         _doh.AddFieldItem("OrderIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_user_order");
         _doh.Reset();
         _doh.SqlCmd = string.Format("UPDATE [jcms_normal_user_cart] SET [State]=1 WHERE UserId={0}", _uid);
         _doh.ExecuteSqlNonQuery();
         return true;
     }
 }