Exemplo n.º 1
0
        void BindData()
        {
            List <ViewItem>   items = new List <ViewItem>();
            List <Department> dts   = null;
            List <Account>    acts  = null;


            AccountQuery aq = new AccountQuery();

            aq.KeyWord  = Keyword;
            aq.SiteID   = SiteID;
            aq.UserType = (int)CurrentState;

            UPager.PageIndex  = PageNumber;
            UPager.ItemCount  = AccountHelper.QueryAccountCountByQuery(aq);
            UPager.UrlFormat  = We7Helper.AddParamToUrl(Request.RawUrl, Keys.QRYSTR_PAGEINDEX, "{0}");
            UPager.PrefixText = "共 " + UPager.MaxPages + "  页 ·   第 " + UPager.PageIndex + "  页 · ";

            acts = AccountHelper.QueryAccountsByQuery(aq, UPager.Begin - 1, UPager.Count,
                                                      new string[] { "ID", "LoginName", "Email", "CreatedNoteTime", "EmailValidate", "ModelState", "ModelName", "State", "Created", "UserType", "Department" });


            if (acts != null)
            {
                foreach (Account act in acts)
                {
                    ViewItem vi = new ViewItem();
                    vi.Text      = "<b>" + act.LoginName + "</b> " + act.LastName + "";
                    vi.Summary   = act.Department;
                    vi.Mode      = "User";
                    vi.State     = act.TypeText;
                    vi.Url       = String.Format("AccountEdit.aspx?id={0}", act.ID);
                    vi.DeleteUrl = String.Format("javascript:DeleteConfirm('{0}','{1}','Account');", act.ID, act.LoginName);
                    vi.EditUrl   = String.Format("AccountEdit.aspx?id={0}", act.ID);
                    string mng = @"<a href=""AccountEdit.aspx?id={0}&tab=2"">
                            角色设置</a> 
                        <a href=""AccountEdit.aspx?id={0}&tab=6"">
                            模块权限</a>    ";
                    vi.ManageLinks  = string.Format(mng, act.ID);
                    vi.ID           = act.ID;
                    vi.RegisterDate = act.Created.ToLongDateString();
                    if (DepartmentID != We7Helper.EmptyGUID)
                    {
                        if (act.DepartmentID == DepartmentID)
                        {
                            items.Add(vi);
                        }
                    }
                    else
                    {
                        if (act.DepartmentID == We7Helper.EmptyGUID)
                        {
                            items.Add(vi);
                        }
                    }
                }
            }
            AccountsGridView.DataSource = items;
            AccountsGridView.DataBind();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 构建标签项,完全可以通过控制每步骤的display属性
        /// 进行功能项的控制,此属性完全可以进行如同模块式的管理
        /// 设计页面、Tab名称、Tab显示属性、Tab所加载控件
        /// 三者以控制其相应的显示
        /// </summary>
        /// <returns></returns>
        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 (TabID != null && We7Helper.IsNumber(TabID))
            {
                tab = int.Parse(TabID);
            }

            if (tab == 1)
            {
                tabString += string.Format(strActive, 1, "站点关联", dispay);
                Control ctl = this.LoadControl("Config_SiteSetting.ascx");
                ContentHolder.Controls.Add(ctl);
            }
            else
            {
                tabString += string.Format(strLink, 1, "站点关联", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "1"));
            }


            return(tabString);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string accoundID = Request[We7.Model.Core.UI.Constants.FEID];

            if (!String.IsNullOrEmpty(accoundID))
            {
                Account account = AccountHelper.GetAccount(accoundID, null);
                if (account == null)
                {
                    Response.Write("验证帐号不存在,请重新申请帐号!");
                }
                else
                {
                    account.EmailValidate = 1;
                    account.State         = 1;
                    AccountHelper.UpdateAccount(account, new string[] { "EmailValidate", "State" });

                    if (!string.IsNullOrEmpty(Request["returnUrl"]))
                    {
                        string url = Request["returnUrl"];
                        url = We7Helper.AddParamToUrl(url, We7.Model.Core.UI.Constants.FEID, account.ID);
                        url = We7Helper.AddParamToUrl(url, "activeIndex", "2");
                        Response.Redirect(url);
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected void DataBind()
        {
            AdviceUPager.PageIndex  = PageNumber;
            AdviceUPager.UrlFormat  = We7Helper.AddParamToUrl(Request.RawUrl.Replace("{", "{{").Replace("}", "}}"), Keys.QRYSTR_PAGEINDEX, "{0}");
            AdviceUPager.PrefixText = "共 " + AdviceUPager.MaxPages + "  页 ·   第 " + AdviceUPager.PageIndex + "  页 · ";

            if (ShowType != 3)
            {
                Dictionary <string, object> queryInfo = new Dictionary <string, object>();
                if (!string.IsNullOrEmpty(txtQuery.Text.Trim()))
                {
                    queryInfo.Add("title", txtQuery.Text.Trim());
                }
                if (!string.IsNullOrEmpty(Request["RelationID"]))
                {
                    queryInfo.Add("RelationID", Request["RelationID"].Trim());
                }

                AdviceUPager.ItemCount    = adviceHelper.QueryAdviceCount(TypeID, ShowType, queryInfo);
                AdviceGridView.Visible    = true;
                TransferGridView.Visible  = false;
                AdviceGridView.DataSource = adviceHelper.QueryAdvice(TypeID, ShowType, queryInfo, AdviceUPager.Begin - 1, AdviceUPager.Count);
                AdviceGridView.DataBind();
            }
            else
            {
                AdviceUPager.ItemCount      = adviceHelper.QueryAdviceCount(TypeID, ShowType);
                AdviceGridView.Visible      = false;
                TransferGridView.Visible    = true;
                TransferGridView.DataSource = adviceHelper.QueryTransfers(TypeID, AdviceUPager.Begin - 1, AdviceUPager.Count);
                TransferGridView.DataBind();
            }
        }
Exemplo n.º 5
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            string nameText = TitleTextBox.Text.Trim();
            string title    = DesTextBox.Text.Trim();
            string url      = UrlTextBox.Text.Trim();
            int    index    = 0;

            if (Int32.Parse(SecondIndexDropDownList.SelectedItem.Value.Split(',')[1]) > 0)
            {
                index = Int32.Parse(SecondIndexDropDownList.SelectedItem.Value.Split(',')[1]) - 1;
            }
            string parentID = SecondIndexDropDownList.SelectedItem.Value.Split(',')[0];

            MenuHelper.CreateSubMenu(nameText, title, url, index, parentID, "", EntityID);

            string lisUrl = We7Helper.AddParamToUrl(ReturnHyperLink.NavigateUrl, "reload", "menu");

            lisUrl = We7Helper.AddParamToUrl(lisUrl, "add", title);
            if (returnURL != null)
            {
                lisUrl = We7Helper.AddParamToUrl(lisUrl, "returnURL", returnURL);
            }
            HttpContext.Current.Session.Clear();
            Response.Redirect(lisUrl);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取链接地址
        /// </summary>
        /// <param name="dataitem"></param>
        /// <returns></returns>
        private string GetLinkUrl(object dataitem)
        {
            if (ModelInfo == null)
            {
                ModelInfo = ModelHelper.GetModelInfo(We7Helper.GetParamValueFromUrl(HttpContext.Current.Request.RawUrl, "model"));
            }
            string result = string.Empty;

            foreach (We7DataColumn d in ModelInfo.DataSet.Tables[0].Columns)
            {
                if (d.Name.Contains("_Count"))
                {
                    string model = string.Format("{0}.{1}", ModelInfo.GroupName, d.Name.Remove(d.Name.Length - 6));
                    string url   = We7Helper.AddParamToUrl(HttpContext.Current.Request.RawUrl, "model", model);
                    url    = We7Helper.RemoveParamFromUrl(url, "mode");
                    url    = We7Helper.AddParamToUrl(url, d.Mapping.Split('|')[0], GetValue(dataitem, d.Mapping.Split('|')[1]));
                    result = url;
                    break;
                }
            }
            if (string.IsNullOrEmpty(result))
            {
                result = string.Format("/admin/AddIns/ModelViewer.aspx?notiframe=1&model={0}&ID={1}", ModelInfo.ModelName, GetValue(dataitem, "ID"));
            }
            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 格式化标签,使其变为 <a href=''>标签</a> 形式
        /// </summary>
        /// <param name="tags"></param>
        /// <returns></returns>
        private string Format(string tags)
        {
            if (string.IsNullOrEmpty(tags))
            {
                return(tags);
            }

            string rawurl = HttpContext.Current.Request.RawUrl.Replace("{", "{{").Replace("}", "}}");

            rawurl = We7Helper.AddParamToUrl(rawurl, "tag", "{0}");
            string url = "<a href='{0}'>{1}</a>";

            tags = tags.Replace("''", ",").Replace("'", "");
            string[]      taglist = tags.Split(',');
            StringBuilder sb      = new StringBuilder();

            foreach (string tag in taglist)
            {
                if (!string.IsNullOrEmpty(tag))
                {
                    string s     = HttpUtility.UrlEncode(tag);
                    string myUrl = string.Format(rawurl, s);
                    sb.Append(string.Format(url, myUrl, tag));
                    sb.Append(",");
                }
            }
            string result = sb.ToString();

            if (result.EndsWith(","))
            {
                result = result.Remove(result.Length - 1);
            }
            return(result);
        }
Exemplo n.º 8
0
        protected void Initialize()
        {
            List <string> accounts = new List <string>();

            ArticleUPager.PageIndex = PageNumber;
            ArticleUPager.ItemCount = AccountHelper.GetAccountCountOfRole(RoleID);

            ArticleUPager.UrlFormat  = We7Helper.AddParamToUrl(Request.RawUrl.Replace("{", "{{").Replace("}", "}}"), Keys.QRYSTR_PAGEINDEX, "{0}");
            ArticleUPager.PrefixText = "共 " + ArticleUPager.MaxPages + "  页 ·   第 " + ArticleUPager.PageIndex + "  页 · ";

            accounts = AccountHelper.GetAccountsOfRole(RoleID, ArticleUPager.Begin - 1, ArticleUPager.Count);

            List <InnerItem> items = new List <InnerItem>();

            foreach (string aid in accounts)
            {
                InnerItem item = new InnerItem();
                item.AccountID = aid;
                item.RoleID    = RoleID;
                Account a = AccountHelper.GetAccount(aid, new string[] { "LoginName", "DepartmentID", "Department" });
                if (a != null)
                {
                    item.AccountName    = a.LoginName;
                    item.DepartmentName = a.Department;
                }
                items.Add(item);
            }
            personalForm.DataSource = items;
            personalForm.DataBind();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 返回按钮初始化
        /// </summary>
        /// <returns></returns>
        private HtmlAnchor BtnBackInit()
        {
            HtmlAnchor btnBack     = new HtmlAnchor();
            string     parentModel = string.Empty;

            foreach (We7Control control in PanelContext.Model.Layout.Panels["edit"].EditInfo.Controls)
            {
                if (control.Type == "RelationSelect" || control.Type == "RelationSelectEx")
                {
                    parentModel = control.Params["model"];
                    break;
                }
            }
            btnBack.Attributes.Add("class", "btnBack");
            if (string.IsNullOrEmpty(parentModel))
            {
                btnBack.HRef = "javascript:history.go(-1);void(0);";
                btnBack.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");
            }
            else
            {
                btnBack.HRef = We7Helper.AddParamToUrl(Request.RawUrl, "model", parentModel);
            }
            btnBack.Attributes.Add("title", "返回");
            HtmlImage img = new HtmlImage();

            img.Src = "/admin/images/back.png";
            btnBack.Controls.Add(img);
            return(btnBack);
        }
Exemplo n.º 10
0
        protected void DeleteMenuButton_Click(object sender, EventArgs e)
        {
            if (AppCtx.IsDemoSite)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "aler", "alert('演示站点,不能删除!');", true);
                return;
            }

            string id   = IDTextBox.Text.Trim();
            string name = MenuHelper.DeleteMenuItem(id);

            /*
             * Content:删除菜单后同时删除XML数据, 根据数据库删除规则,删除顶级菜单时 级联删除子菜单
             * Author: 勾立国 2011-7-13
             * Begin:
             */
            if (EntityID == "System.User")
            {
                //MenuItemXmlHelper helper = new MenuItemXmlHelper(Server.MapPath("/user/Resource/menuItems.xml"));
                //helper.DeleteMenuItemWidthChilds(id);
            }

            /*
             * End
             */

            string url = We7Helper.AddParamToUrl(Request.RawUrl, "reload", "menu");

            url = We7Helper.AddParamToUrl(url, "del", name);
            HttpContext.Current.Session.Clear();
            Response.Redirect(url);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 构建标签项,完全可以通过控制每步骤的display属性
        /// 进行功能项的控制,此属性完全可以进行如同模块式的管理
        /// 设计页面、Tab名称、Tab显示属性、Tab所加载控件
        /// 三者以控制其相应的显示
        /// </summary>
        /// <returns></returns>
        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 (TabID != null && We7Helper.IsNumber(TabID))
            {
                tab = int.Parse(TabID);
            }

            Role r = AccountHelper.GetRole(RoleID);

            if (tab == 1)
            {
                tabString += string.Format(strActive, 1, "回复统计", dispay);
                Control ctl = this.LoadControl("../Advice/controls/AdviceReplyStatisticsControl.ascx");
                ContentHolder.Controls.Add(ctl);
            }
            else
            {
                tabString += string.Format(strLink, 1, "回复统计", dispay, We7Helper.AddParamToUrl(rawurl, "tab", "1"));
            }
            return(tabString);
        }
Exemplo n.º 12
0
 void ucEditor_OnPreCommand(object sender, ModelEventArgs args)
 {
     if (args.CommandName == "reset")
     {
         Response.Redirect(We7Helper.AddParamToUrl(Request.RawUrl, We7.Model.Core.UI.Constants.EntityID, We7Helper.CreateNewID()));
         args.Disable = true;
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 处理跳转
        /// </summary>
        /// <param name="index"></param>
        void ProcessTransfer(string index)
        {
            string strAccountId = Request[We7.Model.Core.UI.Constants.FEID];
            string url          = We7Helper.AddParamToUrl(Request.RawUrl, We7.Model.Core.UI.Constants.FEID, strAccountId);

            url = We7Helper.AddParamToUrl(url, "activeIndex", index);
            Response.Redirect(url);
        }
Exemplo n.º 14
0
 void ucEditor_OnCommandComplete(object sender, ModelEventArgs args)
 {
     if (OnSuccess != null)
     {
         OnSuccess(this, EventArgs.Empty);
     }
     UIHelper.SendMessage("保存成功!<a href='" + NewUrl + "'>继续添加新记录</a>");
     Server.Transfer(We7Helper.AddParamToUrl(Request.RawUrl, We7.Model.Core.UI.Constants.EntityID, Request[Constants.EntityID]));
 }
Exemplo n.º 15
0
        public static void Redirect(int type, string typeID, string message)
        {
            string url = "ProccessMsg.aspx";

            url = We7Helper.AddParamToUrl(url, "type", HttpUtility.UrlEncode(type.ToString()));
            url = We7Helper.AddParamToUrl(url, "typeID", HttpUtility.UrlEncode(typeID));
            url = We7Helper.AddParamToUrl(url, "msg", HttpUtility.UrlEncode(message));
            HttpContext.Current.Response.Redirect(url);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 信息保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string   content  = "";
            string   logtitle = "";
            Template t        = CurrentTemplate;

            if (FileNameTextBox.Text == "请输入文件名" || FileNameTextBox.Text.Trim() == "")
            {
                FileNameTextBox.Text = NameTextBox.Text;// +".ascx";
            }

            //if (!FileNameTextBox.Text.EndsWith(".ascx", StringComparison.CurrentCultureIgnoreCase))
            //{
            //    FileNameTextBox.Text += ".ascx";
            //}

            if (File.Exists(Path.Combine(TemplateHelper.DefaultTemplateGroupPath, FileNameTextBox.Text + ".xml")))
            {
                Messages.ShowError("模板文件【" + FileNameTextBox.Text + "】已存在,请重新命名!");
                return;
            }
            if (FileNameTextBox.Text.EndsWith(".ascx"))//如果是.ascx结尾,则不添加
            {
                t.FileName = FileNameTextBox.Text;
            }
            else
            {
                t.FileName = FileNameTextBox.Text + ".ascx";
            }

            t.Created          = DateTime.Now;
            t.IsSubTemplate    = false;
            t.IsVisualTemplate = true;
            t.Name             = NameTextBox.Text;
            t.Description      = DescriptionTextBox.Text;
            TemplateHelper.SaveTemplate(t, TemplateGroupFileName);

            t.FilePath = TemplateHelper.GetTemplatePath(String.Format("{0}/{1}", t.SkinFolder, t.FileName));

            File.WriteAllText(Server.MapPath(t.FilePath), "", Encoding.UTF8);
            if (BindConfig.Enough)
            {
                TemplateHelper.SaveTemplateBind(BindConfig, CurrentTemplate.SkinFolder, CurrentTemplate.FileName);
            }


            //记录日志
            content  = string.Format("新建模板“{0}”", NameTextBox.Text);
            logtitle = "新建模板";
            AddLog(logtitle, content);

            string url = "SelectTemplate.aspx?folder=" + Path.GetFileNameWithoutExtension(GeneralConfigs.GetConfig().DefaultTemplateGroupFileName);

            url = We7Helper.AddParamToUrl(url, "file", t.FileName);
            Response.Redirect(url);
        }
Exemplo n.º 17
0
        protected void ShowMenuButton_Click(object sender, EventArgs e)
        {
            string id   = IDTextBox.Text.Trim();
            string name = MenuHelper.UpdateMenuItem(id, 0);
            string url  = We7Helper.AddParamToUrl(Request.RawUrl, "reload", "menu");

            url = We7Helper.AddParamToUrl(url, "show", name);
            HttpContext.Current.Session.Clear();
            Response.Redirect(url);
        }
Exemplo n.º 18
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (AppCtx.IsDemoSite)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "aler", "alert('演示站点,不能新建菜单!');", true);
                return;
            }

            try
            {
                string mainIconName = "";
                string id           = "";
                if (MenuID != null && MenuID != "")
                {
                    if (IconFileUpload.HasFile && HoverIconFileUpload.HasFile)
                    {
                        mainIconName = GetIconFileName();
                    }
                    id = MenuID;
                }
                else
                {
                    mainIconName = GetIconFileName();
                }
                string mainTitle    = MainDesTextBox.Text.Trim();
                string mianNameText = MainTitleTextBox.Text.Trim();
                string mianUrl      = MianUrlTextBox.Text.Trim();
                int    maingroup    = Int32.Parse(DropDownListType.SelectedItem.Value.Split(',')[0]);
                int    mainIndex    = 0;
                if (Int32.Parse(DropDownListType.SelectedItem.Value.Split(',')[1]) > 0)
                {
                    mainIndex = Int32.Parse(DropDownListType.SelectedItem.Value.Split(',')[1]) - 1;
                }

                MenuHelper.CreateMainMenu(mianNameText, mainTitle, maingroup, mainIndex, mainIconName, mianUrl, id, EntityID);
                if (MenuID != null && MenuID != "")
                {
                    Messages.ShowMessage("您成功修改" + mainTitle + "菜单,更新成功之后请退出重新登陆才能生效");
                }
                else
                {
                    string url = We7Helper.AddParamToUrl(ReturnHyperLink.NavigateUrl, "reload", "menu");
                    url = We7Helper.AddParamToUrl(url, "add", mainTitle);
                    HttpContext.Current.Session.Clear();
                    Response.Redirect(url);
                }
            }
            catch (Exception ex)
            {
                Messages.ShowMessage(ex.Message);
            }
        }
Exemplo n.º 19
0
        protected override void InitContainer()
        {
            ChangeState();
            editMode.Controls.Clear();
            string curMode = HttpUtility.UrlDecode(We7Helper.GetParamValueFromUrl(Request.RawUrl, "mode"));
            bool   flag    = true;

            if (Request["groupIndex"] == null)
            {
                flag = false;
            }
            foreach (Group group in PanelContext.Panel.EditInfo.Groups)
            {
                if (group.Enable)
                {
                    if (string.IsNullOrEmpty(curMode))
                    {
                        curMode = group.Name;
                    }
                    if (!flag)
                    {
                        GroupIndex = group.Index;
                        flag       = true;
                    }
                }
                HtmlAnchor a = new HtmlAnchor();
                a.InnerText = group.Name;
                a.Style.Add(HtmlTextWriterStyle.MarginRight, "20px");
                if (group.Index == GroupIndex)
                {
                    a.Style.Add(HtmlTextWriterStyle.FontWeight, "bolder");
                }
                a.HRef = We7Helper.AddParamToUrl(Request.RawUrl, "mode", HttpUtility.UrlEncode(group.Name));
                a.HRef = We7Helper.AddParamToUrl(a.HRef, "groupIndex", group.Index.ToString());
                editMode.Controls.Add(a);
            }
            if (string.IsNullOrEmpty(curMode) || IsEdit)
            {
                curMode = "默认";
            }
            rpEditor.DataSource = PanelContext.Panel.EditInfo.Groups[curMode].Controls;
            rpEditor.DataBind();
            ModelLabel.Text   = PanelContext.Model.Label;
            MenuTabLabel.Text = BuildNavString();
            if (IsEdit)
            {
                trBtn.Visible = Security.CurrentAccountID == (PanelContext.Row["AccountID"] ?? We7Helper.EmptyGUID).ToString() ||
                                Security.CurrentAccountID == We7Helper.EmptyGUID;
            }
        }
Exemplo n.º 20
0
        protected void GenarateButton_ServerClick(object sender, EventArgs e)
        {
            Article a        = ArticleHelper.GetArticle(ArticleID);
            string  fn       = Server.MapPath(a.Thumbnail);
            string  ext      = Path.GetExtension(fn);
            string  path     = a.Thumbnail;
            string  fileName = path.Substring(path.LastIndexOf("/") + 1, path.LastIndexOf(".") - path.LastIndexOf("/") - 1);

            string ret = GenerateThumbImage(Server.MapPath(a.Thumbnail), ext, fileName);

            if (ret != "")
            {
                Response.Redirect(We7Helper.AddParamToUrl(Request.RawUrl, "generated", ret));
            }
        }
Exemplo n.º 21
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);
            }
        }
