//初始化
        private void GetInit()
        {
            M_CommonData dtinfo = cbll.GetCommonData(sid);
            DataTable    dt     = cbll.GetContent(sid);

            this.Namelabel.Text = dtinfo.Title;
            this.Label1.Text    = dtinfo.Inputer;
            string       tablename = dtinfo.TableName;
            B_ModelField mfll      = new B_ModelField();

            SafeSC.CheckDataEx(tablename);
            DataTable tableinfo = mfll.SelectTableName("ZL_Model", "tablename = '" + tablename + "'");
            B_Model   mll       = new B_Model();

            if (tableinfo.Rows.Count > 0)
            {
                this.Label6.Text = mbll.GetModelById(DataConverter.CLng(dt.Rows[0]["StoreModelID"].ToString())).ModelName;
            }
            else
            {
                this.Label6.Text = "查询错误!请核实此模型是否存在";
            }
            //string tophtml = "<tr><td width=\"20%\"></td><td width = \"80%\"></td>";
            //string endhtml = "</tr>";
            //this.ModelHtml.Text = tophtml + this.mfbll.GetUpdateHtmlUser(int.Parse(dt.Rows[0]["StoreModelID"].ToString()), 0, dt) + endhtml;
            //this.ModelHtml.Text = this.mfbll.GetUpdateHtmlUser(int.Parse(dt.Rows[0]["StoreModelID"].ToString()), 0, dt);
        }
Esempio n. 2
0
        protected void SetTemplate(object sender, EventArgs e)
        {
            B_Model bll1    = new B_Model();
            int     ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString());

            bll1.UpdateTemplate(this.TxtTemplate.Text, ModelID);
        }
Esempio n. 3
0
        /// <summary>
        /// 通过ModelID ,itemID查找图片路径
        /// </summary>
        /// <param name="modelID"></param>
        /// <param name="itemID"></param>
        /// <returns></returns>
        private string GetPicPathByModelID(int modelID, int itemID)
        {
            B_Model      bm        = new B_Model();
            M_ModelInfo  modelinfo = bm.GetModelById(modelID);
            B_ModelField bmf       = new B_ModelField();
            M_ModelField mf        = bmf.GetFieldNameByMID(modelID);
            string       fieldName = "";

            if (mf != null && mf.ModelID > 0)
            {
                fieldName = mf.FieldName;
            }
            if (modelinfo != null && modelinfo.ModelID > 0)
            {
                //DataSet ds = cll.PRoContentChilds(modelinfo.TableName, itemID);
                //if (ds != null && ds.Tables[0].Rows.Count > 0)
                //{
                //    DataRow dr = ds.Tables[0].Rows[0];
                //    foreach (DataColumn item in ds.Tables[0].Columns)
                //    {
                //        if (item.ToString().Trim().Equals(fieldName))
                //        {
                //            return dr[item].ToString();
                //        }
                //    }
                //}
            }
            return("");
        }
        protected void SetTemplate(object sender, EventArgs e)
        {
            B_Model bll1    = new B_Model();
            int     ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString());

            bll1.UpdateTemplate(this.TxtTemplate.Text, ModelID);
            function.WriteSuccessMsg("设定模板成功", "UserModelField.aspx?ModelID=" + ModelID.ToString());
        }
