Example #1
0
        protected void btnok_Click(object sender, System.EventArgs e)
        {
            if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString()))
            {
                base.ShowMsg("Không có thẩm quyền");
            }
            else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString()))
            {
                base.ShowMsg("Không có thẩm quyền");
            }
            else
            {
                ContentPublish contentPublish = new ContentPublish();
                NodeInfo       nodeInfo       = new NodeInfo();
                if (base.IsEdit)
                {
                    nodeInfo = SinGooCMS.BLL.Node.GetCacheNodeById(base.OpID);
                }
                nodeInfo.NodeName       = WebUtils.GetString(this.TextBox1.Text);
                nodeInfo.UrlRewriteName = WebUtils.GetString(this.TextBox2.Text);
                nodeInfo.ParentID       = WebUtils.GetInt(this.DropDownList3.SelectedValue);
                nodeInfo.ModelID        = WebUtils.GetInt(this.DropDownList4.SelectedValue);
                nodeInfo.NodeBanner     = WebUtils.GetString(this.TextBox3.Text);
                nodeInfo.NodeImage      = WebUtils.GetString(this.TextBox5.Text);
                nodeInfo.SeoKey         = WebUtils.GetString(this.TextBox6.Text);
                nodeInfo.SeoDescription = WebUtils.GetString(this.TextBox7.Text);
                nodeInfo.Remark         = this.NodeDesc.Text;
                nodeInfo.ItemPageSize   = WebUtils.GetInt(this.TextBox9.Text);
                nodeInfo.IsShowOnMenu   = this.CheckBox10.Checked;
                nodeInfo.IsShowOnNav    = this.CheckBox11.Checked;
                nodeInfo.IsTop          = this.CheckBox12.Checked;
                nodeInfo.IsRecommend    = this.CheckBox13.Checked;
                nodeInfo.CustomLink     = WebUtils.GetString(this.TextBox14.Text);
                nodeInfo.Lang           = base.cultureLang;
                nodeInfo.AutoTimeStamp  = System.DateTime.Now;
                nodeInfo.NodeSetting.EnableAddInParent = this.CheckBox15.Checked;
                nodeInfo.NodeSetting.AllowComment      = this.CheckBox16.Checked;
                nodeInfo.NodeSetting.NeedLogin         = this.CheckBox17.Checked;
                string text = string.Empty;
                foreach (ListItem listItem in this.CheckBoxList18.Items)
                {
                    if (listItem.Selected)
                    {
                        text = text + listItem.Value + ",";
                    }
                }
                if (text.EndsWith(","))
                {
                    text = text.Substring(0, text.Length - 1);
                }
                nodeInfo.NodeSetting.EnableViewUGroups = text;
                string text2 = string.Empty;
                foreach (ListItem listItem2 in this.CheckBoxList19.Items)
                {
                    if (listItem2.Selected)
                    {
                        text2 = text2 + listItem2.Value + ",";
                    }
                }
                if (text2.EndsWith(","))
                {
                    text2 = text2.Substring(0, text2.Length - 1);
                }
                nodeInfo.NodeSetting.EnableViewULevel      = text2;
                nodeInfo.NodeSetting.TemplateOfNodeIndex   = WebUtils.GetString(this.TextBox20.Text);
                nodeInfo.NodeSetting.TemplateOfNodeList    = WebUtils.GetString(this.TextBox21.Text);
                nodeInfo.NodeSetting.TemplateOfNodeContent = WebUtils.GetString(this.TextBox22.Text);
                if (string.IsNullOrEmpty(nodeInfo.NodeName))
                {
                    base.ShowMsg("栏目名称不能为空");
                }
                if (string.IsNullOrEmpty(nodeInfo.UrlRewriteName))
                {
                    base.ShowMsg("栏目标识不能为空");
                }
                else if (nodeInfo.NodeName.IndexOf("&") > 0 || nodeInfo.UrlRewriteName.IndexOf("&") > 0)
                {
                    base.ShowMsg("存在非法的字符&");
                }
                else
                {
                    if (base.Action.Equals(ActionType.Add.ToString()))
                    {
                        NodeAddStatus nodeAddStatus  = SinGooCMS.BLL.Node.Add(nodeInfo);
                        NodeAddStatus nodeAddStatus2 = nodeAddStatus;
                        switch (nodeAddStatus2)
                        {
                        case NodeAddStatus.ToMoreNode:
                            base.ShowMsg("主栏目数量不能超过[" + base.ver.NodeLimit + "]个");
                            break;

                        case NodeAddStatus.Error:
                            base.ShowMsg("添加栏目失败");
                            break;

                        case NodeAddStatus.ExistsNodeName:
                            base.ShowMsg("已存在相同的栏目名称");
                            break;

                        case NodeAddStatus.ExistsNodeIdentifier:
                            base.ShowMsg("已存在相同的栏目标识");
                            break;

                        case NodeAddStatus.ExistsNodeDir:
                            break;

                        case NodeAddStatus.ParentNodeNotExists:
                            base.ShowMsg("上级栏目不存在");
                            break;

                        default:
                            if (nodeAddStatus2 == NodeAddStatus.Success)
                            {
                                if (PageBase.config.BrowseType.Equals(BrowseType.Html.ToString()))
                                {
                                    contentPublish.CreateIndex();
                                    contentPublish.CreateNode(nodeInfo.AutoID);
                                }
                                PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加栏目[" + nodeInfo.NodeName + "] thành công");
                                base.Response.Redirect(string.Concat(new object[]
                                {
                                    "Index.aspx?CatalogID=",
                                    base.CurrentCatalogID,
                                    "&Module=",
                                    base.CurrentModuleCode,
                                    "&action=View"
                                }));
                            }
                            break;
                        }
                    }
                    if (base.Action.Equals(ActionType.Modify.ToString()))
                    {
                        NodeUpdateStatus nodeUpdateStatus  = SinGooCMS.BLL.Node.Update(nodeInfo);
                        NodeUpdateStatus nodeUpdateStatus2 = nodeUpdateStatus;
                        switch (nodeUpdateStatus2)
                        {
                        case NodeUpdateStatus.ToMoreNode:
                            base.ShowMsg("主栏目数量不能超过[" + base.ver.NodeLimit + "]个");
                            break;

                        case NodeUpdateStatus.Error:
                            base.ShowMsg("修改栏目失败");
                            break;

                        case NodeUpdateStatus.ExistsNodeName:
                            base.ShowMsg("已存在相同的栏目名称");
                            break;

                        case NodeUpdateStatus.ExistsNodeIdentifier:
                            base.ShowMsg("已存在相同的栏目标识");
                            break;

                        default:
                            if (nodeUpdateStatus2 == NodeUpdateStatus.Success)
                            {
                                if (PageBase.config.BrowseType.Equals(BrowseType.Html.ToString()))
                                {
                                    contentPublish.CreateIndex();
                                    contentPublish.CreateNode(nodeInfo.AutoID);
                                }
                                PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改栏目[" + nodeInfo.NodeName + "] thành công");
                                base.Response.Redirect(string.Concat(new object[]
                                {
                                    "Index.aspx?CatalogID=",
                                    base.CurrentCatalogID,
                                    "&Module=",
                                    base.CurrentModuleCode,
                                    "&action=View"
                                }));
                            }
                            break;
                        }
                    }
                }
            }
        }
