Exemple #1
0
 protected void DrawTreeMenu(Channel currentChannel, string prefix, List<string> chids, ref List<Channel> allChannel)
 {
     if (We7Helper.IsEmptyID(AccountID) || chids.Contains(currentChannel.ID))
     {
         currentChannel.FullPath = prefix + "<img src=\"/admin/images/filetype/folder.gif\" />&nbsp;" + currentChannel.Name;
         if(!MyChannelList.Contains(currentChannel))
             MyChannelList.Add(currentChannel);
     }
     GetSubChannels(currentChannel.ID, prefix + "&nbsp;©À©¤&nbsp;", allChannel);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         InitControls();
         if (We7Helper.IsEmptyID(ChannelID))
         {
             throw new CDException(TextCannotModifyColumn);
         }
         LoadFromMap();
     }
 }
Exemple #3
0
 /// <summary>
 /// 修改信息
 /// </summary>
 /// <param name="cat"></param>
 public void EditCategory(Category cat)
 {
     if (cat == null)
     {
         throw new Exception("修改内容为空");
     }
     if (We7Helper.IsEmptyID(cat.ID))
     {
         throw new Exception("修改记录ID为为空");
     }
     Assistant.Update(cat);
     CacheRecord.Release();
 }
Exemple #4
0
 /// <summary>
 /// 添加类别
 /// </summary>
 /// <param name="cat"></param>
 public void AddCategory(Category cat)
 {
     if (cat == null)
     {
         throw new Exception("添加类别不能为空");
     }
     if (We7Helper.IsEmptyID(cat.ID))
     {
         cat.ID         = We7Helper.CreateNewID();
         cat.CreateDate = DateTime.Now;
     }
     Assistant.Insert(cat);
     CacheRecord.Release();
 }
Exemple #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!We7Helper.IsEmptyID(AccountID))
         {
             LoginNameTextBox.Text = AccountHelper.GetAccount(AccountID, new string[] { "LoginName" }).LoginName;
         }
         else
         {
             LoginNameTextBox.Text = SiteConfigs.GetConfig().AdministratorName;
         }
     }
 }
Exemple #6
0
 protected void SaveWapButton_Click(object sender, EventArgs e)
 {
     if (!We7Helper.IsEmptyID(WapOidTextBox.Text.Trim()))
     {
         Article wap = ArticleHelper.GetArticleBySource(WapOidTextBox.Text.Trim(), ArticleID);
         if (wap == null)
         {
             wap = AddWapArticle();
         }
         EditWapHyperLink.NavigateUrl = string.Format("/addins/ArticleEdit.aspx?wap=1&id={0}", wap.ID);
         EditWapHyperLink.Target      = "_blank";
         EditWapHyperLink.Visible     = true;
         PublishToWap.Visible         = false;
     }
 }
Exemple #7
0
        void LoadArticle()
        {
            Attachments = new List <Attachment>();

            if (!We7Helper.IsEmptyID(ArticleID))
            {
                Article a = ArticleHelper.GetArticle(ArticleID);
                if (a != null)
                {
                    TitleLabel.Text   = a.Title;
                    ContentLabel.Text = a.Content;
                    Attachments       = AttachmentHelper.GetAttachments(a.ID);
                }
            }
        }
Exemple #8
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string id          = IDLabel.Text;
            string name        = NameTextBox.Value;
            string description = DescriptionTextBox.Value;
            string roletype    = "";

            if (TypeDropDownList1.Visible == true)
            {
                roletype = TypeDropDownList1.SelectedValue;
            }
            else
            {
                roletype = TypeDropDownList2.SelectedValue;
            }
            if (We7Helper.IsEmptyID(id))
            {
                if (AccountHelper.GetRoleBytitle(name) != null)
                {
                    Messages.ShowError(name + " 的角色已经存在。");
                }
                else
                {
                    string idNew = Guid.NewGuid().ToString();
                    Role   r     = new Role(idNew, name, description, roletype);
                    AccountHelper.AddRole(r);
                    ShowRole(r);

                    //记录日志
                    string content = string.Format("新建角色“{0}”", name);
                    AddLog("新建角色", content);

                    string rawurl = We7Helper.AddParamToUrl(Request.RawUrl, "saved", "1");
                    rawurl = We7Helper.AddParamToUrl(rawurl, "id", r.ID);
                    Response.Redirect(rawurl);
                }
            }
            else
            {
                Role r = new Role(id, name, description, roletype);
                AccountHelper.UpdateRole(r);
                ShowMessage("角色信息已经更新。");

                //记录日志
                string content = string.Format("修改了角色“{0}”的信息", name);
                AddLog("编辑角色", content);
            }
        }
Exemple #9
0
        string DepartMappath(string departID)
        {
            if (We7Helper.IsEmptyID(departID))
            {
                return("");
            }
            else
            {
                string     navString = "<a href='Departments.aspx?id={0}'>部门 <b>{1}</b></a>";
                Department dpt       = AccountHelper.GetDepartment(departID,
                                                                   new string[] { "Name", "Description", "ParentID" });

                navString = string.Format(navString, dpt.ID, dpt.Name);
                return(DepartMappath(dpt.ParentID) + " > " + navString);
            }
        }