Esempio n. 5
0
 protected void Repeater1_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "UpMove")
     {
         int          Id        = DataConverter.CLng(e.CommandArgument);
         M_ModelField Fieldinfo = this.bll.GetModelByID(Id);
         if (Fieldinfo.OrderID != this.bll.GetMinOrder(Fieldinfo.ModelID))
         {
             M_ModelField FieldPre  = this.bll.GetPreField(Fieldinfo.ModelID, Fieldinfo.OrderID);
             int          CurrOrder = Fieldinfo.OrderID;
             Fieldinfo.OrderID = FieldPre.OrderID;
             FieldPre.OrderID  = CurrOrder;
             this.bll.UpdateOrder(Fieldinfo);
             this.bll.UpdateOrder(FieldPre);
         }
     }
     if (e.CommandName == "DownMove")
     {
         int          Id        = DataConverter.CLng(e.CommandArgument);
         M_ModelField Fieldinfo = this.bll.GetModelByID(Id);
         if (Fieldinfo.OrderID != this.bll.GetMaxOrder(Fieldinfo.ModelID))
         {
             M_ModelField FieldPre  = this.bll.GetNextField(Fieldinfo.ModelID, Fieldinfo.OrderID);
             int          CurrOrder = Fieldinfo.OrderID;
             Fieldinfo.OrderID = FieldPre.OrderID;
             FieldPre.OrderID  = CurrOrder;
             this.bll.UpdateOrder(Fieldinfo);
             this.bll.UpdateOrder(FieldPre);
         }
     }
     if (e.CommandName == "Delete")
     {
         int Id = DataConverter.CLng(e.CommandArgument);
         int ModelID;
         ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString());
         B_Model      bll1      = new B_Model();
         string       tablename = bll1.GetModelById(ModelID).TableName;
         M_ModelField fieldinfo = this.bll.GetModelByID(Id);
         if (fieldinfo.FieldType == "PicType" || fieldinfo.FieldType == "FileType")
         {
             string[] Setting   = fieldinfo.Content.Split(new char[] { ',' });
             bool     chk       = DataConverter.CBool(Setting[0].Split(new char[] { '=' })[1]);
             string   fieldname = Setting[1].Split(new char[] { '=' })[1];
             if (chk && fieldname != "")
             {
                 this.bll.DelSubField(tablename, fieldname);
             }
         }
         this.bll.Del(Id, tablename);
     }
     DataBindList();
 }
Esempio n. 6
0
        public void DataBindList()
        {
            B_Model     bll1    = new B_Model();
            int         ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString());
            M_ModelInfo modeli  = bll1.GetModelById(ModelID);

            this.LModelName.Text           = modeli.ModelName;
            this.TxtTemplate.Text          = modeli.ContentModule;
            this.RepSystemModel.DataSource = bll.GetSysUserField();
            this.RepSystemModel.DataBind();
            this.RepModelField.DataSource = bll.GetModelFieldList(ModelID);
            this.RepModelField.DataBind();
        }
Esempio n. 7
0
        //取出节点绑定模型的图标,需要优化,能否一起取出
        private string GetIconPath(string ContentModel)
        {
            B_Model bmod     = new B_Model();
            string  ItemIcon = "fa fa-globe";

            if (!string.IsNullOrEmpty(ContentModel))
            {
                try
                {
                    int ModelID = Convert.ToInt32(ContentModel.Split(',')[0]);
                    ItemIcon = bmod.GetWhere("ItemIcon", " And ModelID=" + ModelID, "").Rows[0][0].ToString(); //ZL_Model
                }
                catch { }
            }
            return(ItemIcon);
        }
Esempio n. 8
0
        private static void BeginCollContent()
        {
            B_Model          modBll  = new B_Model();
            B_ModelField     fdBll   = new B_ModelField();
            B_CollectionItem itemBll = new B_CollectionItem();

            foreach (M_CollectionItem item in workList)
            {
                if (B_Coll_Worker.work_switcher == false)
                {
                    break;
                }
                if (string.IsNullOrEmpty(item.LinkList))
                {
                    WriteLog("项目[" + item.ItemName + "]取消,原因:未指定需要采集的列表URL,LinkList"); continue;
                }
                if (string.IsNullOrEmpty(item.InfoPageSettings))
                {
                    WriteLog("项目[" + item.ItemName + "]取消,原因:未指定字段采集规则"); continue;
                }
                if (string.IsNullOrEmpty(item.CollUrl))
                {
                    WriteLog("项目[" + item.ItemName + "]取消,原因:未指定采集来源网址CollUrl"); continue;
                }
                M_ModelInfo modMod  = modBll.SelReturnModel(item.ModeID);
                DataTable   fieldDT = fdBll.SelByModelID(item.ModeID);
                foreach (string url in item.LinkList.Split('\n'))
                {
                    if (B_Coll_Worker.work_switcher == false)
                    {
                        WriteLog("采集项目[" + item.ItemName + "]已停止", ERROR); break;
                    }
                    if (string.IsNullOrEmpty(url))
                    {
                        continue;
                    }
                    WriteLog("正在采集[" + item.ItemName + "]的目标网址[" + url + "]");
                    CollectByUrl(url, item, modMod, fieldDT);
                }
                DBCenter.UpdateSQL(item.TbName, "Switch=2", "CItem_ID=" + item.CItem_ID);
            }
            WriteLog("采集完成,共采集到[" + work_count + "]篇内容", 99);
            work_switcher = false;
            work_count    = 0;
            workList.Clear();
        }
