public int CategoriePropertiesDEL(Admin admininf, int cpid)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admininf);
            if (rtn < 0) return rtn;

            return DataBaseFactory.CategoriesHandlers.CategoriePropertiesDEL(cpid);
        }
Exemple #2
0
        /// <summary>
        /// 添加新的分类
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="adminname"></param>
        /// <param name="fcif"></param>
        /// <returns></returns>
        public int AddFileInfoByAdmin(Admin adminf, FileResources fif)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(adminf);
            if (rtn < 0) return rtn;

            //文件所在的文件夹不能为空
            if (fif.iClassId == 0)
            {
                return -1000000060;
            }

            //文件名称不能为空
            if (string.IsNullOrEmpty(fif.vcFileName))
            {
                return -1000000061;
            }

            //文件类型不能为空
            if (string.IsNullOrEmpty(fif.vcType))
            {
                return -1000000062;
            }

            //文件类型不能为空
            if (fif.iSize==0)
            {
                return -1000000063;
            }

            return DataBaseFactory.FileHandlers.AddFileInfoByAdmin(fif);
        }
        public int CategoriePropertiesManage(Admin admin, Properties cp)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admin);
            if (rtn < 0) return rtn;

               return DataBaseFactory.CategoriesHandlers.CategoriePropertiesManage(cp);
        }
        public int DelFeedBackById(Admin admininfo, string ids)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admininfo);
            if (rtn < 0) return rtn;

            return DataBaseFactory.feedBackHandlers.DelFeedBackById(ids);
        }
        /// <summary>
        /// 添加模板
        /// </summary>
        /// <param name="item"></param>
        /// <param name="admin"></param>
        /// <returns></returns>
        public int AddTemplate(Template item, Admin admin)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admin);
            if (rtn < 0) return rtn;

            item.Id = Guid.NewGuid().ToString();

            return DataBaseFactory.TemplateHandlers.AddTemplate(item);
        }
        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);
        }
        /// <summary>
        /// 创建皮肤模板文件 
        /// </summary>
        /// <param name="skinid"></param>
        /// <param name="admin"></param>
        /// <returns></returns>
        public int CreateTemplateToXML( Admin admin,string skinid)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admin);
            if (rtn < 0) return rtn;

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

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

            //得到所有模板
            StringBuilder sbtemplate = new StringBuilder();
            sbtemplate.Append("<?xml version=\"1.0\"?>\r\n");
            sbtemplate.Append("<Templates>\r\n");
            Dictionary<string, EntityBase> templates = this.GetAllTemplatesEntity();
            if (templates != null && templates.Count > 0)
            {
                foreach (KeyValuePair<string, EntityBase> entity in templates)
                {
                    Template temp = (Template)entity.Value;
                    if (temp.SkinInfo.Id == skinid)
                    {
                        sbtemplate.Append("<Template>\r\n");
                        sbtemplate.Append("\t<Id>" + temp.Id + "</Id>\r\n");
                        sbtemplate.Append("\t<Content><![CDATA[" + temp.Content + "]]></Content>\r\n");
                        sbtemplate.Append("\t<SkinId>" + temp.SkinInfo.Id + "</SkinId>\r\n");
                        sbtemplate.Append("\t<TemplateType>" + ((int)temp.TemplateType).ToString() + "</TemplateType>\r\n");
                        sbtemplate.Append("\t<iParentId>" + temp.iParentId + "</iParentId>\r\n");
                        sbtemplate.Append("\t<iSystemType>" + temp.iSystemType + "</iSystemType>\r\n");
                        sbtemplate.Append("\t<dUpdateDate>" + temp.dUpdateDate + "</dUpdateDate>\r\n");
                        sbtemplate.Append("\t<dAddDate>" + temp.dAddDate + "</dAddDate>\r\n");
                        sbtemplate.Append("\t<vcTempName>" + temp.vcTempName + "</vcTempName>\r\n");
                        sbtemplate.Append("\t<vcUrl>" + temp.vcUrl + "</vcUrl>\r\n");
                        sbtemplate.Append("</Template>\r\n");
                    }
                }
            }
            sbtemplate.Append("</Templates>");

            objectHandlers.SaveFile(HttpContext.Current.Server.MapPath("~/skin/" + skininfo.Filename + "/template.config"), sbtemplate.ToString());

            return 1;
        }