Exemple #10
0
        string LoadMyTags()
        {
            string tagLi = "<LI><IMG class=Icon height=16 src=\"/admin/images/icon_globe.gif\" width=16 alt=\"{0}\">{1}<A class=Del title=\"{0}\"  href=\"javascript:void(0)\"  > [x]</A> </LI>";

            StringBuilder sb = new StringBuilder();

            if (!We7Helper.IsEmptyID(ChannelID))
            {
                List <string> tagsList = ChannelHelper.GetTags(ChannelID);
                foreach (string str in tagsList)
                {
                    sb.AppendLine(string.Format(tagLi, str, str.Length > 10 ? We7.Framework.Util.Utils.CutString(str, 0, 10) + ".." : str));
                }
            }

            return(sb.ToString());
        }
        /// <summary>
        ///  操作按钮状态初始化
        /// </summary>
        private void InitializeButtons()
        {
            bool canAccept = false; //反馈受理
            bool canAdmin  = false; //反馈管理
            bool canHandle = false; //反馈办理
            bool canRead   = false; //查看
            bool canCheck  = false; //审核

            //模型不为空,并且是用户登陆时验证是否具有权限
            if (AdviceTypeID != null && !We7Helper.IsEmptyID(AccountID))
            {
                List <string> contents = AccountHelper.GetPermissionContents(AccountID, AdviceTypeID);
                canAccept = contents.Contains("Advice.Accept");
                canAdmin  = contents.Contains("Advice.Admin");
                canHandle = contents.Contains("Advice.Handle");
                canRead   = contents.Contains("Advice.Read");

                //canAccept = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Accept");
                //canAdmin = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Admin");
                //canHandle = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Handle");
                //canRead = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Read");

                AdviceType adviceType = AdviceTypeHelper.GetAdviceType(AdviceTypeID);
                string     stateText  = adviceType.StateText;
                if (adviceType.FlowSeries > 0)
                {
                    canCheck = true;
                }
                if (adviceType.ParticipateMode == (int)AdviceParticipateMode.Mail)
                {
                    ReceiveHyperLink.Visible = false;
                }
            }
            else
            {
                canAccept = canAdmin = canCheck = canHandle = true;
            }

            DeleteHyperLink.Visible           = canAdmin;              //删除
            HastenHyperLink.Visible           = canAdmin;              //催办
            MustHandleHyperLink.Visible       = canAccept || canAdmin; //必须办理
            ReceiveHyperLink.Visible          = canAdmin;              //接收反馈回复邮件
            DisplayHyperLink.Visible          = canAdmin;              //前台显示
            UndisplayHyperLink.Visible        = canAdmin;              //前台不显示
            UnControlDisplayHyperLink.Visible = canAdmin;              //前台不控制
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InitControls();
            if (!IsPostBack)
            {
                if (We7Helper.IsEmptyID(ChannelID))
                {
                    throw new CDException(TextCannotModifyColumn);
                }
                if (Request["saved"] != null && Request["saved"].ToString() == "1")
                {
                    Messages.ShowMessage("栏目选项已经成功更新。");
                }

                ShowInfomation();
            }
        }
Exemple #13
0
        string GetAccountLoginName(string accountID)
        {
            string name;

            if (We7Helper.IsEmptyID(accountID))
            {
                name = "Administration";
            }
            else
            {
                name = AccountHelper.GetAccount(accountID, new string[] { "LoginName" }).LoginName;
            }
            if (name == null || name == "")
            {
                name = "user";
            }
            return(name);
        }
Exemple #14
0
        string FormatUrl()
        {
            string attachmentPath = "";

            if (!We7Helper.IsEmptyID(AttachmentID))
            {
                ThisAttachment = AttachmentHelper.GetAttachment(AttachmentID);
            }
            else if (!We7Helper.IsEmptyID(OwnerID) && FileType != "")
            {
                ThisAttachment = AttachmentHelper.GetFirstAttachment(OwnerID, FileType, FilesName);
            }
            if (ThisAttachment != null)
            {
                attachmentPath = string.Format("\\{0}\\{1}", ThisAttachment.FilePath, ThisAttachment.FileName);
            }
            return(attachmentPath);
        }
Exemple #15
0
        string GetAccountName(string accountID)
        {
            string name;

            if (We7Helper.IsEmptyID(accountID))
            {
                name = "管理员";
            }
            else
            {
                name = AccountHelper.GetAccount(accountID, new string[] { "LastName" }).LastName;
            }
            if (name == null || name == "")
            {
                name = "未知用户";
            }
            return(name);
        }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id       = ChannelID;
            string parentId = ParentlID;

            if (We7Helper.IsEmptyID(id))
            {
                id = We7Helper.EmptyGUID;
            }
            if (We7Helper.IsEmptyID(parentId))
            {
                parentId = We7Helper.EmptyGUID;
            }

            string ret = SaveChannel(id, parentId, ChannelIndex);

            Response.Write(ret);
            Response.End();
        }
Exemple #17
0
        protected override void Initialize()
        {
            string root;

            if (We7Helper.IsEmptyID(ColumnID))
            {
                GoParentHyperLink.NavigateUrl = "iChannels.aspx";
                root       = "";
                CurrentUrl = "/";
            }
            else
            {
                Channel ch = ChannelHelper.GetChannel(ColumnID, new string[] { "ID", "Name", "Description", "ParentID", "FullPath", "FullUrl" });
                CurrentPath = ch.Description;
                GoParentHyperLink.NavigateUrl = String.Format("iChannels.aspx?id={0}&oid={1}&type=quote", ch.ParentID, QuoteOwnerID);
                root       = ch.FullPath;
                CurrentUrl = ch.FullUrl;
            }

            CurrentPath = "根栏目" + root.Replace("/", " / ");

            List <Channel> data = ChannelHelper.GetChannels(ColumnID);

            if (data == null || data.Count == 0)
            {
                //ShowMessage("没有数据。");
            }
            else
            {
                //ShowMessage(String.Format("总共有 {0}个栏目。", data.Count));
                foreach (Channel ch in data)
                {
                    ch.TemplateText = TemplateHelper.GetTemplateName(ch.TemplateName);
                    ch.FullPath     = String.Concat(root, "/", ch.Name);
                }
            }

            DetailGridView.DataSource = data;
            DetailGridView.DataBind();
        }
