Ejemplo n.º 1
0
 public ActionResult MainMenu(int? id)
 {
     if (id.HasValue && (id > 0))
     {
         ((dynamic) base.ViewBag).MaticsoftId = id.Value;
     }
     List<Maticsoft.Model.Settings.MainMenus> menusByArea = new Maticsoft.BLL.Settings.MainMenus().GetMenusByArea(Maticsoft.Model.Ms.EnumHelper.AreaType.CMS, "");
     return base.View(menusByArea);
 }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.txtMenuName.Text))
            {
                MessageBox.ShowFailTip(this, CMS.WMErrorMenuName);
            }
            else if (string.IsNullOrWhiteSpace(this.txtSqueeze.Text) || !PageValidate.IsNumber(this.txtSqueeze.Text))
            {
                MessageBox.ShowFailTip(this, CMS.WMErrorSqueeze);
            }
            else
            {
                string text = this.txtMenuName.Text;
                string text1 = this.txtNavURL.Text;
                int num = int.Parse(this.ddlTarget.SelectedValue);
                bool flag = this.chkIsUsed.Checked;
                Maticsoft.Model.Settings.MainMenus model = new Maticsoft.Model.Settings.MainMenus {
                    NavArea = Globals.SafeInt(this.ddlType.SelectedValue, 0),
                    URLType = Globals.SafeInt(this.ddNavType.SelectedValue, 0)
                };
                switch (model.URLType)
                {
                    case 0:
                        model.NavURL = this.txtNavURL.Text.Trim();
                        break;

                    case 1:
                    case 2:
                    case 3:
                    case 4:
                        model.NavURL = this.ddValue.SelectedValue;
                        break;

                    default:
                        model.NavURL = this.txtNavURL.Text.Trim();
                        break;
                }
                if (string.IsNullOrWhiteSpace(model.NavURL))
                {
                    MessageBox.ShowFailTip(this, CMS.WMErrorPageUrl);
                }
                else
                {
                    model.MenuName = text;
                    model.MenuType = 1;
                    model.Target = new int?(num);
                    model.IsUsed = flag;
                    model.MenuTitle = this.txtTile.Text;
                    model.Sequence = int.Parse(this.txtSqueeze.Text);
                    model.NavTheme = this.ddlTheme.SelectedValue;
                    Maticsoft.BLL.Settings.MainMenus menus2 = new Maticsoft.BLL.Settings.MainMenus();
                    if (menus2.Add(model) > 0)
                    {
                        this.btnSave.Enabled = false;
                        this.btnCancle.Enabled = false;
                        MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK, "list.aspx");
                    }
                    else
                    {
                        this.btnSave.Enabled = false;
                        this.btnCancle.Enabled = false;
                        MessageBox.ShowFailTip(this, Site.TooltipTryAgainLater, "list.aspx");
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public PartialViewResult Navigation()
 {
     List<MainMenus> menusByArea = new MainMenus().GetMenusByArea(Maticsoft.Model.Ms.EnumHelper.AreaType.SNS, MvcApplication.ThemeName);
     return this.PartialView("_Navigation", menusByArea);
 }
Ejemplo n.º 4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            if ((base.Request.Params["id"] != null) && (base.Request.Params["id"].Trim() != ""))
            {
                Maticsoft.BLL.Settings.MainMenus menus = new Maticsoft.BLL.Settings.MainMenus();
                int menuID = Convert.ToInt32(base.Request.Params["id"]);
                if (string.IsNullOrWhiteSpace(this.txtMenuName.Text))
                {
                    MessageBox.ShowFailTip(this, CMS.WMErrorMenuName);
                }
                else if (string.IsNullOrWhiteSpace(this.txtSqueeze.Text) || !PageValidate.IsNumber(this.txtSqueeze.Text))
                {
                    MessageBox.ShowFailTip(this, CMS.WMErrorSqueeze);
                }
                else
                {
                    string text = this.txtMenuName.Text;
                    string text1 = this.txtNavURL.Text;
                    bool flag = this.chkIsUsed.Checked;
                    Maticsoft.Model.Settings.MainMenus model = menus.GetModel(menuID);
                    model.MenuName = text;
                    model.MenuType = new int?(int.Parse(this.HiddenField_Type.Value));
                    model.Target = new int?(int.Parse(this.ddlTarget.SelectedValue));
                    model.IsUsed = flag;
                    model.MenuTitle = this.txtTile.Text;
                    model.Sequence = int.Parse(this.txtSqueeze.Text);
                    model.NavTheme = this.ddlTheme.SelectedValue;
                    model.NavArea = Globals.SafeInt(this.ddlType.SelectedValue, 0);
                    model.URLType = Globals.SafeInt(this.ddNavType.SelectedValue, 0);
                    switch (model.URLType)
                    {
                        case 0:
                            model.NavURL = this.txtNavURL.Text.Trim();
                            break;

                        case 1:
                        case 2:
                        case 3:
                        case 4:
                            model.NavURL = this.ddValue.SelectedValue;
                            break;

                        default:
                            model.NavURL = this.txtNavURL.Text.Trim();
                            break;
                    }
                    if (string.IsNullOrWhiteSpace(model.NavURL))
                    {
                        MessageBox.ShowFailTip(this, CMS.WMErrorPageUrl);
                    }
                    else if (menus.Update(model))
                    {
                        this.btnSave.Enabled = false;
                        this.btnCancle.Enabled = false;
                        MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK, "list.aspx");
                    }
                    else
                    {
                        this.btnSave.Enabled = false;
                        this.btnCancle.Enabled = false;
                        MessageBox.ShowFailTip(this, Site.TooltipTryAgainLater, "list.aspx");
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void ShowInfo(int MenuID)
        {
            Maticsoft.Model.Settings.MainMenus model = new Maticsoft.BLL.Settings.MainMenus().GetModel(MenuID);
            this.txtMenuName.Text = model.MenuName;
            this.ddlTarget.SelectedValue = model.Target.ToString();
            this.chkIsUsed.Checked = model.IsUsed;
            this.HiddenField_Type.Value = model.MenuType.ToString();
            this.txtTile.Text = model.MenuTitle;
            this.txtSqueeze.Text = model.Sequence.ToString();
            this.ddlType.SelectedValue = model.NavArea.ToString();
            this.ddNavType.SelectedValue = model.URLType.ToString();
            string areaName = "CMS";
            switch (model.NavArea)
            {
                case 0:
                    areaName = "CMS";
                    break;

                case 1:
                    areaName = "SNS";
                    break;

                case 2:
                    areaName = "Shop";
                    break;

                default:
                    areaName = "CMS";
                    break;
            }
            this.ddlTheme.DataSource = FileHelper.GetThemeList(areaName);
            this.ddlTheme.DataTextField = "Name";
            this.ddlTheme.DataValueField = "Name";
            this.ddlTheme.DataBind();
            this.ddlTheme.Items.Insert(0, new ListItem("全部", ""));
            this.ddlTheme.SelectedValue = model.NavTheme;
            switch (model.URLType)
            {
                case 0:
                    this.txtNavURL.Visible = true;
                    this.txtNavURL.Text = model.NavURL;
                    return;

                case 1:
                    this.ddValue.DataSource = new ContentClass().GetList(" ParentId=0");
                    this.ddValue.DataTextField = "ClassName";
                    this.ddValue.DataValueField = "ClassID";
                    this.ddValue.DataBind();
                    this.ddValue.Items.Insert(0, new ListItem("请选择", ""));
                    this.ddValue.SelectedValue = model.NavURL;
                    this.ddValue.Visible = true;
                    return;

                case 2:
                    this.ddValue.DataSource = new Categories().GetList(" ParentId=0 and type=0 and Status=1");
                    this.ddValue.DataTextField = "Name";
                    this.ddValue.DataValueField = "CategoryId";
                    this.ddValue.DataBind();
                    this.ddValue.Items.Insert(0, new ListItem("请选择", ""));
                    this.ddValue.SelectedValue = model.NavURL;
                    this.ddValue.Visible = true;
                    return;

                case 3:
                    this.ddValue.DataSource = new Categories().GetList(" ParentId=0 and type=1 and Status=1");
                    this.ddValue.DataTextField = "Name";
                    this.ddValue.DataValueField = "CategoryId";
                    this.ddValue.DataBind();
                    this.ddValue.Items.Insert(0, new ListItem("请选择", ""));
                    this.ddValue.SelectedValue = model.NavURL;
                    this.ddValue.Visible = true;
                    return;

                case 4:
                    this.ddValue.DataSource = new CategoryInfo().GetList(" ParentCategoryId=0 ");
                    this.ddValue.DataTextField = "Name";
                    this.ddValue.DataValueField = "CategoryId";
                    this.ddValue.DataBind();
                    this.ddValue.Items.Insert(0, new ListItem("请选择", ""));
                    this.ddValue.SelectedValue = model.NavURL;
                    this.ddValue.Visible = true;
                    return;
            }
            this.txtNavURL.Visible = true;
            this.txtNavURL.Text = model.NavURL;
        }
Ejemplo n.º 6
0
 public PartialViewResult Navigation(string viewName = "_Navigation", string Theme = "M1")
 {
     List<Maticsoft.Model.Settings.MainMenus> menusByAreaByCacle = new Maticsoft.BLL.Settings.MainMenus().GetMenusByAreaByCacle(Maticsoft.Model.Ms.EnumHelper.AreaType.Shop, Theme);
     return this.PartialView(viewName, menusByAreaByCacle);
 }