Example #2
0
        protected void btnok_Click(object sender, System.EventArgs e)
        {
            if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString()))
            {
                base.ShowMsg("Không có thẩm quyền");
            }
            else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString()))
            {
                base.ShowMsg("Không có thẩm quyền");
            }
            else
            {
                CategoryInfo categoryInfo = new CategoryInfo();
                if (base.IsEdit)
                {
                    categoryInfo = SinGooCMS.BLL.Category.GetCacheCategoryByID(base.OpID);
                }
                categoryInfo.CategoryName   = WebUtils.GetString(this.TextBox1.Text);
                categoryInfo.ParentID       = WebUtils.StringToInt(this.DropDownList3.SelectedValue);
                categoryInfo.ModelID        = WebUtils.StringToInt(this.DropDownList4.SelectedValue);
                categoryInfo.CategoryImage  = WebUtils.GetString(this.TextBox5.Text);
                categoryInfo.SeoKey         = WebUtils.GetString(this.TextBox6.Text);
                categoryInfo.SeoDescription = WebUtils.GetString(this.TextBox7.Text);
                categoryInfo.Remark         = WebUtils.GetString(this.TextBox8.Text);
                categoryInfo.ItemPageSize   = WebUtils.StringToInt(this.TextBox9.Text);
                categoryInfo.IsTop          = this.CheckBox12.Checked;
                categoryInfo.IsRecommend    = this.CheckBox13.Checked;
                categoryInfo.Lang           = base.cultureLang;
                categoryInfo.UrlRewriteName = WebUtils.GetString(this.TextBox2.Text);
                if (string.IsNullOrEmpty(categoryInfo.CategoryName))
                {
                    base.ShowMsg("分类名称不能为空");
                }
                else if (string.IsNullOrEmpty(categoryInfo.UrlRewriteName))
                {
                    base.ShowMsg("分类标识不能为空");
                }
                else
                {
                    if (base.Action.Equals(ActionType.Add.ToString()))
                    {
                        categoryInfo.AutoTimeStamp = System.DateTime.Now;
                        NodeAddStatus nodeAddStatus  = SinGooCMS.BLL.Category.Add(categoryInfo);
                        NodeAddStatus nodeAddStatus2 = nodeAddStatus;
                        switch (nodeAddStatus2)
                        {
                        case NodeAddStatus.Error:
                            base.ShowMsg("添加分类失败");
                            goto IL_319;

                        case NodeAddStatus.ExistsNodeName:
                            base.ShowMsg("已存在相同的分类名称");
                            goto IL_319;

                        case NodeAddStatus.ExistsNodeIdentifier:
                            base.ShowMsg("已存在相同的分类标识");
                            goto IL_319;

                        case NodeAddStatus.ExistsNodeDir:
                            break;

                        case NodeAddStatus.ParentNodeNotExists:
                            base.ShowMsg("上级分类不存在");
                            goto IL_319;

                        default:
                            if (nodeAddStatus2 == NodeAddStatus.Success)
                            {
                                PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加产品分类[" + categoryInfo.CategoryName + "] thành công");
                                base.Response.Redirect(string.Concat(new object[]
                                {
                                    "Category.aspx?CatalogID=",
                                    base.CurrentCatalogID,
                                    "&Module=",
                                    base.CurrentModuleCode,
                                    "&action=View"
                                }));
                                goto IL_319;
                            }
                            break;
                        }
                        base.ShowMsg("Lỗi Unknown");
                        IL_319 :;
                    }
                    if (base.Action.Equals(ActionType.Modify.ToString()))
                    {
                        NodeUpdateStatus nodeUpdateStatus  = SinGooCMS.BLL.Category.Update(categoryInfo);
                        NodeUpdateStatus nodeUpdateStatus2 = nodeUpdateStatus;
                        switch (nodeUpdateStatus2)
                        {
                        case NodeUpdateStatus.Error:
                            base.ShowMsg("修改分类失败");
                            goto IL_43B;

                        case NodeUpdateStatus.ExistsNodeName:
                            base.ShowMsg("已存在相同的分类名称");
                            goto IL_43B;

                        case NodeUpdateStatus.ExistsNodeIdentifier:
                            base.ShowMsg("已存在相同的分类标识");
                            goto IL_43B;

                        case NodeUpdateStatus.ExistsNodeDir:
                            break;

                        case NodeUpdateStatus.UnNodeSelf:
                            base.ShowMsg("不能做为自己的子分类");
                            goto IL_43B;

                        default:
                            if (nodeUpdateStatus2 == NodeUpdateStatus.Success)
                            {
                                PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改产品分类[" + categoryInfo.CategoryName + "] thành công");
                                base.Response.Redirect(string.Concat(new object[]
                                {
                                    "Category.aspx?CatalogID=",
                                    base.CurrentCatalogID,
                                    "&Module=",
                                    base.CurrentModuleCode,
                                    "&action=View"
                                }));
                                goto IL_43B;
                            }
                            break;
                        }
                        base.ShowMsg("Lỗi Unknown");
                        IL_43B :;
                    }
                }
            }
        }