Esempio n. 1
0
        /// <summary>
        /// �����Ѷ
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="inf"></param>
        /// <returns></returns>
        public int CreateResources(Resources inf)
        {
            inf.dAddDate = DateTime.Now;

            SqlParameter sp0 = new SqlParameter("@iClassID", SqlDbType.VarChar, 36); sp0.Value = inf.Categorie.Id;
            SqlParameter sp1 = new SqlParameter("@vcTitle", SqlDbType.VarChar, 100); sp1.Value = inf.vcTitle;
            SqlParameter sp2 = new SqlParameter("@vcUrl", SqlDbType.VarChar, 200); sp2.Value = inf.vcUrl;
            SqlParameter sp3 = new SqlParameter("@vcContent", SqlDbType.Text, 0); sp3.Value = inf.vcContent;
            SqlParameter sp4 = new SqlParameter("@vcAuthor", SqlDbType.VarChar, 50); sp4.Value = inf.vcAuthor;
            SqlParameter sp5 = new SqlParameter("@vcKeyWord", SqlDbType.VarChar, 100); sp5.Value = inf.vcKeyWord;
            SqlParameter sp6 = new SqlParameter("@vcEditor", SqlDbType.VarChar, 50); sp6.Value = inf.vcEditor;
            SqlParameter sp7 = new SqlParameter("@vcSmallImg", SqlDbType.VarChar, 255); sp7.Value = inf.vcSmallImg;
            SqlParameter sp8 = new SqlParameter("@vcBigImg", SqlDbType.VarChar, 255); sp8.Value = inf.vcBigImg;
            SqlParameter sp9 = new SqlParameter("@vcShortContent", SqlDbType.VarChar, 500); sp9.Value = inf.vcShortContent;
            SqlParameter sp10 = new SqlParameter("@vcSpeciality", SqlDbType.VarChar, 100); sp10.Value = inf.vcSpeciality;
            SqlParameter sp11 = new SqlParameter("@cChecked", SqlDbType.Char, 1); sp11.Value = inf.cChecked;
            SqlParameter sp12 = new SqlParameter("@vcFilePath", SqlDbType.VarChar, 255); sp12.Direction = ParameterDirection.Output;;
            SqlParameter sp13 = new SqlParameter("@reValue", SqlDbType.Int, 4); sp13.Direction = ParameterDirection.Output;
            SqlParameter sp14 = new SqlParameter("@iIDOut", SqlDbType.Int, 4); sp14.Direction = ParameterDirection.Output;
            SqlParameter sp15 = new SqlParameter("@vcExtension", SqlDbType.VarChar, 6); sp15.Value = ConfigServiceEx.baseConfig["FileExtension"];
            SqlParameter sp16 = new SqlParameter("@cCreated", SqlDbType.Char, 1); sp16.Value = inf.cCreated;
            SqlParameter sp17 = new SqlParameter("@vcTitleColor", SqlDbType.VarChar, 10); sp17.Value = inf.vcTitleColor;
            SqlParameter sp18 = new SqlParameter("@cStrong", SqlDbType.Char, 1); sp18.Value = inf.cStrong;
            string[] reValues = conn.Execute("SP_News_NewsInfoManage", new SqlParameter[] { sp0, sp1, sp2, sp3, sp4, sp5, sp6,
                sp7, sp8, sp9 ,sp10,sp11, sp12, sp13 ,sp14,sp15,sp16,sp17,sp18}, new int[] {12, 13 ,14});
            if (reValues != null)
            {
                int rtn = (int)Convert.ChangeType(reValues[1], typeof(int));
                inf.Id = reValues[2].Trim();
                inf.vcFilePath = reValues[0];
                return rtn;
            }
            return -19000000;
        }
Esempio n. 2
0
 /// <summary>
 /// 生成文章路径
 /// </summary>
 /// <param name="extion"></param>
 /// <param name="title"></param>
 /// <param name="date"></param>
 /// <returns></returns>
 public string CreateNewsInfoFilePath(Resources nif)
 {
     if (string.IsNullOrEmpty(nif.Id)) nif.Id = Guid.NewGuid().ToString();
     string text = string.Empty;
     text += nif.Categorie.vcDirectory;
     text += nif.dAddDate.Year.ToString() + objectHandlers.AddZeros(nif.dAddDate.Month.ToString(), 2);
     text += objectHandlers.AddZeros(nif.dAddDate.Day.ToString(), 2) + "/";
     text += nif.Id + ConfigServiceEx.baseConfig["FileExtension"];
     return text;
 }
Esempio n. 3
0
        public int CreateResources(Resources inf)
        {
            if (!base.serviceHandlers.CheckHeader(header))
            {
                return -1000000307;
            }

            //return base.handlerService.resourcsService.resourcesHandlers.CreateResourcesForSheif(inf);
            return 1;
        }
Esempio n. 4
0
 /// <summary>
 /// 添加资讯
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="inf"></param>
 /// <returns></returns>
 public int CreateResources(Resources inf)
 {
     string Sql = "INSERT INTO resources (id,iClassID,vcTitle,vcUrl,vcContent,vcAuthor,iCount,vcKeyWord,"
     + "vcEditor,cCreated,vcSmallImg,vcBigImg,vcShortContent,vcSpeciality,cChecked,cDel,cPostByUser,"
     + "vcFilePath,dAddDate,dUpDateDate,vcTitleColor,cStrong,SheifUrl,PropertiesCategorieId,CCCategories) VALUES(" + inf.Id + ",'" + inf.Categorie.Id + "','" + inf.vcTitle + "','"
     + inf.vcUrl + "','" + inf.vcContent.Replace("'", "''") + "','" + inf.vcAuthor + "','" + inf.iCount + "','" + inf.vcKeyWord + "','" + inf.vcEditor + "','" + inf.cCreated + "','"
     + inf.vcSmallImg + "','" + inf.vcBigImg + "','" + inf.vcShortContent.Replace("'", "''") + "','" + inf.vcSpeciality + "','" + inf.cChecked + "','"
     + inf.cDel + "','" + inf.cPostByUser + "','" + inf.vcFilePath + "','" + inf.dAddDate + "','" + inf.dUpDateDate + "','"
     + inf.vcTitleColor + "','" + inf.cStrong + "','" + inf.SheifUrl + "','" + inf.PropertiesCategorieId + "','" + inf.CCCategories + "')";
     string errText = string.Empty;
     return MsSqlFactory.conn.m_RunSQL(ref errText, Sql);
 }
Esempio n. 5
0
        /// <summary>
        /// 添加资讯
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="inf"></param>
        /// <returns></returns>
        public int CreateResources(Resources inf)
        {
            //资讯标题不能为空
            if (string.IsNullOrEmpty(inf.vcTitle))
            {
                return -1000000039;
            }

            if (string.IsNullOrEmpty(inf.vcAuthor)) inf.vcAuthor = inf.vcEditor;

            //资讯编辑者不能为空
            if (string.IsNullOrEmpty(inf.vcEditor))
            {
                return -1000000041;
            }

            //资讯分类不能为空
            if (string.IsNullOrEmpty(inf.Categorie.Id))
            {
                return -1000000056;
            }

            //资讯关键字不能为空
            if (string.IsNullOrEmpty(inf.vcKeyWord))
            {
                return -1000000043;
            }

            inf.vcFilePath = this.CreateNewsInfoFilePath(inf);

            //资讯分类不存在
            if (string.IsNullOrEmpty(inf.vcFilePath))
            {
                return -1000000045;
            }

            return DataBaseFactory.ResourceHandlers.CreateResources(inf);
        }