Esempio n. 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["ItemID"]))
     {
         int          ItemID   = DataConverter.CLng(base.Request.QueryString["ItemID"]);
         B_Content    bcontent = new B_Content();
         B_Model      bmode    = new B_Model();
         B_Node       bnode    = new B_Node();
         M_CommonData ItemInfo = bcontent.GetCommonData(ItemID);
         if (ItemInfo.IsNull)
         {
             Response.Write("[产生错误的可能原因:您访问的内容信息不存在!]");
         }
         M_ModelInfo modelinfo   = bmode.GetModelById(ItemInfo.ModelID);
         string      TempNode    = bnode.GetModelTemplate(ItemInfo.NodeID, ItemInfo.ModelID);
         string      TempContent = ItemInfo.Template;
         string      TemplateDir = modelinfo.ContentModule;
         if (!string.IsNullOrEmpty(TempContent))
         {
             TemplateDir = TempContent;
         }
         else
         {
             if (!string.IsNullOrEmpty(TempNode))
             {
                 TemplateDir = TempNode;
             }
         }
         if (string.IsNullOrEmpty(TemplateDir))
         {
             Response.Write("[产生错误的可能原因:该内容所属模型未指定模板!]");
         }
         else
         {
             TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + TemplateDir;
             TemplateDir = TemplateDir.Replace("/", @"\");
             string ContentHtml = this.bll.CreateHtml(FileSystemObject.ReadFile(TemplateDir), 0, ItemID);
             Response.Write(ContentHtml);
         }
     }
     else
     {
         Response.Write("[产生错误的可能原因:您访问的内容信息不存在!]");
     }
 }
Esempio n. 10
0
    protected void Save_Btn_Click(object sender, EventArgs e)
    {
        M_UserInfo   mu       = buser.GetLogin();
        M_Store_Info storeMod = storeBll.SelReturnModel(mu.SiteID);
        M_WX_APPID   appMod   = appBll.SelModelByStoreId(storeMod.ID);

        if (appMod == null)
        {
            appMod = new M_WX_APPID();
        }
        appMod.IsDefault = storeMod.ID;
        appMod.Alias     = storeMod.Title;
        appMod.APPID     = AppID_T.Text.Trim();
        if (QCode_UP.HasFile)
        {
            QCode_UP.SaveFile();
            appMod.QRCode = QCode_UP.FileUrl.Replace("/UploadFiles/", "");;
        }
        appMod.WxNo          = WXNo_T.Text.Trim();
        appMod.Secret        = Secret_T.Text.Trim();
        appMod.OrginID       = OrginID.Text.Trim();
        appMod.Pay_AccountID = Pay_Account.Text.Trim();
        if (appMod.ID > 0)
        {
            appBll.UpdateByID(appMod);
        }
        else
        {
            appMod.ID = appBll.Insert(appMod);
            M_ModelInfo  modInfo = new B_Model().SelReturnModel(50);
            B_Content    conBll  = new B_Content();
            M_CommonData conMod  = new M_CommonData();
            conMod.NodeID    = 5;
            conMod.ModelID   = modInfo.ModelID;
            conMod.Title     = appMod.Alias;
            conMod.Inputer   = mu.UserName;
            conMod.ItemID    = appMod.ID;
            conMod.TableName = modInfo.TableName;
            conBll.insert(conMod);
        }
        function.WriteSuccessMsg("操作成功");
    }