Exemple #8
0
        /// <summary>
        /// 添加新的分类
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="adminname"></param>
        /// <param name="fcif"></param>
        /// <returns></returns>
        public int AddFileClass(Admin adminf, FileCategories fcif)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(adminf);
            if (rtn < 0) return rtn;

            //文件名不能为空
            if (string.IsNullOrEmpty(fcif.vcFileName))
            {
                return -1000000057;
            }

            //简单说明不能为空
            if (string.IsNullOrEmpty(fcif.vcMeno))
            {
               return -1000000058;
            }
            return DataBaseFactory.FileHandlers.AddFileClass(fcif);
        }
        /// <summary>
        /// 添加模板
        /// </summary>
        /// <param name="item"></param>
        /// <param name="admin"></param>
        /// <returns></returns>
        public int AddTemplateForXml(Template item, Admin admin)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admin);
            if (rtn < 0) return rtn;

            //单页时地址不能为空
            if (((int)item.TemplateType) == -1 && string.IsNullOrEmpty(item.vcUrl))
            {
                return -1000000024;
            }

            //模板内容不能为空
            if (string.IsNullOrEmpty(item.Content))
            {
                return -1000000027;
            }
            return DataBaseFactory.TemplateHandlers.AddTemplate(item);
        }
Exemple #10
0
 /// <summary>
 /// ���ģ��
 /// </summary>
 /// <param name="item"></param>
 /// <param name="admin"></param>
 /// <returns></returns>
 public int AddTemplateForXml(Template item, Admin admin)
 {
     SqlParameter sp0 = new SqlParameter("@vcAdminName", SqlDbType.VarChar, 50); sp0.Value = admin.vcAdminName;
     SqlParameter sp1 = new SqlParameter("@vcip", SqlDbType.VarChar, 15); sp1.Value = objectHandlers.UserIp;
     SqlParameter sp2 = new SqlParameter("@SkinId", SqlDbType.VarChar, 36); sp2.Value = item.SkinInfo;
     SqlParameter sp3 = new SqlParameter("@TemplateType", SqlDbType.Int, 4); sp3.Value = (int)item.TemplateType;
     SqlParameter sp4 = new SqlParameter("@vcTempName", SqlDbType.VarChar, 50); sp4.Value = item.vcTempName;
     SqlParameter sp5 = new SqlParameter("@vcContent", SqlDbType.Text, 0); sp5.Value = item.Content;
     SqlParameter sp6 = new SqlParameter("@vcUrl", SqlDbType.VarChar, 255); sp6.Value = item.vcUrl;
     SqlParameter sp7 = new SqlParameter("@iParentId", SqlDbType.VarChar, 36); sp7.Value = item.iParentId;
     SqlParameter sp8 = new SqlParameter("@iSystemType", SqlDbType.Int, 4); sp8.Value = item.iSystemType;
     SqlParameter sp9 = new SqlParameter("@Id", SqlDbType.VarChar, 36); sp9.Value = item.Id;
     SqlParameter sp10 = new SqlParameter("@reValue", SqlDbType.Int); sp10.Direction = ParameterDirection.Output;
     string[] reValues = conn.Execute("SP_Template_ManageTemplate", new SqlParameter[] { sp0, sp1, sp2, sp3,
         sp4, sp5, sp6, sp7 , sp8 , sp9,sp10}, new int[] { 10 });
     if (reValues != null)
     {
         int rtn = (int)Convert.ChangeType(reValues[0], typeof(int));
         return rtn;
     }
     return -19000000;
 }