Exemplo n.º 22
0
        protected void HideButton_Click(object sender, EventArgs e)
        {
            if (AppCtx.IsDemoSite)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "aler", "alert('演示站点,不能隐藏!');", true);
                return;
            }

            string id   = IDTextBox.Text.Trim();
            string name = MenuHelper.UpdateMenuItem(id, 2);
            string url  = We7Helper.AddParamToUrl(Request.RawUrl, "reload", "menu");

            url = We7Helper.AddParamToUrl(url, "hide", name);
            HttpContext.Current.Session.Clear();
            Response.Redirect(url);
        }
Exemplo n.º 23
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            AdviceType adviceType = new AdviceType();

            adviceType.CreateDate = DateTime.Now;
            int index;

            if (int.TryParse(SortNumber.Text, out index))
            {
                adviceType.Index = index;
            }
            adviceType.Title       = AdviceNameText.Text.Trim();
            adviceType.Description = RemarkText.Text.Trim();

            if (string.IsNullOrEmpty(adviceType.Title))
            {
                Messages.ShowError("模型名称不能为空");
                return;
            }

            if (AdviceTypeID == null || AdviceTypeID == "")             // 新建
            {
                adviceType.AccountID = AccountID;
                string adviceTypeID = We7Helper.CreateNewID();
                adviceType.ID = adviceTypeID;
                AdviceTypeHelper.AddAdviceType(adviceType);
            }
            else                // 修改
            {
                adviceType.ID = AdviceTypeID;
                AdviceTypeHelper.UpdateAdviceType(adviceType);
                Messages.ShowMessage("" + AdviceNameText.Text + " 模型修改成功!!");
            }
            //记录日志
            string content = string.Format("编辑了模型“{0}”的信息", adviceType.Title);

            AddLog("编辑反馈模型", content);

            if (AdviceTypeID == null || AdviceTypeID == "")
            {
                string rawurl = We7Helper.AddParamToUrl(Request.RawUrl, "saved", "1");
                rawurl = We7Helper.RemoveParamFromUrl(rawurl, "adviceTypeID");
                rawurl = We7Helper.AddParamToUrl(rawurl, "adviceTypeID", We7Helper.GUIDToFormatString(adviceType.ID));
                Response.Redirect(rawurl);
            }
        }
Exemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(Request[We7.Model.Core.UI.Constants.FEID]))
            {
                Response.Redirect(We7Helper.AddParamToUrl(Request.RawUrl, We7.Model.Core.UI.Constants.FEID, Security.CurrentAccountID));
            }
            Account account = AccountHelper.GetAccount(Security.CurrentAccountID, null);

            if (string.IsNullOrEmpty(account.ModelName))
            {
                Response.Write("<script>alert('该用户没有使用内容模型!');location.href='/User/AccountEdit.aspx';</script>");
                Response.End();
                return;
            }
            EditorPanel1.ModelName = account.ModelName;
            EditorPanel1.PanelName = "fedit";
        }
Exemplo n.º 25
0
        string LoadLinkTabString(string basictag, string tab, string loadName, string loadControl, string rawurl, string tabVisble)
        {
            string strLink   = @"<LI class=TabOut id=tab{0}  style='display:{2}'><A  href={3}>{1}</A> </LI>";
            string tabString = "";

            if (ArticleID != null && ArticleID != "")
            {
                tabString += string.Format(strLink, tab, loadName, tabVisble, We7Helper.AddParamToUrl(rawurl, "tab", tab));
            }
            else
            {
                if (tab == basictag)
                {
                    tabString += string.Format(strLink, tab, loadName, "", We7Helper.AddParamToUrl(rawurl, "tab", tab));
                }
            }
            return(tabString);
        }