Esempio n. 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null && !(Request.QueryString["id"].Equals("")))
     {
         int productId = DataConverter.CLng(Request.QueryString["id"]);
         if (productId == 0)
         {
             function.WriteErrMsg("参数错误");
         }
         else
         {
             bll   = new B_Product();
             node  = new B_Node();
             pinfo = bll.GetproductByid(productId);
             if (pinfo != null)
             {
                 int    nodeId = pinfo.Nodeid;
                 M_Node m_node = node.GetNodeXML(nodeId);
                 NodeName.Text     = m_node.NodeName;
                 AddUser_L.Text    = pinfo.AddUser;
                 shopState.Text    = pinfo.Sales == 1 ? "销售中" : "停售状态";
                 codes.Text        = pinfo.ProClass == 1 ? "正常销售" : "特价处理";
                 codes.Text       += pinfo.Isnew == 1 ? "|新品" : "";
                 codes.Text       += pinfo.Ishot == 1 ? "|热销" : "";
                 codes.Text       += pinfo.Isbest == 1 ? "|精品" : "";
                 ProID_L.Text      = pinfo.ID.ToString();
                 title_T.Text      = pinfo.Proname;
                 lblCountHits.Text = pinfo.AllClickNum.ToString();
                 ckPrice.Text      = pinfo.ShiPrice.ToString();
                 nowPrice.Text     = pinfo.LinPrice.ToString();
                 B_Model     m_model = new B_Model();
                 M_ModelInfo MM      = m_model.GetModelById(pinfo.Nodeid);
                 string      bar     = " <span><a href=\"ProductManage.aspx?NodeID=" + nodeId + "\">" + node.GetNodeXML(nodeId).NodeName + "</a></span>";
                 Call.SetBreadCrumb(Master, "<li>商城管理</li><li><a href='ProductManage.aspx'>商品管理</a></li><li>" + bar + "</li>" +
                                    "<div class='pull-right hidden-xs'><span onclick=\"opentitle('../Content/EditNode.aspx?NodeID=" + nodeId + "','配置本节点');\" class='fa fa-cog' title='配置本节点' style='cursor:pointer;margin-left:5px;'></span></div>");
             }
         }
     }
 }