Exemple #11
0
        /// <summary>
        /// ���ģ��
        /// </summary>
        /// <param name="item"></param>
        /// <param name="admin"></param>
        /// <returns></returns>
        public int AddTemplate(Template item,Admin admin)
        {
            item.Id = Guid.NewGuid().ToString();

            return this.AddTemplateForXml(item, admin);
        }
        /// <summary>
        /// 删除资讯分类
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="classid"></param>
        /// <param name="adminname"></param>
        /// <returns></returns>
        public int DelCategories(string classid, Admin admininfo)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admininfo);
            if (rtn < 0) return rtn;

            //资讯分类编号为空
            if (string.IsNullOrEmpty(classid))
            {
                return -1000000031;
            }

            return DataBaseFactory.CategoriesHandlers.DelCategories(classid);
        }
        /// <summary>
        /// 创建皮肤模板文件 
        /// </summary>
        /// <param name="skinid"></param>
        /// <param name="admin"></param>
        /// <returns></returns>
        public int CreateCategoriesToXML(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;
            }

            //得到所有模板
            StringBuilder sbcategories = new StringBuilder();
            sbcategories.Append("<?xml version=\"1.0\"?>\r\n");
            sbcategories.Append("<Categories>\r\n");
            Dictionary<string, EntityBase> categories = HandlersFactory.categoriesHandlers.GetAllCategoriesEntity();
            if (categories != null && categories.Count > 0)
            {
                foreach (KeyValuePair<string, EntityBase> entity in categories)
                {
                    Categories temp = (Categories)entity.Value;
                    if (temp.ResourceTemplate != null)
                    {
                        if (temp.SkinInfo.Id == skinid)
                        {
                            sbcategories.Append("<Categorie>\r\n");
                            sbcategories.Append("\t<Id>" + temp.Id + "</Id>\r\n");
                            sbcategories.Append("\t<Parent>" + temp.Parent + "</Parent>\r\n");
                            sbcategories.Append("\t<ResourceTemplate>" + temp.ResourceTemplate.Id + "</ResourceTemplate>\r\n");
                            sbcategories.Append("\t<ResourceListTemplate>" + temp.ResourceListTemplate.Id + "</ResourceListTemplate>\r\n");
                            sbcategories.Append("\t<iOrder>" + temp.iOrder.ToString() + "</iOrder>\r\n");
                            sbcategories.Append("\t<dUpdateDate>" + temp.dUpdateDate.ToString() + "</dUpdateDate>\r\n");
                            sbcategories.Append("\t<dUpdateDate>" + temp.dUpdateDate + "</dUpdateDate>\r\n");
                            sbcategories.Append("\t<vcClassName>" + temp.vcClassName + "</vcClassName>\r\n");
                            sbcategories.Append("\t<vcName>" + temp.vcName + "</vcName>\r\n");
                            sbcategories.Append("\t<vcDirectory>" + temp.vcDirectory + "</vcDirectory>\r\n");
                            sbcategories.Append("\t<vcUrl>" + temp.vcUrl + "</vcUrl>\r\n");
                            sbcategories.Append("\t<cVisible>" + temp.cVisible + "</cVisible>\r\n");
                            sbcategories.Append("\t<DataBaseService>" + temp.DataBaseService + "</DataBaseService>\r\n");
                            sbcategories.Append("\t<SkinId>" + temp.SkinInfo.Id + "</SkinId>\r\n");
                            sbcategories.Append("</Categorie>\r\n");
                        }
                    }
                }
            }
            sbcategories.Append("</Categories>");
            objectHandlers.SaveFile(HttpContext.Current.Server.MapPath("~/skin/" + skininfo.Filename + "/categories.config"), sbcategories.ToString());
            return 1;
        }
Exemple #14
0
 public void Logout(Admin admin)
 {
     string errText = string.Empty;
     string sql = "UPDATE [admin] SET cIsOnline='N' WHERE vcAdminName='" + admin.vcAdminName + "'";
     MsSqlFactory.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="nif"></param>
 /// <returns></returns>
 public int NewsSpecialityMdy(Admin adminname, Speciality nif)
 {
     int rtn = HandlersFactory.adminHandlers.CheckAdminPower(adminname);
     if (rtn < 0) return rtn;
     return DataBaseFactory.specialityHandlers.NewsSpecialityMdy(nif);
 }
        public int ResourcePropertiesManage(Admin admin, ResourceProperties cp)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admin);
            if (rtn < 0) return rtn;

            return DataBaseFactory.ResourceHandlers.ResourcePropertiesManage(cp);
        }
Exemple #18
0
        /// <summary>
        /// 从XML中更新模板
        /// </summary>
        /// <param name="skinid"></param>
        /// <param name="admin"></param>
        /// <returns></returns>
        public int UpdateTemplateFromXML(string skinid, Admin admin)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admin);
            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 + "/template.config"));
            XmlNodeList nodelist = document.GetElementsByTagName("Template");
            if (nodelist != null && nodelist.Count > 0)
            {
                foreach (XmlElement element in nodelist)
                {
                    Template template = new Template();
                    template.Id = element.SelectSingleNode("Id").InnerText.ToString();
                    template.Content = element.SelectSingleNode("Content").InnerText.ToString();
                    template.Content = Regex.Replace(template.Content, "<![CDATA[(.+?)]]>", "$1", RegexOptions.Multiline);

                    template.SkinInfo = HandlersFactory.skinHandlers.GetSkinEntityBySkinId(element.SelectSingleNode("SkinId").InnerText.ToString());
                    template.TemplateType = this.GetTemplateType(objectHandlers.ToInt(element.SelectSingleNode("TemplateType").InnerText.ToString()));
                    template.iParentId = element.SelectSingleNode("iParentId").InnerText.ToString();
                    template.iSystemType = objectHandlers.ToInt(element.SelectSingleNode("iSystemType").InnerText.ToString());
                    template.dUpdateDate = objectHandlers.ToTime(element.SelectSingleNode("dUpdateDate").InnerText.ToString());
                    template.dAddDate = objectHandlers.ToTime(element.SelectSingleNode("dAddDate").InnerText.ToString());
                    template.vcTempName = element.SelectSingleNode("vcTempName").InnerText.ToString();
                    template.vcUrl = element.SelectSingleNode("vcUrl").InnerText.ToString();

                    Template t_template = this.GetTemplateByID(template.Id);
                    if (t_template == null)
                    {
                        this.AddTemplateForXml(template, admin);
                    }
                    else
                    {
                        this.MdyTemplate(template, admin);
                    }
                }

                CachingService.Remove(CachingService.CACHING_All_TEMPLATES);
                CachingService.Remove(CachingService.CACHING_All_TEMPLATES_ENTITY);
            }
            return 1;
        }