Exemplo n.º 26
0
        void LoadMessages()
        {
            ArticleUPager.PageIndex  = PageNumber;
            ArticleUPager.ItemCount  = MessageHelper.QueryMessageCount(MsgState, SenderID, ReceiverID);
            ArticleUPager.UrlFormat  = We7Helper.AddParamToUrl(Request.RawUrl.Replace("{", "{{").Replace("}", "}}"), Keys.QRYSTR_PAGEINDEX, "{0}");
            ArticleUPager.PrefixText = "共 " + ArticleUPager.MaxPages + "  页 ·   第 " + ArticleUPager.PageIndex + "  页 · ";
            List <ShortMessage> myMessages = MessageHelper.GetPagedMessages(MsgState, SenderID, ReceiverID, ArticleUPager.Begin - 1, ArticleUPager.Count);

            foreach (ShortMessage sm in myMessages)
            {
                if (AccountID == We7Helper.EmptyGUID)
                {
                    sm.AccountName = SiteConfigs.GetConfig().AdministratorName;
                }
            }

            DataGridView.DataSource = myMessages;
            DataGridView.DataBind();
        }
Exemplo n.º 27
0
        /// <summary>
        /// 初始化页面信息
        /// </summary>
        void LoadAdvices()
        {
            AdviceUPager.PageIndex  = PageNumber;
            AdviceUPager.ItemCount  = AdviceHelper.QueryAdviceCountByAll(CurrentQuery);
            AdviceUPager.UrlFormat  = We7Helper.AddParamToUrl(Request.RawUrl.Replace("{", "{{").Replace("}", "}}"), Keys.QRYSTR_PAGEINDEX, "{0}");
            AdviceUPager.PrefixText = "共 " + AdviceUPager.MaxPages + "  页 ·   第 " + AdviceUPager.PageIndex + "  页 · ";

            List <Advice> list = new List <Advice>();

            list = AdviceHelper.GetAdviceByQuery(CurrentQuery, AdviceUPager.Begin - 1, AdviceUPager.Count);
            AdviceType adviceType = new AdviceType();

            foreach (Advice a in list)
            {
                if (a.MustHandle > 1)
                {
                    HasMustHandle = true;
                }
                if (a.TypeID != null && a.TypeID != "")
                {
                    adviceType = AdviceTypeHelper.GetAdviceType(a.TypeID);
                    if (adviceType != null)
                    {
                        a.TypeTitle = adviceType.Title;
                    }
                }
                if (a.UserID != null && a.UserID.Length > 0)
                {
                    a.Name = AccountHelper.GetAccount(a.UserID, new string[] { "LastName" }).LastName;
                }
                if (a.Name == null || a.Name == "")
                {
                    a.Name = "匿名用户";
                }
                a.TimeNote  = GetTimeNote(a.CreateDate);
                a.AlertNote = GetAlertNote(a.ToHandleTime, adviceType.RemindDays, a.MustHandle);
            }

            AdviceGridView.DataSource = list;
            AdviceGridView.DataBind();

            BuildStateLinks();//刷新状态统计栏
        }