Esempio n. 12
0
        //互动模型需要扩展
        public void RestoreByName(string name)
        {
            B_Model      modelBll = new B_Model();
            B_ModelField fieldBll = new B_ModelField();
            B_Pub        pubBll   = new B_Pub();
            string       ppath    = SafeSC.PathDeal(pdir + name);

            if (!File.Exists(ppath))
            {
                function.WriteErrMsg("备份文件[" + name + "]不存在");
            }
            //清空数据
            modelBll.DeleteAll();
            foreach (string tbname in tbnames)
            {
                SqlHelper.ExecuteSql("TRUNCATE TABLE " + tbname);
            }
            SqlHelper.ExecuteSql("TRUNCATE TABLE ZL_CommonModel");
            //开始恢复
            DataSet ds = new DataSet();

            ds.ReadXml(ppath);
            //批量导入部分数据
            SqlHelper.Insert_Bat(ds.Tables["ZL_Node"], SqlHelper.ConnectionString);
            if (ds.Tables["ZL_Pub"] != null)
            {
                SqlHelper.Insert_Bat(ds.Tables["ZL_Pub"], SqlHelper.ConnectionString);
            }
            if (ds.Tables["ZL_Node_ModelTemplate"] != null)
            {
                SqlHelper.Insert_Bat(ds.Tables["ZL_Node_ModelTemplate"], SqlHelper.ConnectionString);
            }
            if (ds.Tables["ZL_UserPromotions"] != null)
            {
                SqlHelper.Insert_Bat(ds.Tables["ZL_UserPromotions"], SqlHelper.ConnectionString);
            }
            if (ds.Tables["ZL_NodeRole"] != null)
            {
                SqlHelper.Insert_Bat(ds.Tables["ZL_NodeRole"], SqlHelper.ConnectionString);
            }
            //恢复模型数据与其对应的表
            DataTable modelDT = ds.Tables["ZL_Model"];
            DataTable fieldDT = ds.Tables["ZL_ModelField"];
            DataTable pubDT   = ds.Tables["ZL_Pub"];

            foreach (DataRow dr in modelDT.Rows)
            {
                M_ModelInfo modelMod = new M_ModelInfo().GetModelFromReader(dr);
                ZoomLa.SQLDAL.DBHelper.Table_Del(modelMod.TableName);
                switch (modelMod.ModelType.ToString())
                {
                case "3":    //用户模型和黄页申请模型
                    modelBll.AddUserModel(modelMod);
                    break;

                case "6":    //店铺申请模型
                    modelBll.AddStoreModel(modelMod);
                    break;

                case "7":    //互动模型
                    if (pubDT == null)
                    {
                        break;
                    }
                    M_Pub pubmodel = new M_Pub();
                    pubmodel.PubName      = modelMod.ModelName;
                    pubmodel.PubTableName = modelMod.TableName;
                    DataRow[] drs = pubDT.Select("PubModelID=" + modelMod.ModelID);
                    pubmodel.PubType = drs.Length > 0 ? DataConvert.CLng(drs[0]["PubType"]) : 0;
                    pubBll.CreateModelInfo(pubmodel);
                    break;

                case "8":    //功能模型
                    modelBll.AddFunModel(modelMod);
                    break;

                default:    //内容模型、商城模型、黄页内容模型、店铺商品模型
                    modelBll.AddModel(modelMod);
                    break;
                }
            }
            //恢复字段
            if (fieldDT != null && fieldDT.Rows.Count > 0)
            {
                fieldDT.DefaultView.RowFilter = "sys_type ='false'";
                foreach (DataRow dr in fieldDT.DefaultView.ToTable().Rows)
                {
                    int modelID = DataConvert.CLng(dr["ModelID"]);
                    if (modelID < 1)
                    {
                        continue;
                    }
                    DataRow[] drs = modelDT.Select("ModelID='" + modelID + "'");
                    //OA不处理,未找到不处理
                    if (drs.Length < 1 || drs[0]["ModelType"].ToString().Equals("12"))
                    {
                        continue;
                    }
                    M_ModelInfo  modelMod = new M_ModelInfo().GetModelFromReader(drs[0]);
                    M_ModelField fieldMod = new M_ModelField().GetModelFromReader(dr);
                    //Pub表会报重复
                    if (fieldBll.IsExists(modelMod.ModelID, fieldMod.FieldName))
                    {
                        continue;
                    }
                    if (DBCenter.DB.Table_Exist(modelMod.TableName)) //互动表可能未创建,忽略
                    {
                        fieldBll.AddModelField(modelMod, fieldMod);
                    }
                }
                SqlHelper.ExecuteSql("TRUNCATE TABLE ZL_ModelField");
                SqlHelper.Insert_Bat(fieldDT, SqlHelper.ConnectionString);
            }
        }
        public void PageContent()
        {
            if (ItemID < 1)
            {
                RepToClient("[产生错误的可能原因:您访问的内容信息不存在!访问规则:PageContent?ItemID=信息ID]"); return;
            }
            B_Model      bmode    = new B_Model();
            B_Node       bnode    = new B_Node();
            M_CommonData ItemInfo = conBll.GetCommonData(ItemID);

            if (ItemInfo.IsNull)
            {
                RepToClient("[产生错误的可能原因:内容信息不存在或未开放!]"); return;
            }
            M_ModelInfo modelinfo = bmode.GetModelById(ItemInfo.ModelID);

            M_Templata Nodeinfo    = tll.Getbyid(ItemInfo.NodeID);
            string     TemplateDir = GetTempPath(ItemInfo, Nodeinfo, pageID);

            if (string.IsNullOrEmpty(TemplateDir))
            {
                RepToClient("[产生错误的可能原因:该内容所属模型未指定模板!]"); return;
            }
            else
            {
                int Cpage = 1;
                if (string.IsNullOrEmpty(base.Request.QueryString["p"]))
                {
                    Cpage = 1;
                }
                else
                {
                    Cpage = DataConverter.CLng(base.Request.QueryString["p"]);
                }
                string ContentHtml = "";
                try
                {
                    ContentHtml = FileSystemObject.ReadFile(TemplateDir);
                }
                catch
                {
                    RepToClient("[产生错误的可能原因:该内容所属模型未指定模板!]"); return;
                }

                ContentHtml = this.createBll.CreateHtml(ContentHtml, Cpage, ItemID, 0);

                /* --------------------判断是否分页 并做处理------------------------------------------------*/
                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    string infoContent = "";     //进行处理的内容字段
                    string pagelabel   = "";
                    string infotmp     = "";
                    #region 分页符分页
                    string pattern = @"{\#PageCode}([\s\S])*?{\/\#PageCode}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#PageCode}", "").Replace("{/#PageCode}", "");
                        //查找分页标签
                        //bool flag = false;
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                IList <string> ContentArr = new List <string>();
                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.createBll.GetContentPage(infoContent);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.createBll.GetContentPage(infoContent);
                                    }
                                    else
                                    {
                                        string  lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        B_Label blbl    = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.createBll.GetContentPage(infoContent);
                                    }
                                }

                                if (ContentArr.Count > 0)     //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[CPage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, ContentArr.Count));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else      //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                    #endregion

                    pattern = @"{\#Content}([\s\S])*?{\/\#Content}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");

                        //查找分页标签
                        //bool flag = false;
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                int            NumPerPage = 500;
                                IList <string> ContentArr = new List <string>();

                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                    }
                                    else
                                    {
                                        string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        if (paArr.Length > 1)
                                        {
                                            NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                        }
                                        B_Label blbl = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                    }
                                }
                                if (ContentArr.Count > 0)     //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, NumPerPage));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else      //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                }
                string patterns   = @"{ZL\.Page([\s\S])*?\/}";
                string pagelabels = Regex.Match(ContentHtml, patterns, RegexOptions.IgnoreCase).Value;
                if (pagelabels != "")
                {
                    ContentHtml = ContentHtml.Replace(pagelabels, "");
                }
                /*--------------------- 分页内容处理结束-------------------------------------------------------------------------*/
                Response.Write(ContentHtml);
            }
        }
