public int CreateCategories(Categories cif)
 {
     string Sql = "INSERT INTO Categories(Id,vcClassName,vcName,SkinId,Parent,iTemplate,iListTemplate,vcDirectory,vcUrl,iOrder,Visible,DataBaseService,IsSinglePage,vcPic,vcSpeciality)"
             + "VALUES('" + cif.Id + "','" + cif.vcClassName + "','" + cif.vcName + "','" + cif.SkinInfo.Id + "','" + cif.Parent + "','" + cif.ResourceTemplate.Id + "','"
             + cif.ResourceListTemplate.Id + "','" + cif.vcDirectory + "','" + cif.vcUrl + "','" + cif.iOrder + "','" + cif.cVisible + "','" + cif.DataBaseService + "','"
             + cif.IsSinglePage + "','" + cif.vcPic + "','" + cif.vcSpeciality + "')";
     string errText = string.Empty;
     return AccessFactory.conn.m_RunSQL(ref errText, Sql);
 }
        public int CreateCategoriesForXml(Admin admininfo, Categories cif)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admininfo);
            if (rtn < 0) return rtn;

            //分类名或别名不能为空
            if (string.IsNullOrEmpty(cif.vcClassName) || string.IsNullOrEmpty(cif.vcName))
            {
                return -1000000020;
            }

            //分类所属模板不能为空
            if (cif.SkinInfo == null)
            {
                return -1000000100;
            }

            if (cif.Parent != "0")
            {
                //模版编号不能为空
                if (string.IsNullOrEmpty(cif.ResourceListTemplate.Id))
                {
                    return -1000000029;
                }
            }

            if (cif.Parent != "0")
            {
                //列表模版编号不能为空
                if (string.IsNullOrEmpty(cif.ResourceListTemplate.Id))
                {
                    return -1000000029;
                }

                //模版编号不能为空
                if (string.IsNullOrEmpty(cif.ResourceTemplate.Id))
                {
                    return -1000000021;
                }

                //生成路径不能为空
                if (string.IsNullOrEmpty(cif.vcDirectory))
                {
                    return -1000000022;
                }
            }

            return DataBaseFactory.CategoriesHandlers.CreateCategories(cif);
        }
 public int CreateCategoriesForXml(Categories cif)
 {
     SqlParameter sp2 = new SqlParameter("@vcClassName", SqlDbType.VarChar, 200); sp2.Value = cif.vcClassName;
     SqlParameter sp3 = new SqlParameter("@vcName", SqlDbType.VarChar, 50); sp3.Value = cif.vcName;
     SqlParameter sp4 = new SqlParameter("@Parent", SqlDbType.VarChar, 36); sp4.Value = cif.Parent;
     SqlParameter sp5 = new SqlParameter("@iTemplate", SqlDbType.VarChar, 36); sp5.Value = cif.ResourceTemplate.Id;
     SqlParameter sp6 = new SqlParameter("@iListTemplate", SqlDbType.VarChar, 36); sp6.Value = cif.ResourceListTemplate.Id;
     SqlParameter sp7 = new SqlParameter("@vcDirectory", SqlDbType.VarChar, 200); sp7.Value = cif.vcDirectory;
     SqlParameter sp8 = new SqlParameter("@vcUrl", SqlDbType.VarChar, 255); sp8.Value = cif.vcUrl;
     SqlParameter sp9 = new SqlParameter("@iOrder", SqlDbType.Int, 4); sp9.Value = cif.iOrder;
     SqlParameter sp10 = new SqlParameter("@reValue", SqlDbType.Int); sp10.Direction = ParameterDirection.Output;
     SqlParameter sp11 = new SqlParameter("@cVisible", SqlDbType.Char, 1); sp11.Value = cif.cVisible;
     SqlParameter sp12 = new SqlParameter("@iClassId", SqlDbType.VarChar, 36); sp12.Value = cif.Id;
     SqlParameter sp13 = new SqlParameter("@SkinId", SqlDbType.VarChar, 36); sp13.Value = cif.SkinInfo;
     string[] reValues = conn.Execute("SP_Skin_categories_Manage", new SqlParameter[] { sp2, sp3, sp4, sp5, sp6,
         sp7, sp8, sp9 ,sp10,sp11,sp12,sp13}, new int[] { 8 });
     if (reValues != null)
     {
         int rtn = (int)Convert.ChangeType(reValues[0], typeof(int));
         return rtn;
     }
     return -19000000;
 }
        private void CategorieslistTagFieldsRelace(ref string temp, ref TCGTagPagerInfo pagerinfo,Categories categorie)
        {
            string url = "#";
            if (!string.IsNullOrEmpty(categorie.vcUrl))
            {
                url = (categorie.vcUrl.IndexOf(".") > -1) ? categorie.vcUrl : categorie.vcUrl + ConfigServiceEx.baseConfig["FileExtension"];
            }
            else
            {
                if (categorie.IsSinglePage == "Y")
                {
                    Resources res = base.handlerService.resourcsService.resourcesHandlers.GetNewsResourcesAtCategorie(categorie.Id);
                    if (res != null && categorie.IsSinglePage == "Y" && !string.IsNullOrEmpty(res.vcFilePath))
                    {
                        url = res.vcFilePath;
                    }
                }
                else
                {
                   Dictionary<string,EntityBase> chiledcategorys = base.handlerService.skinService.categoriesHandlers.GetCategoriesEntityByParentId(categorie.Id, categorie.SkinInfo.Id);
                   foreach (KeyValuePair<string, EntityBase> keyvalue in chiledcategorys)
                   {
                       Categories ctgr = keyvalue.Value as Categories;
                       if (ctgr != null)
                       {
                           if (!string.IsNullOrEmpty(ctgr.vcUrl))
                           {
                               url = (ctgr.vcUrl.IndexOf(".") > -1) ? ctgr.vcUrl : ctgr.vcUrl + ConfigServiceEx.baseConfig["FileExtension"];
                           }
                           else
                           {
                               if (ctgr.IsSinglePage == "Y")
                               {
                                   Resources res1 = base.handlerService.resourcsService.resourcesHandlers.GetNewsResourcesAtCategorie(ctgr.Id);
                                   if (res1 != null && ctgr.IsSinglePage == "Y" && !string.IsNullOrEmpty(res1.vcFilePath))
                                   {
                                       url = res1.vcFilePath;
                                   }
                               }
                           }
                       }
                       if (!string.IsNullOrEmpty(url)) break;
                   }
                }
            }

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

            temp = temp.Replace("$" + this._tagtype + "_iParent$", "<TCG>" + categorie.Parent.ToString() + "</TCG>");
            Categories cinfo = this.handlerService.skinService.categoriesHandlers.GetCategoriesParent2(categorie.Id);
            temp = temp.Replace("$" + this._tagtype + "_iParentId2$", "<TCG>" + cinfo.Id + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_iParentvcClassName2$", "<TCG>" + cinfo.vcClassName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_iParentvcName2$", "<TCG>" + cinfo.vcName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_ClassTitleList$",
                    "<TCG>" + this.handlerService.skinService.categoriesHandlers.GetResourcesCategoriesIndex(categorie.Id, " > ") + "</TCG>");

            bool isintitle = objectHandlers.ToBoolen(this.GetAttribute("intitle"), false);
            if (isintitle) pagerinfo.PageTitle += (string.IsNullOrEmpty(pagerinfo.PageTitle) ? "" : " - ") + categorie.vcClassName;

            temp = temp.Replace("$" + this._tagtype + "_Id$", "<TCG>" + categorie.Id + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcClassName$", "<TCG>" + categorie.vcClassName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcName$", "<TCG>" + categorie.vcName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcPic$", "<TCG>/skin/"
                + pagerinfo.SkinInfo.Filename + categorie.vcPic + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_allchildid$", "<TCG>" + base.handlerService.skinService.categoriesHandlers.GetCategoriesChild(categorie.Id) + "</TCG>");

            temp = base.tcgTagStringFunHandlers.StringColoumFun(temp, false);
        }
 /// <summary>
 /// 修改分类
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="adminname"></param>
 /// <param name="classinf"></param>
 /// <returns></returns>
 public int UpdateCategories(Categories cif)
 {
     string Sql = "UPDATE Categories SET vcClassName='" + cif.vcClassName + "',vcName='" + cif.vcName + "',Parent='" + cif.Parent + "',"
             + "iTemplate='" + cif.ResourceTemplate.Id + "',iListTemplate='" + cif.ResourceListTemplate.Id + "',vcDirectory='" + cif.vcDirectory + "',vcUrl='"
             + cif.vcUrl + "',iOrder=" + cif.iOrder + ",Visible = '" + cif.cVisible + "',DataBaseService='" + cif.DataBaseService + "', IsSinglePage = '"
             + cif.IsSinglePage + "',vcPic='" + cif.vcPic + "',vcSpeciality='" + cif.vcSpeciality + "' WHERE ID ='" + cif.Id + "'";
     string errText = string.Empty;
     return AccessFactory.conn.m_RunSQL(ref errText, Sql);
 }
        /// <summary>
        /// 从一个XML里面更新分类
        /// </summary>
        /// <param name="skinid"></param>
        /// <returns></returns>
        public int UpdateCategoriesFromXML(Admin admininfo,string skinid)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admininfo);
            if (rtn < 0) return rtn;

            Skin skininfo = HandlersFactory.skinHandlers.GetSkinEntityBySkinId(skinid);

            if (skininfo == null)
            {
                return -1000000701;
            }

            XmlDocument document = new XmlDocument();
            document.Load(HttpContext.Current.Server.MapPath("~/skin/" + skininfo.Filename + "/categories.config"));
            XmlNodeList nodelis1t = document.GetElementsByTagName("Categorie");
            if (nodelis1t != null && nodelis1t.Count > 0)
            {
                foreach (XmlElement element in nodelis1t)
                {
                    Categories categories = new Categories();
                    categories.Id = element.SelectSingleNode("Id").InnerText.ToString();
                    categories.Parent = element.SelectSingleNode("Parent").InnerText.ToString();
                    categories.ResourceListTemplate = new Template();
                    categories.ResourceListTemplate.Id = element.SelectSingleNode("ResourceListTemplate").InnerText.ToString();
                    categories.ResourceTemplate = new Template();
                    categories.ResourceTemplate.Id = element.SelectSingleNode("ResourceTemplate").InnerText.ToString();
                    categories.iOrder = objectHandlers.ToInt(element.SelectSingleNode("iOrder").InnerText.ToString());
                    categories.dUpdateDate = objectHandlers.ToTime(element.SelectSingleNode("dUpdateDate").InnerText.ToString());
                    categories.dUpdateDate = objectHandlers.ToTime(element.SelectSingleNode("dUpdateDate").InnerText.ToString());
                    categories.vcClassName = element.SelectSingleNode("vcClassName").InnerText.ToString();
                    categories.vcName = element.SelectSingleNode("vcName").InnerText.ToString();
                    categories.vcDirectory = element.SelectSingleNode("vcDirectory").InnerText.ToString();
                    categories.vcUrl = element.SelectSingleNode("vcUrl").InnerText.ToString();
                    categories.cVisible = element.SelectSingleNode("cVisible").InnerText.ToString();
                    categories.DataBaseService = element.SelectSingleNode("DataBaseService").InnerText.ToString();
                    categories.SkinInfo = skininfo;
                    Categories t_categories = this.GetCategoriesById(categories.Id);
                    if (t_categories == null)
                    {
                        this.CreateCategoriesForXml(admininfo,categories);
                    }
                    else
                    {
                        this.UpdateCategories(admininfo,categories);
                    }
                }
            }

            CachingService.Remove(CachingService.CACHING_ALL_CATEGORIES);
            CachingService.Remove(CachingService.CACHING_ALL_CATEGORIES_ENTITY);
            return 1;
        }
 /// <summary>
 /// 添加新闻分类
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="adminname"></param>
 /// <param name="classname"></param>
 /// <param name="lname"></param>
 /// <param name="parentid"></param>
 /// <param name="templateid"></param>
 /// <param name="ltemplateid"></param>
 /// <param name="dir"></param>
 /// <param name="url"></param>
 /// <param name="order"></param>
 /// <returns></returns>
 public int CreateCategories(Admin admininfo,Categories cif)
 {
     if (string.IsNullOrEmpty(cif.Id))cif.Id = Guid.NewGuid().ToString();
     return CreateCategoriesForXml(admininfo,cif);
 }
        /// <summary>
        /// 修改分类
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="adminname"></param>
        /// <param name="classinf"></param>
        /// <returns></returns>
        public int UpdateCategories(Admin admininfo,Categories cif)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admininfo);
            if (rtn < 0) return rtn;

            //分类名或别名不能为空
            if (string.IsNullOrEmpty(cif.vcClassName) || string.IsNullOrEmpty(cif.vcName))
            {
                return -1000000020;
            }

            //父类ID不能为自己的ID
            if(cif.Parent==cif.Id)
            {
                return -1000000030;
            }

            if (cif.Parent != "0")
            {
                //模版编号不能为空
                if (string.IsNullOrEmpty(cif.ResourceListTemplate.Id))
                {
                    return -1000000029;
                }
            }

            if (cif.Parent != "0")
            {
                //列表模版编号不能为空
                if (string.IsNullOrEmpty(cif.ResourceListTemplate.Id))
                {
                    return -1000000029;
                }

                //模版编号不能为空
                if (string.IsNullOrEmpty(cif.ResourceTemplate.Id))
                {
                    return -1000000021;
                }

                //生成路径不能为空
                if (string.IsNullOrEmpty(cif.vcDirectory))
                {
                    return -1000000022;
                }

            }

               return DataBaseFactory.CategoriesHandlers.UpdateCategories(cif);
        }
        private void CategorieslistTagFieldsRelace(ref string temp, Categories categorie)
        {
            temp = temp.Replace("$" + this._tagtype + "_Id$", "<TCG>" + categorie.Id + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcClassName$", "<TCG>" + categorie.vcClassName + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_vcName$", "<TCG>" + categorie.vcName + "</TCG>");

            string url = (categorie.vcUrl.IndexOf('.') > -1 ? categorie.vcUrl : categorie.vcUrl + base.configService.baseConfig["FileExtension"]);
            temp = temp.Replace("$" + this._tagtype + "_vcUrl$", "<TCG>" + url + "</TCG>");
            temp = temp.Replace("$" + this._tagtype + "_allchildid$", "<TCG>" + base.handlerService.skinService.categoriesHandlers.GetCategoriesChild(categorie.Id) + "</TCG>");

            temp = base.tcgTagStringFunHandlers.StringColoumFun(temp, false);
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //检测管理员登录
            base.handlerService.manageService.adminHandlers.CheckAdminLogin();
            base.handlerService.manageService.adminHandlers.CheckAdminPop(25);

            if (!Page.IsPostBack)
            {
                this.Init();
            }
            else
            {

                string skinid = objectHandlers.Get("SkinId");
                if (string.IsNullOrEmpty(skinid)) skinid = ConfigServiceEx.DefaultSkinId;

                Categories cif = new Categories();
                cif.vcClassName = objectHandlers.Post("iClassName");
                cif.vcName = objectHandlers.Post("iName");
                cif.vcDirectory = objectHandlers.Post("iDirectory");
                cif.vcUrl = objectHandlers.Post("iUrl");
                cif.Parent = objectHandlers.Post("iParentId");
                cif.ResourceTemplate = base.handlerService.skinService.templateHandlers.GetTemplateByID(objectHandlers.Post("sTemplate"));
                cif.ResourceListTemplate = base.handlerService.skinService.templateHandlers.GetTemplateByID(objectHandlers.Post("slTemplate"));
                cif.iOrder = objectHandlers.ToInt(objectHandlers.Post("iOrder"));
                cif.SkinInfo = base.handlerService.skinService.skinHandlers.GetSkinEntityBySkinId(skinid);
                cif.IsSinglePage = string.IsNullOrEmpty(objectHandlers.Post("iIsSinglePage")) ? "N" : "Y";
                cif.vcPic = objectHandlers.Post("iPic");
                cif.cVisible = objectHandlers.Post("sVisite");

                if (string.IsNullOrEmpty(cif.vcClassName) || string.IsNullOrEmpty(cif.vcName))
                {
                    base.AjaxErch(-1, "");
                    return;
                }

                if (string.IsNullOrEmpty(cif.Parent))
                {
                    if (cif.ResourceTemplate == null || cif.ResourceListTemplate == null)
                    {
                        base.AjaxErch(-1, "");
                        return;
                    }
                }

                int rtn = 0;
                try
                {
                    string cid = Guid.NewGuid().ToString();
                    cif.Id = cid;
                    rtn = base.handlerService.skinService.categoriesHandlers.CreateCategories(base.adminInfo, cif);
                    rtn = base.handlerService.skinService.categoriesHandlers.CreateCategoriesToXML(base.adminInfo, cif.SkinInfo.Id);
                    if (rtn == 1)
                    {
                        CachingService.Remove(CachingService.CACHING_ALL_CATEGORIES);
                        CachingService.Remove(CachingService.CACHING_ALL_CATEGORIES_ENTITY);
                    }

                }
                catch (Exception ex)
                {
                    base.ajaxdata = "{state:false,message:\"" + objectHandlers.JSEncode(ex.Message.ToString()) + "\"}";
                    base.AjaxErch(base.ajaxdata);
                    return;
                }

                base.AjaxErch(rtn, "分类添加成功!");
            }
        }
Beispiel #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;
 }
Beispiel #12
0
 /// <summary>
 /// ������ŷ���
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="adminname"></param>
 /// <param name="classname"></param>
 /// <param name="lname"></param>
 /// <param name="parentid"></param>
 /// <param name="templateid"></param>
 /// <param name="ltemplateid"></param>
 /// <param name="dir"></param>
 /// <param name="url"></param>
 /// <param name="order"></param>
 /// <returns></returns>
 public int CreateCategories(Categories cif)
 {
     cif.Id = Guid.NewGuid().ToString();
     return CreateCategoriesForXml(cif);
 }
Beispiel #13
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;
 }