Exemplo n.º 28
0
        void BindData()
        {
            try
            {
                ShopService.ProductInfo[] infos = ShopService.LoadRegistedProducts(SiteInfo.ShopLoginName, SiteInfo.ShopPassword, SiteInfo.SiteUrl);

                Pager.PageIndex = PageNumber;

                Pager.ItemCount  = infos != null ? infos.Length : 0;
                Pager.UrlFormat  = We7Helper.AddParamToUrl(Request.RawUrl.Replace("{", "{{").Replace("}", "}}"), Keys.QRYSTR_PAGEINDEX, "{0}");
                Pager.PrefixText = "共 " + Pager.MaxPages + "  页 ·   第 " + Pager.PageIndex + "  页 · ";

                PluginListGridView.DataSource = new List <ShopService.ProductInfo>(infos).GetRange(Pager.Begin - 1, Pager.Count);
                PluginListGridView.DataBind();
            }
            catch (Exception ex)
            {
                Messages.ShowError("应用程序程序!");
            }
        }
Exemplo n.º 29
0
        void SaveInformation()
        {
            if (DemoSiteMessage)
            {
                return;
            }

            Channel ch = ChannelHelper.GetChannel(ChannelID, null);

            if (ch != null)
            {
                //ch.ReferenceID = ReferenceIDTextBox.Text;
                ch.RefAreaID     = AreaIDTextBox.Text;
                ch.SecurityLevel = Convert.ToInt32(SecurityDropDownList.SelectedValue);
                if (TitleImageFileUpload.FileName != "")
                {
                    ch.TitleImage = UploadImage(ch.FullUrl);
                }

                ch.Process = ProcessDropDownList.SelectedValue;
                if (ch.Process == "1")
                {
                    ch.ProcessLayerNO = ProcessLayerDropDownlist.SelectedValue;
                    ch.ProcessEnd     = ProcessEndingDropDownList.SelectedValue;
                }

                ch.KeyWord        = KeywordTextBox.Text;
                ch.DescriptionKey = DescriptionTextBox.Text;
                ch.Parameter      = ParameterTextBox.Text.Trim();
                ChannelHelper.UpdateChannel(ch);

                //Messages.ShowMessage("栏目信息已经成功更新。");

                string rawurl = We7Helper.AddParamToUrl(Request.RawUrl, "saved", "1");
                Response.Redirect(rawurl);

                //记录日志
                string content = string.Format("修改了栏目“{0}”的信息", ch.Name);
                AddLog("编辑栏目", content);
            }
        }
Exemplo n.º 30
0
        string CreateUrl(QueryEntity query)
        {
            StringBuilder sb  = new StringBuilder();
            string        url = CurrentPage ? Request.RawUrl : SearchPageUrl;

            foreach (QueryParam param in query.QueryParams)

            {
                url = We7Helper.AddParamToUrl(url, param.ColumnKey, HttpUtility.UrlEncode(Convert.ToString(param.ColumnValue)));
                sb.Append(param.ColumnKey).Append(",");
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            url = We7Helper.AddParamToUrl(url, "QueryFields", HttpUtility.UrlEncode(sb.ToString()));
            url = We7Helper.AddParamToUrl(url, "queryed", HttpUtility.UrlEncode("1"));
            url = We7Helper.AddParamToUrl(url, "ModelName", HttpUtility.UrlEncode(query.ModelName));
            url = We7Helper.AddParamToUrl(url, "PageIndex", HttpUtility.UrlEncode("1"));
            return(url);
        }