Exemple #19
0
 /// <summary>
 /// �ӹ���Ա��¼���еõ�����Աʵ��
 /// </summary>
 /// <param name="Row"></param>
 /// <returns></returns>
 public Admin GetAdminEntityFromDataRow(DataRow Row)
 {
     if (Row == null) return null;
     Admin admininfo = new Admin();
     admininfo.vcAdminName = Row["vcAdminName"].ToString();
     admininfo.vcNickName = Row["vcNickName"].ToString();
     admininfo.vcPassword = Row["vcPassword"].ToString();
     admininfo.iRole = this.GetAdminRoleInfoByRoleId((int)Row["iRole"]);
     admininfo.vcPopedom = this.GetAdminPopedomsByID(admininfo.iRole, Row["vcPopedom"].ToString());
     admininfo.PopedomStr = Row["vcPopedom"].ToString();
     admininfo.cLock = Row["clock"].ToString();
     admininfo.vcClassPopedom = Row["vcClassPopedom"].ToString();
     admininfo.cIsDel = Row["cIsDel"].ToString();
     return admininfo;
 }
Exemple #20
0
        /// <summary>
        /// 删除模板
        /// </summary>
        /// <param name="temps"></param>
        /// <param name="admin"></param>
        /// <returns></returns>
        public int DelTemplate(string temps, Admin admin)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(admin);
            if (rtn < 0) return rtn;

            //尚未选择需要删除的资讯模版
            if (string.IsNullOrEmpty(temps))
            {
                return -1000000028;
            }

            return DataBaseFactory.TemplateHandlers.DelTemplate(temps);
        }
Exemple #21
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;
        }
        /// <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);
        }
 /// <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);
 }
Exemple #24
0
 /// <summary>
 /// ɾ��ģ��
 /// </summary>
 /// <param name="temps"></param>
 /// <param name="admin"></param>
 /// <returns></returns>
 public int DelTemplate(string temps,Admin admin)
 {
     SqlParameter sp0 = new SqlParameter("@vcAdminName", SqlDbType.VarChar, 50); sp0.Value = admin.vcAdminName;
     SqlParameter sp1 = new SqlParameter("@vcip", SqlDbType.VarChar, 15); sp1.Value = objectHandlers.UserIp;
     SqlParameter sp2 = new SqlParameter("@vctemps", SqlDbType.VarChar, 1000); sp2.Value = temps;
     SqlParameter sp3 = new SqlParameter("@reValue", SqlDbType.Int); sp3.Direction = ParameterDirection.Output;
     string[] reValues = conn.Execute("SP_Template_DelTemplate", new SqlParameter[] { sp0, sp1, sp2, sp3 }, new int[] { 3 });
     if (reValues != null)
     {
         int rtn = (int)Convert.ChangeType(reValues[0], typeof(int));
         return rtn;
     }
     return -19000000;
 }
Exemple #25
0
        /// <summary>
        /// 更改自己的登陆信息
        /// </summary>
        /// <param name="adminname"></param>
        /// <param name="oldpwd"></param>
        /// <param name="npwd"></param>
        /// <param name="nickname"></param>
        /// <returns></returns>
        public int ChanageAdminLoginInfo(Admin admininfo, string oldpwd, string npwd, string nickname)
        {
            string sql = string.Empty;
            if (string.IsNullOrEmpty(npwd))
            {
                admininfo.vcNickName = nickname;
               sql = "UPDATE admin SET vcNickName = '" + nickname + "' WHERE vcAdminName='" + admininfo.vcAdminName + "'";
            }
            else
            {
                admininfo.vcNickName = nickname;
                admininfo.vcPassword = npwd;
                sql = "UPDATE admin SET vcNickName = '" + nickname + "',vcPassword = '******' WHERE vcAdminName='" + admininfo.vcAdminName + "'";
            }

            string errText = string.Empty;
            return MsSqlFactory.conn.m_RunSQL(ref errText, sql);
        }