Exemple #18
0
        /// <summary>
        /// 获取父文章路径
        /// </summary>
        /// <returns></returns>
        List <Article> GetParentArticlePath()
        {
            List <Article> list = new List <Article>();

            if (!string.IsNullOrEmpty(ArticleID))
            {
                Article a = ArticleHelper.GetArticle(ArticleID, null);
                while (a != null)
                {
                    list.Insert(0, a);
                    if (!We7Helper.IsEmptyID(a.ParentID))
                    {
                        a = ArticleHelper.GetArticle(a.ParentID, null);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(list);
        }
Exemple #19
0
        bool CanMove(Channel c, string newParentID)
        {
            string url = "";

            if (We7Helper.IsEmptyID(newParentID))
            {
                url = "/" + c.ChannelName + "/";
            }
            else
            {
                Channel pc = ChannelHelper.GetChannel(newParentID, null);
                if (pc != null)
                {
                    url = pc.FullUrl + c.ChannelName + "/";
                }
            }
            if (url != "")
            {
                string id = ChannelHelper.GetChannelIDByFullUrl(url);
                return(id == We7Helper.NotFoundID);
            }
            return(false);
        }
Exemple #20
0
        protected void Initialize()
        {
            ResetPasswordCheckBox.Checked = false;
            ResetPasswordSpan.Visible     = false;
            if (We7Helper.IsEmptyID(Security.CurrentAccountID))
            {
                UserTypeDropDownList.Items.Add(new ListItem("管理员", "0"));
            }
            UserTypeDropDownList.Items.Add(new ListItem("普通用户", "1"));

            if (We7Helper.IsEmptyID(CurrentAccountID))//新建
            {
                PassWordText.Visible = true;
                We7Helper.AssertNotNull(DepartmentID, "AccountDetail.p");
                if (!We7Helper.IsEmptyID(DepartmentID))
                {
                    Department dpt = AccountHelper.GetDepartment(DepartmentID, new string[] { "FullName" });
                    FullPathLabel.Text = dpt.FullName;
                    ParentTextBox.Text = DepartmentID;
                }
                else
                {
                    ParentTextBox.Text = We7Helper.EmptyGUID;
                }
                MailMessageTemplate mt = new MailMessageTemplate("UserEmailConfig.xml", "新建用户通知");
                MailBodyTextBox.Text = mt.Body;
                SaveButton.Value     = "创建账户";
                DeleteButtun.Visible = false;
            }
            else
            {
                ShowAccount(AccountHelper.GetAccount(CurrentAccountID, null));
                ResetPasswordSpan.Visible = true;
                MailMessageTemplate mt = new MailMessageTemplate("UserEmailConfig.xml", "账号审核通过通知");
                MailBodyTextBox.Text = mt.Body;
            }
        }
 protected override void Initialize()
 {
     if (!string.IsNullOrEmpty(DepartmentID))
     {
         if (We7Helper.IsEmptyID(DepartmentID))
         {
             Messages.ShowError("不能修改。");
         }
         else
         {
             DepartmentNameLabel.Text = "修改部门信息";
             ShowDepartment(AccountHelper.GetDepartment(DepartmentID, null));
         }
     }
     else
     {
         if (ParentID != null)
         {
             ParentTextBox.Text          = ParentID;
             DepartmentNameLabel.Text    = "新建一个部门。";
             ReturnHyperLink.NavigateUrl = String.Format("Departments.aspx?id={0}", ParentID);
             if (We7Helper.IsEmptyID(ParentID))
             {
                 FullPathLabel.Text = "/";
             }
             else
             {
                 Department dpt = AccountHelper.GetDepartment(ParentID, new string[] { "FullName" });
                 FullPathLabel.Text = dpt.FullName;
             }
         }
         else
         {
             Messages.ShowError("缺少必要的参数信息。");
         }
     }
 }
Exemple #22
0
        Criteria CreateCriteriaByAll(ArticleQuery query)
        {
            string   parameters;
            string   modelname = ChannelHelper.GetModelName(query.ChannelID, out parameters);
            Criteria c         = new Criteria(CriteriaType.None);

            if (string.IsNullOrEmpty(modelname) && !string.IsNullOrEmpty(query.EnumState))
            {
                Criteria csubC = new Criteria();
                csubC.Name  = "EnumState";
                csubC.Value = query.EnumState;
                if (query.ExcludeThisChannel)
                {
                    csubC.Type = CriteriaType.NotEquals;
                }
                else
                {
                    csubC.Type = CriteriaType.Equals;
                }
                csubC.Adorn  = Adorns.SubString;
                csubC.Start  = EnumLibrary.Position[(int)EnumLibrary.Business.ArticleType];
                csubC.Length = EnumLibrary.PlaceLength;
                c.Criterias.Add(csubC);
            }
            if (string.IsNullOrEmpty(query.ModelName) || Constants.ArticleModelName.Equals(query.ModelName, StringComparison.OrdinalIgnoreCase))
            {
                AppendModelCondition(c);
            }
            if (query.State != ArticleStates.All)
            {
                c.Add(CriteriaType.Equals, "State", (int)query.State);
            }
            if (query.ArticleType > 0)
            {
                c.Add(CriteriaType.Equals, "ContentType", query.ArticleType);
            }
            else
            {
                c.Add(CriteriaType.NotEquals, "ContentType", 16);
            }

            if (!string.IsNullOrEmpty(query.KeyWord))
            {
                Criteria keyCriteria = new Criteria(CriteriaType.None);
                keyCriteria.Mode = CriteriaMode.Or;
                keyCriteria.AddOr(CriteriaType.Like, "Title", "%" + query.KeyWord + "%");
                keyCriteria.AddOr(CriteriaType.Like, "Description", "%" + query.KeyWord + "%");
                c.Criterias.Add(keyCriteria);
            }

            if (!string.IsNullOrEmpty(query.Author))
            {
                c.Add(CriteriaType.Like, "Author", "%" + query.Author + "%");
            }
            if (query.BeginDate <= query.EndDate)
            {
                if (query.BeginDate != DateTime.MinValue)
                {
                    c.Add(CriteriaType.MoreThanEquals, "Updated", query.BeginDate);
                }
                if (query.EndDate != DateTime.MinValue && query.EndDate != DateTime.MaxValue)
                {
                    c.Add(CriteriaType.LessThanEquals, "Updated", query.EndDate.AddDays(1));
                }
            }
            else
            {
                if (query.EndDate != DateTime.MinValue)
                {
                    c.Add(CriteriaType.MoreThanEquals, "Updated", query.EndDate);
                }
                if (query.BeginDate != DateTime.MaxValue)
                {
                    c.Add(CriteriaType.LessThanEquals, "Updated", query.BeginDate.AddDays(1));
                }
            }

            if (!We7Helper.IsEmptyID(query.ChannelID))
            {
                if (CheckModel(modelname))
                {
                    c.Add(CriteriaType.Equals, "ModelName", modelname);
                    if (!string.IsNullOrEmpty(parameters))
                    {
                        CriteriaExpressionHelper.Execute(c, parameters);
                    }
                }
                else
                {
                    if (query.ExcludeThisChannel)
                    {
                        if (query.IncludeAllSons)
                        {
                            c.Add(CriteriaType.NotLike, "ChannelFullUrl", query.ChannelFullUrl + "%");
                        }
                        else
                        {
                            c.Add(CriteriaType.NotEquals, "OwnerID", query.ChannelID);
                        }
                    }
                    else
                    {
                        if (query.IncludeAllSons)
                        {
                            c.Add(CriteriaType.Like, "ChannelFullUrl", query.ChannelFullUrl + "%");
                        }
                        else
                        {
                            if (query.ChannelID.Contains(","))
                            {
                                string[] oids = query.ChannelID.Split(',');
                                Criteria subC = new Criteria(CriteriaType.None);
                                subC.Mode = CriteriaMode.Or;
                                foreach (string oid in oids)
                                {
                                    subC.Add(CriteriaType.Equals, "OwnerID", oid);
                                }
                                c.Criterias.Add(subC);
                            }
                            else
                            {
                                c.Add(CriteriaType.Equals, "OwnerID", query.ChannelID);
                            }
                        }
                    }
                }
            }

            if (!We7Helper.IsEmptyID(query.AccountID))
            {
                Channel channel = ChannelHelper.GetChannel(query.ChannelID, null);
                if (query.IncludeAdministrable)
                {
                    List <string> channels = AccountHelper.GetObjectsByPermission(query.AccountID, "Channel.Article");

                    Criteria keyCriteria = new Criteria(CriteriaType.None);
                    if (channels != null && channels.Count > 0)
                    {
                        keyCriteria.Mode = CriteriaMode.Or;
                        foreach (string ownerID in channels)
                        {
                            keyCriteria.AddOr(CriteriaType.Equals, "OwnerID", ownerID);
                        }
                    }
                    keyCriteria.AddOr(CriteriaType.Equals, "AccountID", query.AccountID);
                    if (keyCriteria.Criterias.Count > 0)
                    {
                        c.Criterias.Add(keyCriteria);
                    }
                }
                else
                {
                    c.Add(CriteriaType.Equals, "AccountID", query.AccountID);
                }
            }
            if (query.IsShowHome != null && query.IsShowHome == "1")
            {
                c.Add(CriteriaType.Equals, "IsShow", 1);
            }
            if (!string.IsNullOrEmpty(query.Tag))
            {
                c.Add(CriteriaType.Like, "Tags", "%" + query.Tag + "%");
            }
            if (query.IsImage != null && query.IsImage == "1")
            {
                c.Add(CriteriaType.Equals, "IsImage", 1);
            }
            if (query.Overdue)
            {
                Criteria subC = new Criteria(CriteriaType.None);
                subC.Mode = CriteriaMode.Or;
                Criteria subChildC1 = new Criteria(CriteriaType.MoreThanEquals, "Overdue", DateTime.Now);
                subC.Criterias.Add(subChildC1);
                Criteria subChildC2 = new Criteria(CriteriaType.Equals, "Overdue", DateTime.MinValue);
                subC.Criterias.Add(subChildC2);
                Criteria subChildC3 = new Criteria(CriteriaType.LessThanEquals, "Overdue", DateTime.Today.AddYears(-30));
                subC.Criterias.Add(subChildC3);
                c.Criterias.Add(subC);
            }
            if (!string.IsNullOrEmpty(query.ArticleParentID))
            {
                c.Add(CriteriaType.Equals, "ParentID", query.ArticleParentID);
            }
            //if (!string.IsNullOrEmpty(query.SearcherKey))

            if (!string.IsNullOrEmpty(query.ArticleID))
            {
                c.Add(CriteriaType.Like, "ListKeys", "%" + query.ArticleID + "%");
            }
            return(c);
        }
Exemple #23
0
        /// <summary>
        ///  操作按钮状态初始化
        /// </summary>
        private void InitializeButtons()
        {
            bool canAccept = false; //反馈受理
            bool canAdmin  = false; //反馈管理
            bool canHandle = false; //反馈办理
            bool canRead   = false; //查看
            bool canCheck  = false; //审核

            AdviceType adviceType = AdviceTypeHelper.GetAdviceType(AdviceTypeID);

            //模型不为空,并且是用户登陆时验证是否具有权限
            if (AdviceTypeID != null && !We7Helper.IsEmptyID(AccountID))
            {
                List <string> contents = AccountHelper.GetPermissionContents(AccountID, AdviceTypeID);
                canAccept = contents.Contains("Advice.Accept");
                canAdmin  = contents.Contains("Advice.Admin");
                canHandle = contents.Contains("Advice.Handle");
                canRead   = contents.Contains("Advice.Read");

                //canAccept = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Accept");
                //canAdmin = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Admin");
                //canHandle = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Handle");
                //canRead = AccountHelper.HavePermission(AccountID, AdviceTypeID, "Advice.Read");
                if (adviceType.FlowSeries > 0)
                {
                    canCheck = true;
                }
            }
            else
            {
                canAccept = canAdmin = canCheck = canHandle = true;
            }

            canCheck  = canCheck && (ThisAdvice.State == (int)AdviceState.Checking);
            canHandle = canHandle && (ThisAdvice.State == (int)AdviceState.WaitHandle || ThisAdvice.State == (int)AdviceState.WaitAccept && adviceType.StateText == "直接办理");
            canAccept = canAccept && (ThisAdvice.State == (int)AdviceState.WaitAccept);

            TransactHyperLink.Visible   = canHandle && (adviceType.StateText != "上报办理");                //办理
            ToOtherHyperLink.Visible    = (canHandle || canAccept) && (adviceType.StateText != "直接办理"); //转办 模型类别判断
            trToOtherHandleUser.Visible = ToOtherHyperLink.Visible;                                     //是否转办
            trHandleRemark.Visible      = ToOtherHyperLink.Visible;                                     //转办备注
            trPriority.Visible          = ToOtherHyperLink.Visible;                                     //邮件优先级

            AuditReportHyperLink.Visible = canHandle && (adviceType.StateText == "上报办理");               //上报审核
            ReportHyperLink.Visible      = canCheck;
            chbSendEmail.Visible         = canCheck;
            fontSendEmail.Visible        = canCheck;
            ReturnHyperLink.Visible      = (canHandle || canCheck) && (adviceType.StateText != "直接办理");//退回重办 办理类别
            ReplyContentTextBox.Visible  = canHandle || ThisAdvice.State == (int)AdviceState.Checking;
            AdminHandHyperLink.Visible   = (canHandle || canAccept) && (ThisAdvice.State != (int)AdviceState.Finished);

            switch (adviceType.StateText)
            {
            case "转交办理":

                if (canHandle)
                {
                    ToAdviceTextBox.Visible = true;
                    toAdviceLabel.Text      = "转交备注:";
                }
                break;

            case "上报办理":
                switch (ThisAdvice.State)
                {
                case (int)AdviceState.Checking:

                    toAdviceLabel.Text      = "审核意见:";
                    ToAdviceTextBox.Visible = true;
                    break;

                case (int)AdviceState.WaitHandle:
                    toAdviceLabel.Visible   = false;
                    ToAdviceTextBox.Visible = false;

                    break;

                case (int)AdviceState.WaitAccept:

                    toAdviceLabel.Visible   = false;
                    ToAdviceTextBox.Visible = false;
                    break;
                }

                break;

            case "直接办理":
                ToAdviceTextBox.Visible = false;
                break;

            default:
                break;
            }

            AdviceReply reply = AdviceReplyHelper.GetAdviceReplyByAdviceID(AdviceID);

            if (reply != null)
            {
                if (reply.Content != null && reply.Content != "")
                {
                    Account accountModel      = AccountHelper.GetAccount(ThisAdvice.ToOtherHandleUserID, new string[] { "LastName", "DepartmentID" });
                    string  departmentAndUser = "";
                    if (accountModel != null)
                    {
                        Department dp = AccountHelper.GetDepartment(accountModel.DepartmentID, new string[] { "Name" });
                        if (dp != null && !string.IsNullOrEmpty(dp.Name))
                        {
                            departmentAndUser = "******" + dp.Name + " - " + accountModel.LastName;
                        }
                        else
                        {
                            departmentAndUser = "******" + accountModel.LastName;
                        }
                    }

                    if (ReplyContentTextBox.Visible)
                    {
                        ReplyContentTextBox.Value = We7Helper.ConvertPageBreakFromCharToVisual(reply.Content);
                    }
                    else
                    {
                        replyDiv.InnerHtml = We7Helper.ConvertPageBreakFromCharToVisual(reply.Content) + departmentAndUser;
                    }
                }
            }
        }
        void SaveDepartment()
        {
            Department dpt = new Department();

            dpt.ID          = IDLabel.Text;
            dpt.Name        = NameTextBox.Text;
            dpt.Description = DescriptionTextBox.Text;
            dpt.Index       = Convert.ToInt32(IndexTextBox.Text);

            dpt.Number    = NumberTextBox.Text.Trim();
            dpt.Address   = AddressTextBox.Text;
            dpt.Fax       = FaxTextBox.Text;
            dpt.Email     = EmailTextBox.Text;
            dpt.Phone     = PhoneTextBox.Text;
            dpt.MapScript = MapScriptTextBox.Text;
            dpt.SiteUrl   = SiteUrlTextBox.Text;
            dpt.Text      = ContentTextBox.Value;

            if (dpt.ID != String.Empty)
            {
                if (We7Helper.IsEmptyID(dpt.ParentID))
                {
                    dpt.FullName = dpt.Name;
                }
                else
                {
                    Department dptParent = AccountHelper.GetDepartment(dpt.ParentID, null);
                    dpt.FullName = dptParent.FullName + "<" + dpt.Name;
                }

                List <string> fields = new List <string>();
                fields.Add("Name");
                fields.Add("Description");
                fields.Add("Index");
                fields.Add("FullName");
                fields.Add("Address");
                fields.Add("Fax");
                fields.Add("Email");
                fields.Add("Phone");
                fields.Add("MapScript");
                fields.Add("SiteUrl");
                fields.Add("Text");
                fields.Add("Number");

                AccountHelper.UpdateDepartment(dpt, fields.ToArray());
                Messages.ShowMessage("部门信息已经被更新。");

                //记录日志
                string content = string.Format("修改了部门“{0}”的信息", dpt.Name);
                AddLog("编辑部门", content);
            }
            else
            {
                dpt.ParentID = ParentTextBox.Text;
                if (We7Helper.IsEmptyID(dpt.ParentID))
                {
                    dpt.FullName = dpt.Name;
                }
                else
                {
                    Department dptParent = AccountHelper.GetDepartment(dpt.ParentID, null);
                    dpt.FullName = dptParent.FullName + "/" + dpt.Name;
                }

                dpt = AccountHelper.AddDepartment(dpt);
                ShowDepartment(dpt);
                Messages.ShowMessage("新的部门信息已经被保存。");
                //记录日志
                string content = string.Format("新建部门“{0}”", dpt.Name);
                AddLog("新建部门", content);
            }
        }
Exemple #25
0
        public override object Do(PanelContext data)
        {
            string oid = data.Objects["oid"] as string;

            if (We7Helper.IsEmptyID(oid))
            {
                throw new Exception("不能移动到根栏目");
            }

            ChannelHelper chHelper = HelperFactory.GetHelper <ChannelHelper>();
            Channel       channel  = chHelper.GetChannel(oid, null);

            if (channel == null)
            {
                throw new Exception("当前栏目不存在");
            }
            if (channel.ModelName != data.ModelName)
            {
                throw new Exception("移动到的栏目类型与当前栏目类型不一致");
            }

            if (!string.IsNullOrEmpty(oid))
            {
                List <DataKey> dataKeys = data.State as List <DataKey>;
                foreach (DataKey key in dataKeys)
                {
                    string  id = key["ID"] as string;
                    Article a  = ArticleHelper.GetArticle(id);
                    if (a != null)
                    {
                        DataSet ds = BaseDataProvider.CreateDataSet(data.Model);
                        BaseDataProvider.ReadXml(ds, a.ModelXml);
                        if (ds.Tables[data.Table.Name].Rows.Count > 0)
                        {
                            DataRow row = ds.Tables[data.Table.Name].Rows[0];
                            a.OwnerID = oid;
                            if (row.Table.Columns.Contains("OwnerID"))
                            {
                                row["OwnerID"] = oid;
                            }
                            Channel ch = ChannelHelper.GetChannel(oid, null);
                            if (ch != null)
                            {
                                a.ChannelFullUrl = ch.FullUrl;
                                if (row.Table.Columns.Contains("ChannelFullUrl"))
                                {
                                    row["ChannelFullUrl"] = a.ChannelFullUrl;
                                }
                                a.ChannelName = ch.FullPath;
                                if (row.Table.Columns.Contains("ChannelName"))
                                {
                                    row["ChannelName"] = a.ChannelName;
                                }
                                a.FullChannelPath = ch.FullFolderPath;
                                if (row.Table.Columns.Contains("FullChannelPath"))
                                {
                                    row["FullChannelPath"] = a.FullChannelPath;
                                }
                            }
                            a.ModelXml = BaseDataProvider.GetXml(ds);
                        }
                    }
                    if (DbHelper.CheckTableExits(data.Table.Name))
                    {
                        DbHelper.ExecuteSql(String.Format("UPDATE [{0}] SET [OwnerID]='{2}' WHERE [ID]='{1}'", data.Table.Name, id, oid));
                    }
                    ArticleHelper.UpdateArticle(a, new string[] { "ID", "OwnerID", "ChannelFullUrl", "ChannelName", "FullChannelPath", "ModelXml" });
                    // 往全文检索里更新数据
                    ArticleIndexHelper.InsertData(id, 1);
                }
            }
            UIHelper.SendMessage("移动成功");
            CacheRecord.Create(data.ModelName).Release();
            return(null);
        }
Exemple #26
0
        void FormatArticle(Article article)
        {
            if (IsImage)
            {
                article.TagThumbnail = article.GetTagThumbnail(ThumbnailTag);
            }
            if (!ChannelMap.ContainsKey(article.OwnerID))
            {
                Channel ch = ChannelHelper.GetChannel(article.OwnerID, null);
                ChannelMap.Add(article.OwnerID, ch);
            }

            if (!String.IsNullOrEmpty(ShowChannel))
            {
                Channel ch          = ChannelMap[article.OwnerID];
                string  channelName = ch.Name;
                if (ChannelHasLink)
                {
                    channelName = string.Format("<a href='{1}' target='{2}'>{0}</a>", ch.Name, article.ChannelFullUrl, LinkTarget);
                }

                article.FullChannelPath = string.Format(ShowChannel, channelName);
            }

            article.Icon = GetIcon(article.State);

            if (NoLink)
            {
                article.LinkUrl = "";
            }
            else
            {
                if (article.ContentType == (int)TypeOfArticle.LinkArticle)
                {
                    article.LinkUrl = article.ContentUrl;
                }
                else
                {
                    if (We7Helper.IsEmptyID(article.OwnerID))
                    {
                        string key = article.ModelName + "$modelchannelurl$const";
                        if (!ChannelMap.ContainsKey(key))
                        {
                            List <Channel> chs = ChannelHelper.GetChannelByModelName(article.ModelName);
                            article.LinkUrl = String.Format("{0}{1}", chs != null && chs.Count > 0?chs[0].FullUrl:"", article.FullUrl);
                        }
                    }
                    else
                    {
                        article.LinkUrl = String.Format("{0}{1}", article.ChannelFullUrl, article.FullUrl);
                    }
                }
            }

            if (DateFormat == null || DateFormat == "")
            {
                TimeSpan ts = DateTime.Now - article.Updated;
                article.TimeNote = GetTimeNote(ts);
            }
            else
            {
                article.TimeNote = article.Updated.ToString(DateFormat);
            }

            if (ShowField("ToolTip"))
            {
                article.FullTitle  = article.Title;
                article.FullTitle += "," + article.TimeNote;
                if (article.Clicks > 0)
                {
                    article.FullTitle += ",阅读量:" + article.Clicks;
                }
            }
            else
            {
                article.FullTitle = article.Title;
            }

            if (TitleMaxLength > 0 && article.Title.Length > TitleMaxLength)
            {
                article.Title = article.Title.Substring(0, TitleMaxLength) + "...";
            }

            if (!string.IsNullOrEmpty(KeyWord))
            {
                article.Title = article.Title.Replace(KeyWord, "<em>" + KeyWord + "</em>");
            }

            if (Show("Description"))
            {
                if (SummaryMaxLength > 0 && article.Description != null &&
                    article.Description.Length > SummaryMaxLength)
                {
                    article.Description = article.Description.Substring(0, SummaryMaxLength) + "...";
                }

                if (string.IsNullOrEmpty(article.Description) && !string.IsNullOrEmpty(article.Content))
                {
                    string content = We7Helper.RemoveHtml(article.Content);
                    if (content.Length > summaryMaxLength)
                    {
                        article.Description = content.Substring(0, SummaryMaxLength) + "...";
                    }
                    else
                    {
                        article.Description = content;
                    }
                }

                if (!string.IsNullOrEmpty(KeyWord) && !string.IsNullOrEmpty(article.Description))
                {
                    article.Description = article.Description.Replace(KeyWord, "<em>" + KeyWord + "</em>");
                }
            }
        }
Exemple #27
0
 protected override void Initialize()
 {
     SummaryLabel.Text = We7Helper.IsEmptyID(OwnerID) ? "¶¥¼¶Ä¿Â¼" : ChannelHelper.GetChannel(OwnerID, new string[] { "ID", "FullPath" }).FullPath;
 }
Exemple #28
0
        /// <summary>
        /// 加载评论列表
        /// </summary>
        void LoadComments()
        {
            List <Comments> list = new List <Comments>();

            if (ArticleID == null)
            {
                CommentPager.RecorderCount = CommentsHelper.QueryAllCommentsCount();
                list = CommentsHelper.QueryAllComments(CommentPager.Begin, CommentPager.Count, null);

                SummaryLabel.Text = "管理全部评论";
            }
            else
            {
                CommentPager.RecorderCount = CommentsHelper.ArticleIDQueryCommentsCount(ArticleID);
                list = CommentsHelper.ArticleIDQueryComments(ArticleID, CommentPager.Begin, CommentPager.Count, null);

                try
                {
                    SummaryLabel.Text = String.Format("管理文章:“{0}”的评论", ArticleHelper.GetArticle(ArticleID, new string[] { "Title" }).Title);
                }
                catch
                {
                    string  chID = ChannelHelper.GetChannelIDByOnlyName(ArticleID);
                    Channel ch   = ChannelHelper.GetChannel(chID, new string[] { "FullPath" });
                    if (ch != null)
                    {
                        SummaryLabel.Text = String.Format("管理栏目:“{0}”的评论", ch.FullPath);
                    }
                }
            }

            foreach (Comments c in list)
            {
                if (c.Content.Length > TitleMaxLength)
                {
                    c.Content = String.Format("{0}...", c.Content.Substring(0, TitleMaxLength));
                }

                string[] fields       = new string[] { "Title", "ModelName" };
                string   acticleTitle = "";
                if (!We7Helper.IsEmptyID(c.ArticleID))
                {
                    //文章下的评论
                    try
                    {
                        Article ac = ArticleHelper.GetArticle(c.ArticleID, fields);
                        if (ac != null)
                        {
                            acticleTitle = String.Format("{1}:{0}", ac.Title, "System.Article" == ac.ModelName ? "文章" : Model.Core.ModelHelper.GetModelInfoByName(ac.ModelName).Label);
                        }
                    }
                    //栏目下的评论
                    catch
                    {
                        string  chID = ChannelHelper.GetChannelIDByOnlyName(c.ArticleID);
                        Channel ch   = ChannelHelper.GetChannel(chID, new string[] { "FullPath" });
                        if (ch != null)
                        {
                            acticleTitle = String.Format("栏目:{0}", ch.FullPath);
                        }
                    }
                }

                if (acticleTitle.Length > TitleMaxLength)
                {
                    c.ArticleTitle = String.Format("{0}...", acticleTitle.Substring(0, TitleMaxLength));
                }
                else
                {
                    c.ArticleTitle = acticleTitle;
                }
            }
            DataGridView.DataSource = list;
            DataGridView.DataBind();
        }
Exemple #29
0
        string BuildNavString()
        {
            string strActive = @"<LI class=TabIn id=tab{0} style='display:{2}'><A>{1}</A> </LI>";
            string strLink   = @"<LI class=TabOut id=tab{0}  style='display:{2}'><A  href={3}>{1}</A> </LI>";
            int    tab       = 1;
            string tabString = "";
            string dispay    = "";
            string rawurl    = We7Helper.RemoveParamFromUrl(Request.RawUrl, "tab");

            rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "saved");

            //记录操作历史,按照操作历史延续
            if (!We7Helper.IsEmptyID(ChannelID) && Session["$We7_Channel_Tab"] != null)
            {
                tab = (int)Session["$We7_Channel_Tab"];
            }

            if (TabID != null && We7Helper.IsNumber(TabID) && int.Parse(TabID) > 0)
            {
                tab = int.Parse(TabID);
            }

            if (tab == 1)
            {
                tabString += string.Format(strActive, 1, "基本信息", dispay);
                Control ctl = this.LoadControl("controls/Channel_basic.ascx");
                ContentHolder.Controls.Add(ctl);
            }
            else
            {
                tabString += string.Format(strLink, 1, "基本信息", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "1"));
            }

            if (!We7Helper.IsEmptyID(ChannelID))
            {
                if (tab == 2)
                {
                    tabString += string.Format(strActive, 2, "选项", dispay);
                    Control ctl = this.LoadControl("controls/Channel_option.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    tabString += string.Format(strLink, 2, "选项", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "2"));
                }


                if (tab == 3)
                {
                    tabString += string.Format(strActive, 3, "模板", dispay);
                    Control ctl = this.LoadControl("controls/Channel_template.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    tabString += string.Format(strLink, 3, "模板", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "3"));
                }


                if (tab == 4)
                {
                    tabString += string.Format(strActive, 4, "标签", dispay);
                    Control ctl = this.LoadControl("controls/Channel_tag.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    tabString += string.Format(strLink, 4, "标签", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "4"));
                }


                if (tab == 5)
                {
                    tabString += string.Format(strActive, 5, "权限", dispay);
                    Control ctl = this.LoadControl("controls/Channel_authorize.ascx");
                    ContentHolder.Controls.Add(ctl);
                }
                else
                {
                    tabString += string.Format(strLink, 5, "权限", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "5"));
                }

                if (SiteConfigs.GetConfig().SiteGroupEnabled)
                {
                    MoreEventArgs evenArgs = new MoreEventArgs();
                    //ShareEvent shareEvent =  new ShareEvent();
                    //shareEvent
                    ShareEventFactory.Instance.OnLoadChannelShareConfig(tab, evenArgs);
                    tabString += evenArgs.ReturnValue;
                    Control c = evenArgs.ReturnObject as Control;
                    if (c != null)
                    {
                        ContentHolder.Controls.Add(c);
                    }
                }
                if (System.IO.File.Exists(Server.MapPath("/Plugins/IPStrategyPlugin/Plugin.xml")))
                {
                    if (tab == 7)
                    {
                        tabString += string.Format(strActive, 7, "IP过滤", dispay);
                        Control ctl = this.LoadControl("controls/StrategySet.ascx");
                        if (ctl is StrategySet)
                        {
                            ((StrategySet)ctl).Mode = StrategyMode.CHANNEL;
                        }
                        ContentHolder.Controls.Add(ctl);
                    }
                    else
                    {
                        tabString += string.Format(strLink, 7, "IP过滤", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "7"));
                    }
                }


                //if (tab == 8)
                //{
                //    tabString += string.Format(strActive, 8, "附加模块", dispay);
                //    Control ctl = this.LoadControl("controls/Channel_Module.ascx");
                //    ContentHolder.Controls.Add(ctl);
                //}
                //else
                //    tabString += string.Format(strLink, 8, "附加模块", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "8"));
            }

            Session["$We7_Channel_Tab"] = tab;
            return(tabString);
        }
Exemple #30
0
        public string GetThisHtmlPageTemplate(string ColumnMode, string ColumnID, string SearchWord, string SeSearchWord)
        {
            string TemplatePath = "";
            bool   IsDetail     = false;

            if (ColumnMode == "detail" || ColumnMode == "productDetail" || ColumnMode == "contentMode" || ColumnMode == "adviceMode")
            {
                IsDetail = true;
            }
            if (!We7Helper.IsEmptyID(ColumnID))
            {
                HelperFactory helperFactory = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID];
                ChannelHelper channelHelper = helperFactory.GetHelper <ChannelHelper>();
                Channel       ch            = channelHelper.GetChannel(ColumnID, null);

                SiteSettingHelper cdHelper = helperFactory.GetHelper <SiteSettingHelper>();

                GeneralConfigInfo si = GeneralConfigs.GetConfig();
                if (si.DefaultTemplateGroupFileName != null && si.DefaultTemplateGroupFileName.Length > 0)                                        //判断一下模板文件是否真实存在
                {
                    if (IsDetail && ch != null && ch.DetailTemplate != null && ch.DetailTemplate != "" && GetTemplate(ch.DetailTemplate) != null) //详细模板
                    {
                        TemplatePath = GetTemplatePath(si.DefaultTemplateGroupFileName, ch.DetailTemplate);
                    }
                    else if (ch != null && ch.TemplateName != null && ch.TemplateName != "" && !IsDetail)
                    {
                        TemplatePath = GetTemplatePath(si.DefaultTemplateGroupFileName, ch.TemplateName);
                    }
                }

                if (TemplatePath == "" || TemplatePath == null) //按别名匹配
                {
                    if (ch != null && ch.Alias != null && ch.Alias != "" && !IsDetail)
                    {
                        string tmp = GetDefaultTemplatePath(ch.Alias, IsDetail);
                        if (tmp != null && tmp != "")
                        {
                            TemplatePath = tmp;
                        }
                    }
                }
                if (TemplatePath == "" || TemplatePath == null) //按标签匹配
                {
                    if (!IsDetail)
                    {
                        List <string> tags = channelHelper.GetTags(ColumnID);
                        if (tags.Count != 0)
                        {
                            string tmp = GetDefaultTemplatePath(tags[0], IsDetail);
                            if (tmp != null && tmp != "")
                            {
                                TemplatePath = tmp;
                            }
                        }
                    }
                }
            }

            if (TemplatePath == "" || TemplatePath == null) //赋值默认模板
            {
                //if (ColumnMode == "productDetail")
                //{
                //    TemplatePath = GetDefaultTemplatePath("[productcontentpage]");
                //}
                if (SeSearchWord != null)
                {
                    TemplatePath = GetDefaultTemplatePath("[sesearch]");
                }
                else if (SearchWord != null)
                {
                    TemplatePath = GetDefaultTemplatePath("[search]");
                }
                else if (We7Helper.IsEmptyID(ColumnID) || ColumnID == "/")
                {
                    TemplatePath = GetDefaultTemplatePath("[homepage]");
                }
                else if (ColumnMode == "detail")
                {
                    TemplatePath = GetDefaultTemplatePath("[contentpage]", true);
                }
                else if (ColumnMode == "productDetail")
                {
                    TemplatePath = GetDefaultTemplatePath("[productcontentpage]");
                }
                else if (ColumnMode == "contentMode")
                {
                    TemplatePath = GetDefaultTemplatePath("[ContentMode]");
                }
                else if (ColumnMode == "adviceMode")
                {
                    TemplatePath = GetDefaultTemplatePath("[AdviceMode]");
                }
                else
                {
                    TemplatePath = GetDefaultTemplatePath("[channel]");
                }
            }
            return(TemplatePath);
        }