Esempio n. 6
0
        private void Create()
        {
            string ClassId = objectHandlers.Post("tClassId");
            int id = objectHandlers.ToInt(objectHandlers.Post("iId"));
            string filepath = objectHandlers.Post("iFilePath");
            string Created = objectHandlers.Post("tCreated");

            Resources item = new Resources();
            string text1 = "";

            int rtn = 0;
            try
            {
                rtn = base.handlerService.tagService.CreateResourcHtmlById(ref text1, id);
                text1 = "<a href='" + filepath + "' target='_blank'>生成成功:" + filepath + "...</a>";
            }
            catch (Exception ex)
            {
                text1 = "<a><font color='red'>" + objectHandlers.JSEncode(ex.Message.ToString()) + "</font></a>";
            }

            base.AjaxErch(1, "<a>" + text1 + "</a>", "CreateBack");
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                string work = objectHandlers.Post("work");
                switch (work)
                {
                    case "AddNew":

                        break;
                }
            }
            else
            {

                FileStream fs = new FileStream(HttpContext.Current.Server.MapPath("/database/taobao1.csv"), FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs);
                string t = sr.ReadToEnd();

                string text = "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"#006600\" width=\"4770\" >";
                string[] arr = t.Split(new string[] { "\n" }, StringSplitOptions.None);

                Dictionary<string, EntityBase> ps = base.handlerService.skinService.propertiesHandlers.GetPropertiesByCIdEntity("1");
                for (int i = 0; i < arr.Length; i++)
                {

                    string[] arr1 = arr[i].Split(new string[] { "\t" }, StringSplitOptions.None);

                    if (arr1.Length>=45)
                    {
                        if (i < 15)
                        {
                            text += "<tr>";

                            string ext = "bgcolor=\"#FFFFFF\"";
                            if (i == 0)
                            {
                                ext = "bgcolor=\"#009900\"";
                                for (int n = 0; n < arr1.Length; n++)
                                {
                                    string text2 = "(" + n.ToString() + ")" + arr1[n];
                                    text += "<td width=\"100\"  height=\"25\" " + ext + ">" + text2 + "</td>";

                                }
                            }
                            else
                            {
                                for (int n = 0; n < arr1.Length; n++)
                                {
                                    string text2 = (n == 24) ? "" : arr1[n];
                                    text += "<td width=\"100\"  height=\"25\" " + ext + ">" + text2 + "</td>";

                                }
                            }

                            text += "</tr>";

                        }

                        int curPage = 0;
                        int pageCount = 0;
                        int count = 0;

                        Dictionary<string, EntityBase> ress = null;
                        try
                        {
                            ress = base.handlerService.resourcsService.resourcesHandlers.GetResourcesListPager(ref curPage, ref pageCount, ref count,
                                   0, 15, "dAddDate DESC,ID DESC", "SheifUrl='" + arr1[44] + "'");
                        }
                        catch (Exception ex)
                        {

                        }

                        Resources res = new Resources();

                        if (ress != null && ress.Count == 1)
                        {
                            foreach (KeyValuePair<string, EntityBase> entity1 in ress)
                            {
                                res = (Resources)entity1.Value;

                            }

                            res.vcTitle = objectHandlers.GetTextWithoutHtml(arr1[0]).Replace("<","").Replace(">","");
                            res.vcKeyWord = objectHandlers.GetTextWithoutHtml(arr1[0]).Replace("<", "").Replace(">", ""); ;
                            res.vcContent = arr1[24].Replace("\"\"", "'");
                            res.SheifUrl = arr1[43];
                            res.vcSmallImg = "/filePatch/taobao/" + arr1[35].Split(';')[0].Split('|')[0].Split(':')[0].Replace("\"", "") + ".jpg";

                            int rtn = -1;
                            rtn = base.handlerService.resourcsService.resourcesHandlers.UpdateResources(res);

                            string txt = "";

                            Dictionary<string, EntityBase> aps = base.handlerService.resourcsService.resourcesHandlers.GetResourcePropertiesByRIdEntity(res.Id);

                            foreach (KeyValuePair<string, EntityBase> entity in aps)
                            {
                                ResourceProperties pp = (ResourceProperties)entity.Value;

                                if (pp.PropertieId == 1) //价格
                                {
                                    pp.PropertieValue = objectHandlers.ToFloat(arr1[7]).ToString("0.00");
                                }
                                else if (pp.PropertieId == 2) //所在地
                                {
                                    pp.PropertieValue = arr1[4] + arr1[5];
                                }
                                else if (pp.PropertieId == 3) //QQ交谈
                                {
                                    pp.PropertieValue = "644139466";
                                }
                                else if (pp.PropertieId == 4) //旺旺
                                {
                                    pp.PropertieValue = "%E9%99%B6%E8%A8%80%E8%B9%8A";
                                }
                                else if (pp.PropertieId == 5) //展示图片1
                                {
                                    if (arr1[35].Split(';').Length >= 3)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[1].Split('|')[1].Replace("\"","");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                else if (pp.PropertieId == 6) //展示图片2
                                {
                                    if (arr1[35].Split(';').Length >= 4)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[2].Split('|')[1].Replace("\"", "");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                else if (pp.PropertieId == 7) //展示图片3
                                {
                                    if (arr1[35].Split(';').Length >= 5)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[3].Split('|')[1].Replace("\"", "");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                else if (pp.PropertieId == 8) //展示图片4
                                {
                                    if (arr1[35].Split(';').Length >= 6)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[4].Split('|')[1].Replace("\"", "");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }

                                //<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=sanyungui&siteid=cntaobao&status=1&charset=utf-8"><img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=sanyungui&site=cntaobao&s=1&charset=utf-8" alt="点击这里给我发消息" /></a>
                                //<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=%E9%99%B6%E8%A8%80%E8%B9%8A&siteid=cntaobao&status=1&charset=utf-8"><img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=%E9%99%B6%E8%A8%80%E8%B9%8A&site=cntaobao&s=1&charset=utf-8" alt="点击这里给我发消息" /></a>

                                pp.PropertieValue = pp.PropertieValue.Replace("'", "''");

                                rtn = base.handlerService.resourcsService.resourcesHandlers.ResourcePropertiesManage(base.adminInfo, pp);
                                txt = rtn == 1 ? "属性[" + pp.PropertieName + "]修改成功!" : errHandlers.GetErrTextByErrCode(rtn, ConfigServiceEx.baseConfig["ManagePath"]);
                                Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;·" + txt + "<br/>");

                            }
                        }
                        else
                        {

                            res.Id = (base.handlerService.resourcsService.resourcesHandlers.GetMaxResourceId() + 1).ToString();
                            res.vcAuthor = "-";
                            res.vcTitle = objectHandlers.GetTextWithoutHtml(arr1[0]).Replace("<", "").Replace(">", ""); ;
                            res.vcKeyWord = objectHandlers.GetTextWithoutHtml(arr1[0]).Replace("<", "").Replace(">", ""); ;
                            res.vcContent = arr1[24].Replace("\"\"", "'");
                            res.Categorie = base.handlerService.skinService.categoriesHandlers.GetCategoriesById("cfc0175d-04d9-45ad-a1ac-5762bb304521");
                            res.vcEditor = "-";
                            res.PropertiesCategorieId = 1;
                            res.SheifUrl = arr1[44];

                            res.vcSmallImg = "/filePatch/taobao/" + arr1[35].Split(';')[0].Split('|')[0].Split(':')[0].Replace("\"","") + ".jpg";

                            int rtn = -1;
                            rtn = base.handlerService.resourcsService.resourcesHandlers.CreateResources(res);
                            string txt = "";

                            foreach (KeyValuePair<string, EntityBase> entity in ps)
                            {
                                Properties ppti = (Properties)entity.Value;
                                ResourceProperties pp = new ResourceProperties();
                                pp.Id = "";
                                pp.PropertieId = objectHandlers.ToInt(ppti.Id);
                                pp.PropertieName = ppti.ProertieName;
                                pp.ResourceId = res.Id;

                                if (pp.PropertieId == 1) //价格
                                {
                                    pp.PropertieValue =  objectHandlers.ToFloat( arr1[7]).ToString("0.00");
                                }
                                else if (pp.PropertieId == 2) //所在地
                                {
                                    pp.PropertieValue = arr1[4] + arr1[5];
                                }
                                else if (pp.PropertieId == 3) //QQ交谈
                                {
                                    pp.PropertieValue = "644139466";
                                }
                                else if (pp.PropertieId == 4) //旺旺
                                {
                                    pp.PropertieValue = "%E9%99%B6%E8%A8%80%E8%B9%8A";
                                }
                                else if (pp.PropertieId == 5) //展示图片1
                                {
                                    if (arr1[35].Split(';').Length >= 3)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[1].Split('|')[1].Replace("\"", "");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                else if (pp.PropertieId == 6) //展示图片2
                                {
                                    if (arr1[35].Split(';').Length >= 4)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[2].Split('|')[1].Replace("\"", "");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                else if (pp.PropertieId == 7) //展示图片3
                                {
                                    if (arr1[35].Split(';').Length >= 5)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[3].Split('|')[1].Replace("\"", "");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                else if (pp.PropertieId == 8) //展示图片4
                                {
                                    if (arr1[35].Split(';').Length >= 6)
                                    {
                                        pp.PropertieValue = arr1[35].Split(';')[4].Split('|')[1].Replace("\"", "");
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }

                                //<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=sanyungui&siteid=cntaobao&status=1&charset=utf-8"><img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=sanyungui&site=cntaobao&s=1&charset=utf-8" alt="点击这里给我发消息" /></a>
                                //<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=%E9%99%B6%E8%A8%80%E8%B9%8A&siteid=cntaobao&status=1&charset=utf-8"><img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=%E9%99%B6%E8%A8%80%E8%B9%8A&site=cntaobao&s=1&charset=utf-8" alt="点击这里给我发消息" /></a>

                                pp.PropertieValue = pp.PropertieValue.Replace("'", "''");

                                rtn = base.handlerService.resourcsService.resourcesHandlers.ResourcePropertiesManage(base.adminInfo, pp);
                                txt = rtn == 1 ? "属性[" + pp.PropertieName + "]添加成功!" : errHandlers.GetErrTextByErrCode(rtn, ConfigServiceEx.baseConfig["ManagePath"]);
                                Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;·" + txt + "<br/>");
                            }

                            txt = rtn == 1 ? "导入成功!" : errHandlers.GetErrTextByErrCode(rtn, ConfigServiceEx.baseConfig["ManagePath"]);
                        }
                    }
                }

                text += "</table>";
                dataveiw.InnerHtml = text;
            }
        }
Esempio n. 8
0
 public int SheifResources(Resources res)
 {
     if (!base.serviceHandlers.CheckHeader(header))
     {
         return -1000000307;
     }
     return 1;// base.handlerService.resourcsService.resourcesHandlers.CreateResourcesForSheif(res);
 }
        private void NewslistTagFieldsReplace(ref string temp, ref TCGTagPagerInfo pagerinfo, Resources item)
        {
            bool isintitle = objectHandlers.ToBoolen(this.GetAttribute("intitle"), false);
            if (isintitle) pagerinfo.PageTitle += (string.IsNullOrEmpty(pagerinfo.PageTitle) ? "" : " - ") + item.vcTitle;

            int maxtitlenum = objectHandlers.ToInt(this.GetAttribute("maxtitlenum"));
            string title = item.vcTitle;
            if (maxtitlenum != 0)
            {
                 string text = (title.Length > maxtitlenum) ? "..." : "";
                 title = objectHandlers.Left(title, maxtitlenum) + text;
            }

            if (!string.IsNullOrEmpty(item.vcTitleColor)) title = "<font color=\"" + item.vcTitleColor + "\">"
                + title + "</font>";
            if (item.cStrong == "Y") title = "<strong>" + "<TCG>" + title + "</strong>";
            temp = temp.Replace("$" + this._tagtype + "_vcTitle$", "<TCG>" + title + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcTitle1$", "<TCG>" + item.vcTitle + "</TCG>");

            //替换正文内容,检查图片
            //try
            //{
            //    string tContent = this.handlerService.fileService.fileHandlers.ImgPatchInit(item, "", adminInfo,
            //        objectHandlers.ToInt(ConfigServiceEx.baseConfig["NewsFileClass"]));
            //    if (tContent != item.vcContent)
            //    {
            //        item.vcContent = tContent;
            //        int outid = 0;
            //        string filepatch = string.Empty;
            //        this.handlerService.resourcsService.resourcesHandlers.UpdateResources(item);
            //    }
            //}
            //catch (Exception ex)
            //{
            //    throw new Exception(ex.Message.ToString());
            //}

            temp = temp.Replace("$" + this._tagtype + "_vcContent$", "<TCG>" + item.vcContent + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_iId$", "<TCG>" + item.Id.ToString() + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcKeyWord$", "<TCG>" + item.vcKeyWord + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_dUpdateDate$", "<TCG>" + item.dUpDateDate.ToString("yyyy年MM月dd日") + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_dAddDate$", "<TCG>" + item.dAddDate.ToString("yyyy年MM月dd日") + "</TCG>");

            temp = temp.Replace("$" + this._tagtype + "_vcKeyWord$", "<TCG>" + item.vcKeyWord + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcClassPic$", "<TCG>" + "/skin/"
                + pagerinfo.SkinInfo.Filename + item.Categorie.vcPic + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcAuthor$", "<TCG>" + item.vcAuthor + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcShortContent$", "<TCG>" + objectHandlers.HtmlEncode(item.vcShortContent) + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcClassName$", "<TCG>" + item.Categorie.vcClassName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_iClassId$", "<TCG>" + item.Categorie.Id + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_iClassParentId$", "<TCG>" + item.Categorie.Parent + "</TCG>");
            Categories cinfo = this.handlerService.skinService.categoriesHandlers.GetCategoriesParent2(item.Categorie.Id);
            temp = temp.Replace("$" + this._tagtype + "_iClassParentId2$", "<TCG>" + cinfo.Id + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_iClassParentvcClassName2$", "<TCG>" + cinfo.vcClassName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_iClassParentvcName2$", "<TCG>" + cinfo.vcName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_TopicClassTitleList$",
                "<TCG>" + this.handlerService.skinService.categoriesHandlers.GetResourcesCategoriesIndex(item.Categorie.Id, " > ") + "</TCG>");

            string url = item.vcUrl.Trim().Length == 0 ? item.vcFilePath : item.vcUrl;
            temp = temp.Replace("$" + this._tagtype + "_vcFilePath$", "<TCG>" + url + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcUrl$", "<TCG>" + url + "</TCG>");

            temp = temp.Replace("$" + this._tagtype + "_vcSmallImg$", "<TCG>" + item.vcSmallImg + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcSpeciality$", "<TCG>" + item.vcSpeciality + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcBigImg$", "<TCG>" + item.vcBigImg + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_SheifUrl$", "<TCG>" + item.SheifUrl + "</TCG>");

            temp = temp.Replace("$" + this._tagtype + "_iCount$", "<TCG><script type='text/javascript' src='"
                + ConfigServiceEx.baseConfig["WebSite"] + "/interface/aspx/resources.aspx?w=getresourcecount&rid=" + item.Id + "'></script></TCG>");

            string sssid = this._tagtype + "_nicon_" + item.Id;
            if (item.dAddDate.AddDays(5) >= DateTime.Now)
            {
                temp = temp.Replace("$" + this._tagtype + "_nIcon$", "<TCG><img src='/images/newicon.jpg' style='vertical-align: middle;'/></TCG>");
            }
            else
            {
                temp = temp.Replace("$" + this._tagtype + "_nIcon$", "");
            }

            bool isshowrp = objectHandlers.ToBoolen(this.GetAttribute("inpropertie"), false);
            if (isshowrp)
            {

                Dictionary<string, EntityBase> ress = base.handlerService.resourcsService.resourcesHandlers.GetResourcePropertiesByRIdEntity(item.Id);

                if (ress != null && ress.Count != 0)
                {
                    Match mh = Regex.Match(temp, @"<ResourcePropertiesList([^<>]+)?>([\S\s]*?)</ResourcePropertiesList>", RegexOptions.Singleline | RegexOptions.Multiline);
                    string rplist = string.Empty;
                    if (mh.Success)
                    {
                        string temp1 = mh.Result("$2");
                        string attrs = mh.Result("$1");

                        string hide = this.GetAttribute(attrs, "hide");

                        int num = objectHandlers.ToInt(this.GetAttribute(attrs, "num"));
                        if (num == 0) num = ress.Count;

                        int i = 0;
                        foreach (KeyValuePair<string, EntityBase> entity in ress)
                        {
                            ResourceProperties resourceProperties = (ResourceProperties)entity.Value;
                            //在制定行数是内,并且不在排除字段中
                            if (i <= num - 1 && hide.IndexOf(resourceProperties.PropertieName) == -1)
                            {
                                int maxtlength = objectHandlers.ToInt(this.GetAttribute(attrs, "maxlength"));
                                string temp33 = maxtlength == 0 ? resourceProperties.PropertieValue : objectHandlers.Left(resourceProperties.PropertieValue, maxtlength);
                                temp33 = objectHandlers.HtmlEncode(temp33);
                                string temp2 = temp1;
                                temp2 = temp2.Replace("$PropertieName$", resourceProperties.PropertieName);
                                temp2 = temp2.Replace("$PropertieValue$", temp33);
                                rplist += temp2;
                            }
                            i++;
                        }
                        temp = Regex.Replace(temp, @"<ResourcePropertiesList([^<>]+)?>([\S\s]*?)</ResourcePropertiesList>", rplist, RegexOptions.Singleline | RegexOptions.Multiline);
                    }

                    MatchCollection mhs = Regex.Matches(temp, @"<RPItem>([\S\s]*?)</RPItem>", RegexOptions.Singleline | RegexOptions.Multiline);
                    if (mhs.Count > 0)
                    {
                        foreach (Match m in mhs)
                        {
                            string temp22 = m.Result("$1");
                            foreach (KeyValuePair<string, EntityBase> entity in ress)
                            {
                                ResourceProperties resourceProperties = (ResourceProperties)entity.Value;
                                if (temp22.IndexOf("$" + resourceProperties.PropertieName + "$") > -1)
                                {
                                    temp22 = temp22.Replace("$" + resourceProperties.PropertieName + "$", objectHandlers.HtmlEncode(resourceProperties.PropertieValue));
                                }
                            }

                            if (temp22 == m.Result("$1"))
                            {
                                temp = temp.Replace(@"<RPItem>" + m.Result("$1") + "</RPItem>", @"");
                            }
                            else
                            {
                                temp = temp.Replace( @"<RPItem>" + m.Result("$1") + "</RPItem>", temp22);
                            }
                        }
                    }
                }

            }

            temp = base.tcgTagStringFunHandlers.StringColoumFun(temp, false);
        }
Esempio n. 10
0
        private void NewslistTagFieldsReplace(ref string temp, Resources res)
        {
            string Title = res.vcTitle;
            if (!string.IsNullOrEmpty(res.vcTitleColor)) Title = "<font color='" + res.vcTitleColor + "'>" + Title + "</font>";
            if (res.cStrong == "Y") Title = "<strong>" + Title + "</strong>";

            temp = temp.Replace("$" + this._tagtype + "_vcTitle$", "<TCG>" + Title + "</TCG>");

            string url = res.vcUrl.Trim().Length == 0 ? res.vcFilePath : res.vcUrl;
            temp = temp.Replace("$" + this._tagtype + "_vcFilePath$", "<TCG>" + url + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcUrl$", "<TCG>" + url + "</TCG>");

            temp = temp.Replace("$" + this._tagtype + "_vcSmallImg$", "<TCG>" + res.vcSmallImg + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcBigImg$", "<TCG>" + res.vcBigImg + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcShortContent$", "<TCG>" + res.vcShortContent + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_dAddDate$", "<TCG>" + res.dAddDate.ToString("yyyy-MM-dd") + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_dUpDateDate$", "<TCG>" + res.dUpDateDate.ToString("yyyy-MM-dd") + "</TCG>");

            temp = base.tcgTagStringFunHandlers.StringColoumFun(temp, false);
        }
Esempio n. 11
0
 /// <summary>
 /// 从记录行中得到实体
 /// </summary>
 /// <param name="?"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public EntityBase GetEntityObjectFromRow(DataRow row, Type type)
 {
     if (row == null) return null;
     switch (type.ToString())
     {
         case "TCG.Entity.Categories":
             Categories categories = new Categories();
             categories.Id = row["Id"].ToString().Trim();
             categories.ResourceListTemplate = this.handlerService.skinService.templateHandlers.GetTemplateByID(row["iListTemplate"].ToString());
             categories.iOrder = (int)row["iOrder"];
             categories.Parent = row["Parent"].ToString().Trim();
             categories.ResourceTemplate = this.handlerService.skinService.templateHandlers.GetTemplateByID(row["iTemplate"].ToString());
             categories.vcClassName = row["vcClassName"].ToString().Trim();
             categories.vcDirectory = row["vcDirectory"].ToString().Trim();
             categories.vcName = row["vcName"].ToString().Trim();
             categories.vcUrl = row["vcUrl"].ToString().Trim();
             categories.dUpdateDate = (DateTime)row["dUpdateDate"];
             categories.cVisible = row["Visible"].ToString().Trim();
             categories.DataBaseService = row["DataBaseService"].ToString().Trim();
             //categories.SkinInfo = row["SkinId"].ToString().Trim();
             return (EntityBase)categories;
         case "TCG.Entity.Resources":
             Resources resources = new Resources();
             resources.Id = row["iId"].ToString();
             resources.vcTitle = row["vcTitle"].ToString();
             resources.Categorie = this.handlerService.skinService.categoriesHandlers.GetCategoriesById(row["iClassID"].ToString());
             resources.vcUrl = (string)row["vcUrl"].ToString();
             resources.vcContent = (string)row["vcContent"].ToString().Trim();
             resources.vcAuthor = (string)row["vcAuthor"].ToString().Trim();
             resources.iCount = (int)row["iCount"];
             resources.vcKeyWord = (string)row["vcKeyWord"].ToString().Trim();
             resources.vcEditor = (string)row["vcEditor"].ToString().Trim();
             resources.cCreated = (string)row["cCreated"].ToString().Trim();
             resources.vcSmallImg = (string)row["vcSmallImg"].ToString().Trim();
             resources.vcBigImg = (string)row["vcBigImg"].ToString().Trim();
             resources.vcShortContent = (string)row["vcShortContent"].ToString().Trim();
             resources.vcSpeciality = (string)row["vcSpeciality"].ToString().Trim();
             resources.cChecked = (string)row["cChecked"].ToString().Trim();
             resources.cDel = (string)row["cDel"].ToString().Trim();
             resources.cPostByUser = (string)row["cPostByUser"].ToString().Trim();
             resources.vcFilePath = (string)row["vcFilePath"].ToString().Trim();
             resources.dAddDate = (DateTime)row["dAddDate"];
             resources.dUpDateDate = (DateTime)row["dUpDateDate"];
             resources.vcTitleColor = (string)row["vcTitleColor"].ToString().Trim();
             resources.cStrong = (string)row["cStrong"].ToString().Trim();
             resources.SheifUrl = (string)row["SheifUrl"].ToString().Trim();
             CachingService.Set(resources.Id, resources, null);
             return (EntityBase)resources;
         case "TCG.Entity.Template":
             Template template = new Template();
             template.Id = row["Id"].ToString();
             //template.SkinInfo = row["SkinId"].ToString();
             template.TemplateType = this.handlerService.skinService.templateHandlers.GetTemplateType((int)row["TemplateType"]);
             template.iParentId = row["iParentId"].ToString();
             template.iSystemType = (int)row["iSystemType"];
             template.vcTempName = (string)row["vcTempName"];
             template.Content = (string)row["vcContent"];
             template.vcUrl = (string)row["vcUrl"];
             template.dAddDate = (DateTime)row["dAddDate"];
             template.dUpdateDate = (DateTime)row["dUpdateDate"];
             return (EntityBase)template;
         case "TCG.Entity.Skin":
             Skin skin = new Skin();
             skin.Id = row["Id"].ToString().Trim();
             skin.Name = row["Name"].ToString().Trim();
             skin.Pic = row["Pic"].ToString().Trim();
             //skin.Info = row["info"].ToString().Trim();
             skin.Filename = row["Filename"].ToString().Trim();
             return (EntityBase)skin;
         case "TCG.Entity.SheifSourceInfo":
             SheifSourceInfo sourceinfo = new SheifSourceInfo();
             sourceinfo.Id = row["ID"].ToString().Trim();
             sourceinfo.SourceName = row["SourceName"].ToString().Trim();
             sourceinfo.SourceUrl = row["SourceUrl"].ToString().Trim();
             sourceinfo.CharSet = row["CharSet"].ToString().Trim();
             sourceinfo.ListAreaRole = row["ListAreaRole"].ToString().Trim();
             sourceinfo.TopicListRole = row["TopicListRole"].ToString().Trim();
             sourceinfo.TopicListDataRole = row["TopicListDataRole"].ToString().Trim();
             sourceinfo.TopicRole = row["TopicRole"].ToString().Trim();
             sourceinfo.TopicDataRole = row["TopicDataRole"].ToString().Trim();
             sourceinfo.TopicPagerOld = row["TopicPagerOld"].ToString().Trim();
             sourceinfo.TopicPagerTemp = row["TopicPagerTemp"].ToString().Trim();
             sourceinfo.IsRss = (bool)row["IsRss"];
             return (EntityBase)sourceinfo;
         case "TCG.Entity.FileCategories":
             FileCategories filecagegories = new FileCategories();
             filecagegories.Id = row["iId"].ToString();
             filecagegories.iParentId = objectHandlers.ToInt(row["iParentId"]);
             filecagegories.dCreateDate = objectHandlers.ToTime(row["dCreateDate"].ToString());
             filecagegories.vcFileName = row["vcFileName"].ToString().Trim();
             filecagegories.vcMeno = row["vcMeno"].ToString().Trim();
             filecagegories.vcKey = row["vcKey"].ToString().Trim();
             filecagegories.MaxSpace = objectHandlers.ToLong(row["MaxSpace"]);
             filecagegories.Space = objectHandlers.ToLong(row["Space"]);
             return (EntityBase)filecagegories;
         case "TCG.Entity.FileResources":
             FileResources fileresource = new FileResources();
             fileresource.Id = row["iID"].ToString().Trim();
             fileresource.iClassId = (int)row["iClassId"];
             fileresource.iSize = (int)row["iSize"];
             fileresource.vcFileName = row["vcFileName"].ToString().Trim();
             fileresource.vcIP = row["vcIP"].ToString().Trim();
             fileresource.vcType = row["vcType"].ToString().Trim();
             fileresource.iRequest = (int)row["iRequest"];
             fileresource.iDowns = (int)row["iDowns"];
             fileresource.dCreateDate = (DateTime)row["dCreateDate"];
             return (EntityBase)fileresource;
         case "TCG.Entity.SheifCategorieConfig":
             SheifCategorieConfig sheifcategorieconfig = new SheifCategorieConfig();
             sheifcategorieconfig.Id = row["Id"].ToString();
             sheifcategorieconfig.SheifSourceId = row["SheifSourceId"].ToString().Trim();
             sheifcategorieconfig.LocalCategorieId = row["LocalCategorieId"].ToString().Trim();
             sheifcategorieconfig.ResourceCreateDateTime = objectHandlers.ToTime(row["ResourceCreateDateTime"].ToString().Trim());
             return (EntityBase)sheifcategorieconfig;
     }
     return null;
 }
Esempio n. 12
0
 public string UrlCheck(string url, Resources resource)
 {
     if (url.Substring(0, 7).ToLower() == "http://") return url;
     if (url.Substring(0, 1).ToLower() == "/")
     {
         string text = resource.SheifUrl.Substring(7, resource.SheifUrl.Length - 7);
         string www = text.Substring(0, text.IndexOf("/"));
         return "http://" + www + url;
     }
     else
     {
         return resource.SheifUrl.Substring(0, resource.SheifUrl.LastIndexOf("/") + 1) + url;
     }
 }
Esempio n. 13
0
        /// <summary>
        /// 获取文章中间外部网站的图片
        /// </summary>
        /// <param name="content"></param>
        /// <param name="url"></param>
        /// <param name="adminname"></param>
        /// <param name="fileclassid"></param>
        /// <returns></returns>
        public string ImgPatchInit(Resources resource, string url, Admin adminname, int fileclassid)
        {
            string parrten = "<(img|IMG)[^>]+src=\"([^\"]+)\"[^>]*>";
            MatchCollection matchs = Regex.Matches(resource.vcContent, parrten, RegexOptions.IgnoreCase | RegexOptions.Multiline);
            string temp = "";
            foreach (Match item in matchs)
            {
                string text1 = item.Result("$2");
                string domainstr = string.Empty;// objectHandlers.GetDomainName(text1);
                string domainstr1 = objectHandlers.GetDomainName(ConfigServiceEx.baseConfig["WebSite"]);
                if (!string.IsNullOrEmpty(domainstr) && domainstr != domainstr1)
                {
                    FileResources imgfile = new FileResources();

                    imgfile.Id = this.GetFlieName();
                    imgfile.iClassId = fileclassid;
                    string text2 = UrlCheck(text1, resource);
                    bool isload = false;
                    try
                    {
                        WebRequest myre = WebRequest.Create(text2);
                        isload = true;
                    }
                    catch (Exception ex)
                    {

                    }

                    if (isload)
                    {
                        WebClient wc = new WebClient();
                        byte[] b = wc.DownloadData(text2);
                        Stream s = new MemoryStream(b);

                        System.Drawing.Image loadimage = null;
                        try
                        {
                            loadimage = System.Drawing.Image.FromStream(s);
                        }
                        catch { }

                        if (loadimage != null)
                        {
                            if (loadimage.RawFormat.Equals(ImageFormat.Jpeg))
                            {
                                imgfile.vcType = ".jpg";
                            }
                            else if (loadimage.RawFormat.Equals(ImageFormat.Png))
                            {
                                imgfile.vcType = ".png";
                            }
                            else if (loadimage.RawFormat.Equals(ImageFormat.Tiff))
                            {
                                imgfile.vcType = ".tiff";
                            }
                            else if (loadimage.RawFormat.Equals(ImageFormat.Bmp))
                            {
                                imgfile.vcType = ".bmp";
                            }
                            else if (loadimage.RawFormat.Equals(ImageFormat.Gif))
                            {
                                imgfile.vcType = ".gif";
                            }
                            else
                            {
                                imgfile.vcType = ".jpg";
                            }

                            imgfile.iSize = b.Length;
                            string filename = imgfile.Id + imgfile.vcType;

                            string imagepath1 = string.Empty;

                            string filepatch = this.GetFilePath(filename, fileclassid, ref imagepath1);
                            try
                            {
                                objectHandlers.SaveFile(filepatch, "");

                                loadimage.Save(filepatch);
                                //int rtn = this.AddFileInfoByAdmin(adminname, imgfile);
                                //if (rtn < 0)
                                //{
                                //    System.IO.File.Delete(filepatch);
                                //}
                                //else
                                //{
                                //    resource.vcContent = resource.vcContent.Replace(text1, imagepath1);
                                //}

                                resource.vcContent = resource.vcContent.Replace(text1, imagepath1);
                            }
                            catch
                            {
                            }
                        }

                        imgfile = null;
                        wc = null;
                    }
                }
            }
            return resource.vcContent;
        }
Esempio n. 14
0
 /// <summary>
 /// 更新资源
 /// </summary>
 /// <param name="inf"></param>
 /// <returns></returns>
 public int UpdateResources(Resources inf)
 {
     string sql = "UPDATE resources SET iClassID='" + inf.Categorie.Id + "',vcTitle='" + inf.vcTitle + "',vcUrl='"
         + inf.vcUrl + "',vcContent='" + inf.vcContent.Replace("'", "''") + "',vcAuthor='" + inf.vcAuthor + "',iCount='"
         + inf.iCount + "',vcKeyWord='" + inf.vcKeyWord + "',vcEditor='" + inf.vcEditor + "',cCreated='"
         + inf.cCreated + "',vcSmallImg='" + inf.vcSmallImg + "',vcBigImg='" + inf.vcBigImg + "',vcShortContent='"
         + inf.vcShortContent.Replace("'", "''") + "',vcSpeciality='" + inf.vcSpeciality + "',cChecked='" + inf.cChecked + "',cDel='"
         + inf.cDel + "',cPostByUser='******',vcFilePath='" + inf.vcFilePath
         + "',dUpDateDate='" + inf.dUpDateDate + "',vcTitleColor = '" + inf.vcTitleColor + "',cStrong = '"
         + inf.cStrong + "',PropertiesCategorieId='" + inf.PropertiesCategorieId + "',CCCategories='" + inf.CCCategories + "' WHERE Id = " + inf.Id;
     string errText = string.Empty;
     return MsSqlFactory.conn.m_RunSQL(ref errText, sql);
 }
Esempio n. 15
0
        private void NewsManage(bool ismdy)
        {
            string categorieid = objectHandlers.Post("iClassId");
            Resources item = new Resources();

            int pcid = objectHandlers.ToInt(objectHandlers.Post("scp"));
            bool delrpold = false;
            int oldrpoid = 0;
            if (ismdy)
            {
                item = base.handlerService.resourcsService.resourcesHandlers.GetResourcesById(objectHandlers.ToInt(objectHandlers.Post("iNewsId")));
                if (item.PropertiesCategorieId != pcid)
                {
                    delrpold = true;
                    oldrpoid = item.PropertiesCategorieId;
                }
            }
            else
            {
                item.cChecked = "N";
                item.cCreated = "N";
                item.Id = (base.handlerService.resourcsService.resourcesHandlers.GetMaxResourceId() + 1).ToString();
            }

            item.vcTitle = objectHandlers.Post("iTitle");
            item.vcUrl = objectHandlers.Post("iUrl");
            item.vcContent = objectHandlers.Post("taContent");
            item.vcAuthor = objectHandlers.Post("iAuthor");
            item.vcKeyWord = objectHandlers.Post("iKeyWords");
            item.CCCategories = objectHandlers.Post("ccCheckBox");

            if (item.Categorie.Id != categorieid)
            {
                item.Categorie = base.handlerService.skinService.categoriesHandlers.GetCategoriesById(categorieid);
            }

            item.vcSpeciality = objectHandlers.Post("iSpeciality");
            item.vcBigImg = objectHandlers.Post("iBigImg");
            item.vcSmallImg = objectHandlers.Post("iSmallImg");
            item.vcTitleColor = objectHandlers.Post("sTitleColor");
            item.cStrong = objectHandlers.Post("iStrong");
            string s = objectHandlers.Post("iShortContent");
            item.vcShortContent = string.IsNullOrEmpty(s) ? objectHandlers.Left(objectHandlers.Post("iShortContent"), 100) : s;
            item.PropertiesCategorieId = pcid;

            if (string.IsNullOrEmpty(item.vcTitle))
            {
                base.AjaxErch(-1000000039, "");
                return;
            }

            if (string.IsNullOrEmpty(item.vcKeyWord))
            {
                base.AjaxErch(-1000000043, "");
                return;
            }

            if (string.IsNullOrEmpty(item.Categorie.Id))
            {
                base.AjaxErch(-1000000056, "");
                return;
            }

            item.vcEditor = base.adminInfo.vcAdminName;

            string filepath = "";
            string errText = string.Empty;
            int rtn = 0;

            if (!string.IsNullOrEmpty(item.vcUrl))
            {
                item.cCreated = "Y";
                item.cChecked = "Y";
            }

            try
            {
                if (!ismdy)
                {
                    rtn = base.handlerService.resourcsService.resourcesHandlers.CreateResources(item);
                    //处理
                    if (!string.IsNullOrEmpty(item.CCCategories))
                    {
                        string mid = item.Id;
                        item.CCCategories = item.CCCategories + ",";
                        if (item.CCCategories.IndexOf(",") > -1)
                        {
                            string[] ccs = item.CCCategories.Split(',');
                            for (int i = 0; i < ccs.Length; i++)
                            {
                                string txg = ccs[i];
                                if (!string.IsNullOrEmpty(txg))
                                {
                                    item.Id = (base.handlerService.resourcsService.resourcesHandlers.GetMaxResourceId() + 1).ToString();
                                    item.Categorie = base.handlerService.skinService.categoriesHandlers.GetCategoriesById(txg);
                                    item.SheifUrl = mid;
                                    item.CCCategories = "";
                                    rtn = base.handlerService.resourcsService.resourcesHandlers.CreateResources(item);
                                }
                            }
                        }
                    }
                }
                else
                {
                    rtn = base.handlerService.resourcsService.resourcesHandlers.UpdateResources(item);
                    if (delrpold)
                    {
                        rtn = base.handlerService.resourcsService.resourcesHandlers.DelResourcesProperties(item.Id);
                    }

                    //处理
                    if (!string.IsNullOrEmpty(item.CCCategories))
                    {
                        string mid1 = item.Id;
                        item.CCCategories = item.CCCategories + ",";
                        if (item.CCCategories.IndexOf(",") > -1)
                        {
                            string[] ccs = item.CCCategories.Split(',');
                            for (int i = 0; i < ccs.Length; i++)
                            {
                                string txg1 = ccs[i];
                                if (!string.IsNullOrEmpty(txg1))
                                {
                                    int num3 = 0, num2 = 0, num1 = 0;
                                    Dictionary<string, EntityBase> res = base.handlerService.resourcsService.resourcesHandlers.GetResourcesListPager(ref num3,
                                        ref num2, ref num1, 1, 1, "ID desc", "SheifUrl='" + mid1 + "' AND iClassid = '" + txg1 + "'");
                                    if (res != null && res.Count == 1)
                                    {
                                        Resources res1 = null;
                                        foreach (KeyValuePair<string, EntityBase> entity in res)
                                        {
                                            res1 = (Resources)entity.Value;
                                        }
                                        item.Id = res1.Id;
                                        item.Categorie = res1.Categorie;
                                        item.SheifUrl = res1.SheifUrl;
                                        item.CCCategories = "";
                                        rtn = base.handlerService.resourcsService.resourcesHandlers.UpdateResources(item);
                                    }
                                    else
                                    {
                                        item.Id = (base.handlerService.resourcsService.resourcesHandlers.GetMaxResourceId() + 1).ToString();
                                        item.Categorie = base.handlerService.skinService.categoriesHandlers.GetCategoriesById(txg1);
                                        item.SheifUrl = mid1;
                                        item.CCCategories = "";
                                        rtn = base.handlerService.resourcsService.resourcesHandlers.CreateResources(item);
                                    }
                                }
                            }
                        }
                    }
                }

                if (rtn == 1)
                {

                    foreach (string key in Request.Form.AllKeys)
                    {
                        if (key == string.Empty)
                        {
                            string sdgsg = "";
                        }
                        string[] keys = key.Split('_');

                        if (key.IndexOf("rpvalue_") > -1 && !string.IsNullOrEmpty(objectHandlers.Post(key)))
                        {
                            ResourceProperties rps = new ResourceProperties();
                            rps.Id = objectHandlers.Post("rpid_" + keys[1]);
                            rps.PropertieName = objectHandlers.Post("ptname_" + keys[1]);
                            rps.ResourceId = item.Id;
                            rps.PropertieValue = objectHandlers.Post("rpvalue_" + keys[1]);
                            rps.PropertieId = objectHandlers.ToInt(objectHandlers.Post("cpid_" + keys[1]));
                            rps.iOrder = objectHandlers.ToInt(objectHandlers.Post("rporder_" + keys[1]));
                            rtn = base.handlerService.resourcsService.resourcesHandlers.ResourcePropertiesManage(base.adminInfo, rps);
                        }
                        else if (key.IndexOf("rpvalue_") > -1 && string.IsNullOrEmpty(objectHandlers.Post(key)))
                        {

                            string Id = objectHandlers.Post("rpid_" + keys[1]);
                            if (!string.IsNullOrEmpty(Id))
                            {
                                rtn = base.handlerService.resourcsService.resourcesHandlers.DelResourcesPropertiesOnIds(item.Id, Id);
                            }
                        }
                    }
                }

                if (item.cChecked == "Y")
                {
                    rtn = base.handlerService.tagService.CreateResourcHtmlById(ref errText, objectHandlers.ToInt(item.Id));
                }

                //更新列表分页第一页
                int pagecount = 0;
                if (item.cChecked == "Y" && item.cCreated == "Y" && item.cDel == "N")
                {
                    rtn = base.handlerService.tagService.CreateClassList(item.Categorie.Id, 0, ref pagecount, ref errText);
                }
            }
            catch (Exception ex)
            {
                base.ajaxdata = "{state:false,message:\"" + objectHandlers.JSEncode(ex.Message.ToString()) + "\"}";
                base.AjaxErch(base.ajaxdata);
                return;
            }

            if (ismdy)
            {
                base.AjaxErch(rtn, "文章修改成功!");
            }
            else
            {
                base.AjaxErch(rtn, "文章添加成功,请继续添加!", "NewsAddPostBack()");
            }
        }
Esempio n. 16
0
 /// <summary>
 /// 从记录行中得到实体
 /// </summary>
 /// <param name="?"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static EntityBase GetEntityObjectFromRow(DataRow row, Type type)
 {
     if (row == null) return null;
     switch (type.ToString())
     {
         case "TCG.Entity.Categories":
             Categories categories = new Categories();
             categories.Id = row["Id"].ToString().Trim();
             categories.ResourceListTemplate = templateHandlers.GetTemplateByID(row["iListTemplate"].ToString());
             categories.iOrder = (int)row["iOrder"];
             categories.Parent = row["Parent"].ToString().Trim();
             categories.ResourceTemplate = templateHandlers.GetTemplateByID(row["iTemplate"].ToString());
             categories.vcClassName = row["vcClassName"].ToString().Trim();
             categories.vcDirectory = row["vcDirectory"].ToString().Trim();
             categories.vcName = row["vcName"].ToString().Trim();
             categories.vcUrl = row["vcUrl"].ToString().Trim();
             categories.dUpdateDate = (DateTime)row["dUpdateDate"];
             categories.cVisible = row["Visible"].ToString().Trim();
             categories.DataBaseService = row["DataBaseService"].ToString().Trim();
             categories.SkinInfo = skinHandlers.GetSkinEntityBySkinId(row["SkinId"].ToString().Trim());
             categories.IsSinglePage = row["IsSinglePage"].ToString().Trim();
             categories.vcPic = row["vcPic"].ToString().Trim();
             categories.vcSpeciality = (row["vcSpeciality"] == null) ? "" : row["vcSpeciality"].ToString();
             return (EntityBase)categories;
         case "TCG.Entity.Resources":
             Resources resources = new Resources();
             resources.Id = row["Id"].ToString();
             resources.vcTitle = row["vcTitle"].ToString();
             resources.Categorie = categoriesHandlers.GetCategoriesById(row["iClassID"].ToString());
             resources.vcUrl = (string)row["vcUrl"].ToString();
             resources.vcContent = (string)row["vcContent"].ToString().Trim();
             resources.vcAuthor = (string)row["vcAuthor"].ToString().Trim();
             resources.iCount = (int)row["iCount"];
             resources.vcKeyWord = (string)row["vcKeyWord"].ToString().Trim();
             resources.vcEditor = (string)row["vcEditor"].ToString().Trim();
             resources.cCreated = (string)row["cCreated"].ToString().Trim();
             resources.vcSmallImg = (string)row["vcSmallImg"].ToString().Trim();
             resources.vcBigImg = (string)row["vcBigImg"].ToString().Trim();
             resources.vcShortContent = (string)row["vcShortContent"].ToString().Trim();
             resources.vcSpeciality = (string)row["vcSpeciality"].ToString().Trim();
             resources.cChecked = (string)row["cChecked"].ToString().Trim();
             resources.cDel = (string)row["cDel"].ToString().Trim();
             resources.cPostByUser = (string)row["cPostByUser"].ToString().Trim();
             resources.vcFilePath = (string)row["vcFilePath"].ToString().Trim();
             resources.dAddDate = (DateTime)row["dAddDate"];
             resources.dUpDateDate = (DateTime)row["dUpDateDate"];
             resources.vcTitleColor = (string)row["vcTitleColor"].ToString().Trim();
             resources.cStrong = (string)row["cStrong"].ToString().Trim();
             resources.SheifUrl = (string)row["SheifUrl"].ToString().Trim();
             resources.PropertiesCategorieId = objectHandlers.ToInt(row["PropertiesCategorieId"]);
             resources.CCCategories = row["CCCategories"].ToString();
             CachingService.Set(resources.Id, resources, null);
             return (EntityBase)resources;
         case "TCG.Entity.Template":
             Template template = new Template();
             template.Id = row["Id"].ToString();
             template.SkinInfo = skinHandlers.GetSkinEntityBySkinId(row["SkinId"].ToString());
             template.TemplateType = templateHandlers.GetTemplateType((int)row["TemplateType"]);
             template.iParentId = row["iParentId"].ToString();
             template.iSystemType = (int)row["iSystemType"];
             template.vcTempName = (string)row["vcTempName"];
             template.Content = (string)row["vcContent"];
             template.vcUrl = (string)row["vcUrl"];
             template.dAddDate = (DateTime)row["dAddDate"];
             template.dUpdateDate = (DateTime)row["dUpdateDate"];
             return (EntityBase)template;
         case "TCG.Entity.Skin":
             Skin skin = new Skin();
             skin.Id = row["Id"].ToString().Trim();
             skin.Name = row["Name"].ToString().Trim();
             skin.Pic = row["Pic"].ToString().Trim();
             skin.WebDescription = row["WebDescription"].ToString().Trim();
             skin.Filename = row["Filename"].ToString().Trim();
             skin.WebKeyWords = row["WebKeyWords"].ToString().Trim();
             skin.IndexPage = row["IndexPage"].ToString().Trim();
             return (EntityBase)skin;
         case "TCG.Entity.SheifSourceInfo":
             SheifSourceInfo sourceinfo = new SheifSourceInfo();
             sourceinfo.Id = row["ID"].ToString().Trim();
             sourceinfo.SourceName = row["SourceName"].ToString().Trim();
             sourceinfo.SourceUrl = row["SourceUrl"].ToString().Trim();
             sourceinfo.CharSet = row["CharSet"].ToString().Trim();
             sourceinfo.ListAreaRole = row["ListAreaRole"].ToString().Trim();
             sourceinfo.TopicListRole = row["TopicListRole"].ToString().Trim();
             sourceinfo.TopicListDataRole = row["TopicListDataRole"].ToString().Trim();
             sourceinfo.TopicRole = row["TopicRole"].ToString().Trim();
             sourceinfo.TopicDataRole = row["TopicDataRole"].ToString().Trim();
             sourceinfo.TopicPagerOld = row["TopicPagerOld"].ToString().Trim();
             sourceinfo.TopicPagerTemp = row["TopicPagerTemp"].ToString().Trim();
             sourceinfo.IsRss = (bool)row["IsRss"];
             return (EntityBase)sourceinfo;
         case "TCG.Entity.FileCategories":
         //FileCategories filecagegories = new FileCategories();
         //filecagegories.Id = row["iId"].ToString();
         //filecagegories.iParentId = objectHandlers.ToInt(row["iParentId"]);
         //filecagegories.dCreateDate = objectHandlers.ToTime(row["dCreateDate"].ToString());
         //filecagegories.vcFileName = row["vcFileName"].ToString().Trim();
         //filecagegories.vcMeno = row["vcMeno"].ToString().Trim();
         //filecagegories.vcKey = row["vcKey"].ToString().Trim();
         //filecagegories.MaxSpace = objectHandlers.ToLong(row["MaxSpace"]);
         //filecagegories.Space = objectHandlers.ToLong(row["Space"]);
         //return (EntityBase)filecagegories;
         case "TCG.Entity.FileResources":
         //FileResources fileresource = new FileResources();
         //fileresource.Id = row["iID"].ToString().Trim();
         //fileresource.iClassId = (int)row["iClassId"];
         //fileresource.iSize = (int)row["iSize"];
         //fileresource.vcFileName = row["vcFileName"].ToString().Trim();
         //fileresource.vcIP = row["vcIP"].ToString().Trim();
         //fileresource.vcType = row["vcType"].ToString().Trim();
         //fileresource.iRequest = (int)row["iRequest"];
         //fileresource.iDowns = (int)row["iDowns"];
         //fileresource.dCreateDate = (DateTime)row["dCreateDate"];
         //return (EntityBase)fileresource;
         case "TCG.Entity.SheifCategorieConfig":
             SheifCategorieConfig sheifcategorieconfig = new SheifCategorieConfig();
             sheifcategorieconfig.Id = row["Id"].ToString();
             sheifcategorieconfig.SheifSourceId = row["SheifSourceId"].ToString().Trim();
             sheifcategorieconfig.LocalCategorieId = row["LocalCategorieId"].ToString().Trim();
             sheifcategorieconfig.ResourceCreateDateTime = objectHandlers.ToTime(row["ResourceCreateDateTime"].ToString().Trim());
             return (EntityBase)sheifcategorieconfig;
         case "TCG.Entity.Properties":
             Properties categorieProperties = new Properties();
             categorieProperties.Id = row["Id"].ToString();
             categorieProperties.ProertieName = row["ProertieName"].ToString();
             categorieProperties.PropertiesCategorieId = row["PropertiesCategorieId"].ToString();
             categorieProperties.Type = row["Type"].ToString();
             categorieProperties.Values = row["Values"].ToString();
             categorieProperties.width = objectHandlers.ToInt(row["width"].ToString());
             categorieProperties.height = objectHandlers.ToInt(row["height"].ToString());
             categorieProperties.iOrder = objectHandlers.ToInt(row["iOrder"].ToString());
             return (EntityBase)categorieProperties;
         case "TCG.Entity.ResourceProperties":
             ResourceProperties rategorieProperties = new ResourceProperties();
             rategorieProperties.Id = row["Id"].ToString();
             rategorieProperties.ResourceId = row["ResourceId"].ToString();
             rategorieProperties.PropertieName = row["PropertieName"].ToString();
             rategorieProperties.PropertieValue = row["PropertieValue"].ToString();
             rategorieProperties.PropertieId = objectHandlers.ToInt(row["PropertieId"].ToString());
             rategorieProperties.iOrder = objectHandlers.ToInt(row["iOrder"].ToString());
             return (EntityBase)rategorieProperties;
         case "TCG.Entity.PropertiesCategorie":
             PropertiesCategorie pc = new PropertiesCategorie();
             pc.CategoriePropertiesName = row["CategoriePropertiesName"].ToString();
             pc.Id = row["Id"].ToString();
             pc.Visible = row["Visible"].ToString();
             pc.Visible = row["Visible"].ToString();
             return (EntityBase)pc;
         case "TCG.Entity.Speciality":
             Speciality speciality = new Speciality();
             speciality.Id = row["Id"].ToString();
             speciality.SkinId = (string)row["SkinId"];
             speciality.iParent = (int)row["iParent"];
             speciality.vcTitle = (string)row["vcTitle"];
             speciality.vcExplain = (string)row["vcExplain"];
             speciality.dUpDateDate = (DateTime)row["dUpDateDate"];
             return (EntityBase)speciality;
         case "TCG.Entity.FeedBack":
             FeedBack feedBack = new FeedBack();
             feedBack.Id = row["Id"].ToString();
             feedBack.UserName = row["UserName"].ToString();
             feedBack.Tel = row["Tel"].ToString();
             feedBack.QQ = row["QQ"].ToString();
             feedBack.Content = row["Content"].ToString();
             feedBack.AddDate = objectHandlers.ToTime(row["AddDate"].ToString());
             feedBack.Ip = row["Ip"].ToString();
             feedBack.SkinId = row["SkinId"].ToString();
             feedBack.Title = row["Title"].ToString();
             feedBack.Email = row["Email"].ToString();
             return (EntityBase)feedBack;
     }
     return null;
 }