Exemple #26
0
        public int UploadFile(byte[] _bytes, Admin adminname, string imagetype, int fileclassid, ref string imagepath)
        {
            if (!IsAllowImgExtension(imagetype))
            {
                return -1000000401;
            }

            MemoryStream ms = new MemoryStream(_bytes);

            Image image = Image.FromStream(ms);

            FileResources imgfile = new FileResources();

            imgfile.Id = this.GetFlieName();
            imgfile.iClassId = fileclassid;

            imgfile.vcFileName = imgfile.Id + imagetype;
            imgfile.vcType = imagetype;

            imgfile.iSize = 100;

            string filepatch = this.GetFilePath(imgfile.vcFileName, fileclassid, ref imagepath);
            FileStream fs = null;
            try
            {
                objectHandlers.SaveFile(filepatch, "");
                fs = new FileStream(filepatch, FileMode.Create);
                ms.WriteTo(fs);

                //int rtn = 0;
                //if (adminname != null)
                //{
                //    rtn = this.AddFileInfoByAdmin(adminname, imgfile);
                //}

                //if (rtn < 0)
                //{
                //    System.IO.File.Delete(filepatch);
                //}
                //else
                //{
                //    imagepath = "/attach.aspx?id=" + imgfile.Id;
                //}

                return 1;
            }
            catch (Exception ex)
            {
                return -1000000402;
            }
            finally
            {
                ms.Close();
                if (fs != null)
                {
                    fs.Close();
                }
                image.Dispose();
            }
        }
        /// <summary>
        /// 救回或删除资源
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public int SaveOrDelResource(string ids, string action, Admin adminname)
        {
            int rtn = HandlersFactory.adminHandlers.CheckAdminPower(adminname);
            if (rtn < 0) return rtn;

            //尚未选择资源
            if (string.IsNullOrEmpty(ids))
            {
                return -1000000501;
            }

            return DataBaseFactory.ResourceHandlers.SaveOrDelResource(ids,action);
        }
        private void AdminInit()
        {
            if (this._admin != null) return;
            object TempAdmin = null;
            if (string.IsNullOrEmpty(this._name))
            {
                TempAdmin = SessionState.Get(ConfigServiceEx.baseConfig["AdminSessionName"]);
                if (TempAdmin != null) SessionState.Remove(ConfigServiceEx.baseConfig["AdminSessionName"]);
                this._admin = null;
                return;
            }
            TempAdmin = SessionState.Get(ConfigServiceEx.baseConfig["AdminSessionName"]);
            if (TempAdmin == null)
            {
                this._admin = this._adminh.GetAdminEntityByAdminName(this._name);

                if (this._admin != null && this._admin.cIsOnline == "Y" && this._admin.vcLastLoginIp == objectHandlers.UserIp && this._admin.cIsDel != "Y")
                {
                    SessionState.Set(ConfigServiceEx.baseConfig["AdminSessionName"], this._admin);
                }
                else
                {
                    SessionState.Remove(ConfigServiceEx.baseConfig["AdminSessionName"]);
                }
            }
        }
 /// <summary>
 /// 删除特性
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="adminname"></param>
 /// <param name="ids"></param>
 /// <returns></returns>
 public int NewSpecialityDel(Admin adminname, string ids)
 {
     int rtn = HandlersFactory.adminHandlers.CheckAdminPower(adminname);
     if (rtn < 0) return rtn;
     return DataBaseFactory.specialityHandlers.NewSpecialityDel(ids);
 }
Exemple #30
0
        /// <summary>
        /// 管理员登陆函数
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public int AdminLogin(Admin admininfo, string pwd)
        {
            string sql = "UPDATE admin SET cIsOnline = 'Y',vcLastLoginIp = '" + objectHandlers.GetIP()
                + "',iLoginCount = iLoginCount+1,dLastLoginDate=getdate() WHERE vcAdminName ='" + admininfo.vcAdminName + "'";

            string errText = string.Empty;
            return MsSqlFactory.conn.m_RunSQL(ref errText, sql);
        }