Esempio n. 14
0
        //数据导入
        public bool ImportProducts(DataTable dt, int ModelID, int NodeID)
        {
            B_ModelField b_ModelField = new B_ModelField();
            DataTable    dtModelField = b_ModelField.GetModelFieldList(ModelID);
            //建立从表存放当前信息
            DataTable table = new DataTable();

            table.Columns.Add(new DataColumn("FieldName", typeof(string)));
            table.Columns.Add(new DataColumn("FieldType", typeof(string)));
            table.Columns.Add(new DataColumn("FieldValue", typeof(string)));
            table.Columns.Add(new DataColumn("ShopmodelID", typeof(string)));
            table.Columns.Add(new DataColumn("FieldAlias", typeof(string)));

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dtModelField != null && dtModelField.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtModelField.Rows)
                    {
                        DataRow row = table.NewRow();
                        row[0] = dr["FieldName"].ToString();
                        row[1] = dr["FieldType"].ToString();
                        row[4] = dr["FieldAlias"].ToString();
                        try
                        {
                            row[2] = dt.Rows[i][row[4].ToString()];
                        }
                        catch
                        {
                            return(false);
                        }
                        table.Rows.Add(row);
                    }
                }
                //基础表内容

                B_Model     modBll = new B_Model();
                M_ModelInfo modMod = modBll.SelReturnModel(ModelID);
                //主表内容
                M_Product m_Product = new M_Product();
                m_Product.ModelID   = ModelID;
                m_Product.Nodeid    = NodeID;
                m_Product.TableName = modMod.TableName;
                m_Product.ProCode   = dt.Rows[i]["商品编号"].ToString();
                m_Product.BarCode   = dt.Rows[i]["条形码"].ToString();
                m_Product.Proname   = dt.Rows[i]["商品名称"].ToString();
                m_Product.Kayword   = dt.Rows[i]["关键字"].ToString();
                m_Product.ProUnit   = dt.Rows[i]["商品单位"].ToString();
                try
                {
                    m_Product.Weight = Convert.ToInt32(dt.Rows[i]["商品重量"].ToString() == "" ? 0 : dt.Rows[i]["商品重量"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[商品重量]格式不正确");
                }
                m_Product.ProClass = 1;
                m_Product.Sales    = Convert.ToInt32(dt.Rows[i]["销售状态(1)"].ToString() == "1" ? 1 : 0);
                m_Product.Istrue   = Convert.ToInt32(dt.Rows[i]["属性设置(1)"].ToString() == "1" ? 1 : 0);
                try
                {
                    m_Product.AllClickNum = Convert.ToInt32(dt.Rows[i]["点击数"].ToString() == "" ? 0 : dt.Rows[i]["点击数"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[点击数]格式不正确");
                }
                try
                {
                    m_Product.UpdateTime = Convert.ToDateTime(dt.Rows[i]["更新时间"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[更新时间]格式不正确");
                }
                m_Product.ModeTemplate = "";

                ///22222222222222222222
                m_Product.Proinfo    = dt.Rows[i]["商品简介"].ToString();
                m_Product.Procontent = dt.Rows[i]["详细介绍"].ToString();
                m_Product.Clearimg   = dt.Rows[i]["商品清晰图"].ToString();
                m_Product.Thumbnails = dt.Rows[i]["商品缩略图"].ToString();

                ///33333333333333333333
                m_Product.Producer = dt.Rows[i]["生产商"].ToString();
                m_Product.Brand    = dt.Rows[i]["品牌/商标"].ToString();
                m_Product.Allowed  = Convert.ToInt32(dt.Rows[i]["缺货时允许购买(0)"].ToString() == "0" ? 0 : 1);
                try
                {
                    m_Product.Quota = Convert.ToInt32(dt.Rows[i]["限购数量"].ToString() == "" ? 0 : dt.Rows[i]["限购数量"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[限购数量]格式不正确");
                }
                try
                {
                    m_Product.DownQuota = Convert.ToInt32(dt.Rows[i]["最低购买数量"].ToString() == "" ? 0 : dt.Rows[i]["最低购买数量"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[最低购买数量]格式不正确");
                }
                m_Product.Stock = 0;//库存数量

                try
                {
                    m_Product.ShiPrice = Convert.ToDouble(dt.Rows[i]["市场参考价"].ToString() == "" ? 0 : dt.Rows[i]["市场参考价"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[市场参考价]格式不正确");
                }
                try
                {
                    m_Product.LinPrice = Convert.ToDouble(dt.Rows[i]["当前零售价"].ToString() == "" ? 0 : dt.Rows[i]["当前零售价"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[当前零售价]格式不正确");
                }
                try
                {
                    m_Product.AddTime = DateTime.Parse(dt.Rows[i]["创建时间"].ToString());
                }
                catch (Exception)
                {
                    throw new Exception("第" + (i + 1) + "行,字段[创建时间]格式不正确");
                }

                try
                {
                    m_Product.StockDown = 0;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[库存报警下限]格式不正确");
                }
                try
                {
                    m_Product.Rateset = 1;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[税率设置]格式不正确");
                }
                try
                {
                    m_Product.Rate = 0;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[商品税率]格式不正确");
                }
                try
                {
                    m_Product.Dengji = 3;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[商品推荐等级]格式不正确");
                }

                try
                {
                    m_Product.ShiPrice = Convert.ToDouble(dt.Rows[i]["市场参考价"].ToString() == "" ? 0 : dt.Rows[i]["市场参考价"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[市场参考价]格式不正确");
                }
                try
                {
                    m_Product.LinPrice = Convert.ToDouble(dt.Rows[i]["当前零售价"].ToString() == "" ? 0 : dt.Rows[i]["当前零售价"]);
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[当前零售价]格式不正确");
                }
                //m_Product.UserPrice = dt.Rows[i]["会员组价格"].ToString();
                m_Product.UserPrice = "0";
                try
                {
                    m_Product.Recommend = 0;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[打折优惠率]格式不正确");
                }
                try
                {
                    m_Product.PointVal = 0;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[积分价格]格式不正确");
                }
                m_Product.Wholesales = 0;//允许批发
                try
                {
                    m_Product.Wholesaleone = 1;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[允许单独销售]格式不正确");
                }
                try
                {
                    m_Product.Largess = 0;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[设置为礼品]格式不正确");
                }

                ///55555555555555555555
                try
                {
                    m_Product.IntegralNum = 0;
                }
                catch
                {
                    throw new Exception("第" + (i + 1) + "行,字段[购物积分]格式不正确");
                }

                Add(table, m_Product);
                table.Rows.Clear();//清除子表中的数据
            }
            return(true);
        }