Ejemplo n.º 1
0
 private void GetContModelXML()
 {
     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
     System.Collections.Generic.IList <ContModelInfo> cacheModelList = ContModel.GetCacheModelList();
     if (cacheModelList != null && cacheModelList.Count > 0)
     {
         foreach (ContModelInfo current in cacheModelList)
         {
             stringBuilder.Append(string.Concat(new object[]
             {
                 "{id:'",
                 current.AutoID.ToString(),
                 "',name:'",
                 current.ModelName,
                 "',isParent:false,'iconSkin':'leaf','click':\"AppendVal(",
                 current.AutoID,
                 ",'",
                 current.ModelName,
                 "')\"},"
             }));
         }
     }
     base.Response.Write("[" + stringBuilder.ToString().TrimEnd(new char[]
     {
         ','
     }) + "]");
 }
Ejemplo n.º 2
0
        private string NodeToXml(NodeInfo node)
        {
            System.Text.StringBuilder stringBuilder  = new System.Text.StringBuilder();
            ContModelInfo             cacheModelByID = ContModel.GetCacheModelByID(node.ModelID);

            stringBuilder.Append(string.Concat(new object[]
            {
                "<Node name=\"",
                node.NodeName,
                "\" id=\"",
                node.UrlRewriteName,
                "\" model=\"",
                cacheModelByID.ModelName,
                "\" ismenu=\"",
                node.IsShowOnMenu ? 1 : 0,
                "\" tpindex=\"",
                node.NodeSetting.TemplateOfNodeIndex,
                "\" tplist=\"",
                node.NodeSetting.TemplateOfNodeList,
                "\" tpdetail=\"",
                node.NodeSetting.TemplateOfNodeContent,
                "\">"
            }));
            if (node.ChildCount > 0)
            {
                foreach (NodeInfo current in SinGooCMS.BLL.Node.GetCacheChildNode(node.AutoID))
                {
                    stringBuilder.Append(this.NodeToXml(current));
                }
            }
            stringBuilder.Append("</Node>");
            return(stringBuilder.ToString());
        }
Ejemplo n.º 3
0
 private void BindModel()
 {
     this.DropDownList4.DataSource     = ContModel.GetCacheUsingModelList();
     this.DropDownList4.DataTextField  = "ModelName";
     this.DropDownList4.DataValueField = "AutoID";
     this.DropDownList4.DataBind();
 }
Ejemplo n.º 4
0
        public ActionResult AddAccount(ContModel cont)
        {
            if (ModelState.IsValid)
            {
                var newAccount = new ContDTO()
                {
                    Id             = Guid.NewGuid(),
                    AccountNumber  = cont.AccountNumber,
                    Currency       = cont.Currency,
                    MoneyDeposited = cont.MoneyDeposited,
                    User           = Session["Username"].ToString()
                };
                _writeRepo.adaugaCont(newAccount, Session["Username"].ToString());
                var userAccounts = _readRepo.CitesteConturi(Session["Username"].ToString());

                ModelState.Clear();
                if (userAccounts != null)
                {
                    List <ContModel> contModelList = new List <ContModel>();
                    foreach (ContDTO UserCont in userAccounts)
                    {
                        contModelList.Add(GenereazaContModelView(UserCont));
                    }
                    return(View("ShowAccounts", contModelList));
                }
            }
            return(View());
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            ContentInfo   currentContent = base.GetCurrentContent();
            NodeInfo      cacheNodeById  = SinGooCMS.BLL.Node.GetCacheNodeById((currentContent == null) ? 0 : currentContent.NodeID);
            ContModelInfo cacheModelByID = ContModel.GetCacheModelByID((currentContent == null) ? 0 : currentContent.ModelID);

            if (currentContent == null)
            {
                base.Response.Redirect("/Include/Error/ErrorMsg_404.htm");
            }
            else if (cacheNodeById == null)
            {
                base.Alert(base.GetCaption("CMS_NodeNotExist"), base.ResolveUrl("~/"));
            }
            else if (cacheNodeById.NodeSetting.NeedLogin)
            {
                if (base.UserID.Equals(-1))
                {
                    base.Alert(base.GetCaption("CMS_NodeNeedLoginToView"), "/User/LoginExpire.html?returnurl=" + HttpUtility.UrlEncode(base.Request.RawUrl));
                }
                else
                {
                    bool   flag  = !string.IsNullOrEmpty(cacheNodeById.NodeSetting.EnableViewUGroups);
                    bool   flag2 = !string.IsNullOrEmpty(cacheNodeById.NodeSetting.EnableViewULevel);
                    string text  = StringUtils.AppendStr(cacheNodeById.NodeSetting.EnableViewUGroups, ',');
                    string text2 = StringUtils.AppendStr(cacheNodeById.NodeSetting.EnableViewULevel, ',');
                    if (ConfigUtils.GetAppSetting <string>("ViewPurviewType") == ViewPurviewType.Superior.ToString())
                    {
                        ViewPurview viewPurview = new ViewPurview();
                        new ViewPurview().GetAccessPurview(cacheNodeById, ref viewPurview);
                        flag  = !string.IsNullOrEmpty(viewPurview.GroupPurview);
                        flag2 = !string.IsNullOrEmpty(viewPurview.LevelPurview);
                        text  = StringUtils.AppendStr(viewPurview.GroupPurview, ',');
                        text2 = StringUtils.AppendStr(viewPurview.LevelPurview, ',');
                    }
                    if (flag && !text.Contains("," + base.LoginUser.GroupID.ToString() + ","))
                    {
                        this.Alert(base.GetCaption("CMS_TheUserGroupAccessDenied"), "/");
                    }
                    else if (flag2 && !text2.Contains("," + base.LoginUser.LevelID.ToString() + ","))
                    {
                        this.Alert(base.GetCaption("CMS_TheUserLevelAccessDenied"), "/");
                    }
                    else
                    {
                        this.ShowTemplate(cacheNodeById, currentContent);
                    }
                }
            }
            else
            {
                this.ShowTemplate(cacheNodeById, currentContent);
            }
        }
Ejemplo n.º 6
0
        private void BindData()
        {
            int    recordCount = 0;
            int    num         = 0;
            string strSort     = "Sort asc, AutoID DESC ";

            this.SinGooPager1.PageSize = WebUtils.GetInt(this.drpPageSize.SelectedValue);
            this.Repeater1.DataSource  = ContModel.GetPagerData("*", this.GetCondition(), strSort, this.SinGooPager1.PageSize, this.SinGooPager1.PageIndex, ref recordCount, ref num);
            this.Repeater1.DataBind();
            this.SinGooPager1.RecordCount = recordCount;
        }
Ejemplo n.º 7
0
        private void InitForModify()
        {
            ContModelInfo dataById = ContModel.GetDataById(base.OpID);

            this.TextBox1.Text = dataById.ModelName;
            this.TextBox2.Text = dataById.TableName.Split(new char[]
            {
                '_'
            })[2];
            this.TextBox3.Text    = dataById.ModelDesc;
            this.TextBox2.Enabled = false;
        }
Ejemplo n.º 8
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.intModelID  = WebUtils.GetQueryInt("ModelID");
     this.modelParent = ContModel.GetCacheModelByID(this.intModelID);
     if (this.modelParent == null)
     {
         base.ShowMsg("没有找到内容模型信息");
     }
     else if (!base.IsPostBack)
     {
         this.BindData();
     }
 }
Ejemplo n.º 9
0
        protected void lnk_Delete_Click(object sender, System.EventArgs e)
        {
            if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
            {
                base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
            }
            else
            {
                int           @int           = WebUtils.GetInt((sender as LinkButton).CommandArgument);
                ContModelInfo cacheModelByID = ContModel.GetCacheModelByID(@int);
                if (cacheModelByID == null)
                {
                    base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa");
                }
                else
                {
                    ModelDeleteStatus modelDeleteStatus  = ContModel.Delete(@int);
                    ModelDeleteStatus modelDeleteStatus2 = modelDeleteStatus;
                    switch (modelDeleteStatus2)
                    {
                    case ModelDeleteStatus.Error:
                        base.ShowAjaxMsg(this.UpdatePanel1, "删除内容模型失败");
                        break;

                    case ModelDeleteStatus.ModelNotExists:
                        base.ShowAjaxMsg(this.UpdatePanel1, "模型不存在或者已经被删除");
                        break;

                    case ModelDeleteStatus.NodesRef:
                        base.ShowAjaxMsg(this.UpdatePanel1, "无法删除,模型正被栏目引用");
                        break;

                    case ModelDeleteStatus.ContentRef:
                        base.ShowAjaxMsg(this.UpdatePanel1, "无法删除,模型正被内容引用");
                        break;

                    default:
                        if (modelDeleteStatus2 == ModelDeleteStatus.Success)
                        {
                            this.BindData();
                            PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除内容模型[" + cacheModelByID.ModelName + "] thành công");
                            base.ShowAjaxMsg(this.UpdatePanel1, "删除内容模型成功");
                        }
                        break;
                    }
                }
            }
        }
Ejemplo n.º 10
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.intModelID  = WebUtils.GetQueryInt("ModelID");
     this.modelParent = ContModel.GetCacheModelByID(this.intModelID);
     if (this.modelParent == null)
     {
         base.ClientScript.RegisterClientScriptBlock(base.GetType(), "alertandredirect", "<script>alert('Không tìm thấy kiểu dữ liệu信息');history.go(-1);</script>");
     }
     else
     {
         this.labModelName.Text = this.modelParent.ModelName;
         if (base.IsEdit && !base.IsPostBack)
         {
             this.InitForModify();
         }
     }
 }
Ejemplo n.º 11
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.strType  = WebUtils.GetQueryString("ListType", "Normal");
     this.contNode = SinGooCMS.BLL.Node.GetCacheNodeById(WebUtils.GetQueryInt("NodeID"));
     if (base.IsEdit)
     {
         this.contInit = SinGooCMS.BLL.Content.GetContentById(base.OpID);
         this.contNode = SinGooCMS.BLL.Node.GetCacheNodeById((this.contInit == null) ? 0 : this.contInit.NodeID);
     }
     if (this.contNode == null)
     {
         base.ShowMsgAndRdirect("没有找到栏目信息", string.Concat(new object[]
         {
             "ContentList.aspx?CatalogID=",
             base.CurrentCatalogID,
             "&Module=",
             base.CurrentModuleCode,
             "&action=View&ListType=",
             this.strType
         }));
     }
     else if (base.IsEdit && this.contInit == null)
     {
         base.ShowMsgAndRdirect("没有找到内容信息", string.Concat(new object[]
         {
             "ContentList.aspx?CatalogID=",
             base.CurrentCatalogID,
             "&Module=",
             base.CurrentModuleCode,
             "&action=View&ListType=",
             this.strType
         }));
     }
     else
     {
         this.contModel = (base.IsEdit ? ContModel.GetCacheModelByID(this.contInit.ModelID) : ContModel.GetCacheModelByID(this.contNode.ModelID));
         if (!base.IsPostBack)
         {
             this.BindData();
         }
     }
 }
Ejemplo n.º 12
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
            {
                ContModelInfo contModelInfo = new ContModelInfo();
                if (base.IsEdit)
                {
                    contModelInfo = ContModel.GetCacheModelByID(base.OpID);
                }
                contModelInfo.ModelName = WebUtils.GetString(this.TextBox1.Text);
                contModelInfo.TableName = "cms_C_" + WebUtils.GetString(this.TextBox2.Text);
                contModelInfo.ModelDesc = WebUtils.GetString(this.TextBox3.Text);
                contModelInfo.IsUsing   = true;
                contModelInfo.Creator   = base.LoginAccount.AccountName;
                if (string.IsNullOrEmpty(contModelInfo.ModelName))
                {
                    base.ShowMsg("模型名称不能为空");
                }
                else if (string.IsNullOrEmpty(this.TextBox2.Text))
                {
                    base.ShowMsg("数据表名不能为空");
                }
                else
                {
                    if (base.Action.Equals(ActionType.Add.ToString()))
                    {
                        contModelInfo.AutoTimeStamp = System.DateTime.Now;
                        ModelAddState modelAddState  = ContModel.Add(contModelInfo);
                        ModelAddState modelAddState2 = modelAddState;
                        switch (modelAddState2)
                        {
                        case ModelAddState.Error:
                            base.ShowMsg("添加模型失败");
                            break;

                        case ModelAddState.ModelNameExists:
                            base.ShowMsg("模型名称已经存在");
                            break;

                        case ModelAddState.TableNameIsUsing:
                            base.ShowMsg("已经存在相同的自定义表名称");
                            break;

                        case ModelAddState.TableExists:
                            base.ShowMsg("自定义表已经存在");
                            break;

                        case ModelAddState.CreateTableError:
                            base.ShowMsg("创建自定义表失败");
                            break;

                        default:
                            if (modelAddState2 == ModelAddState.Success)
                            {
                                PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加模型[" + contModelInfo.ModelName + "] thành công");
                                MessageUtils.DialogCloseAndParentReload(this);
                            }
                            break;
                        }
                    }
                    if (base.Action.Equals(ActionType.Modify.ToString()))
                    {
                        if (ContModel.Update(contModelInfo))
                        {
                            PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改模型[" + contModelInfo.ModelName + "] thành công");
                            MessageUtils.DialogCloseAndParentReload(this);
                        }
                        else
                        {
                            base.ShowMsg("修改模型失败");
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private void AddNode(XmlNode node, int intParentID)
        {
            NodeInfo nodeInfo = (from p in SinGooCMS.BLL.Node.GetCacheAllNodes()
                                 where p.AutoID.Equals(intParentID)
                                 select p).FirstOrDefault <NodeInfo>();
            string strModelName = "普通文章";

            if (node.Attributes["model"] != null)
            {
                strModelName = node.Attributes["model"].Value.Trim();
            }
            ContModelInfo modelByName         = ContModel.GetModelByName(strModelName);
            string        templateOfNodeIndex = "栏目首页.html";

            if (node.Attributes["tpindex"] != null)
            {
                templateOfNodeIndex = node.Attributes["tpindex"].Value.Trim();
            }
            else if (nodeInfo != null)
            {
                templateOfNodeIndex = nodeInfo.NodeSetting.TemplateOfNodeIndex;
            }
            string templateOfNodeList = "栏目列表页.html";

            if (node.Attributes["tplist"] != null)
            {
                templateOfNodeList = node.Attributes["tplist"].Value.Trim();
            }
            else if (nodeInfo != null)
            {
                templateOfNodeList = nodeInfo.NodeSetting.TemplateOfNodeList;
            }
            string templateOfNodeContent = "栏目详情页.html";

            if (node.Attributes["tpdetail"] != null)
            {
                templateOfNodeContent = node.Attributes["tpdetail"].Value.Trim();
            }
            else if (nodeInfo != null)
            {
                templateOfNodeContent = nodeInfo.NodeSetting.TemplateOfNodeContent;
            }
            if (node.Attributes["name"] != null && modelByName != null)
            {
                string nodeName       = node.Attributes["name"].Value.Trim();
                string urlRewriteName = StringUtils.GetNewFileName();
                if (node.Attributes["id"] != null)
                {
                    urlRewriteName = node.Attributes["id"].Value.Trim();
                }
                bool isShowOnMenu = false;
                if (node.Attributes["ismenu"] != null)
                {
                    isShowOnMenu = (node.Attributes["ismenu"].Value.Trim() == "1");
                }
                NodeInfo nodeInfo2 = new NodeInfo();
                nodeInfo2.NodeName       = nodeName;
                nodeInfo2.UrlRewriteName = urlRewriteName;
                nodeInfo2.ParentID       = intParentID;
                nodeInfo2.ModelID        = modelByName.AutoID;
                nodeInfo2.NodeBanner     = string.Empty;
                nodeInfo2.SeoKey         = nodeInfo2.NodeName;
                nodeInfo2.SeoDescription = nodeInfo2.NodeName;
                nodeInfo2.Remark         = string.Empty;
                nodeInfo2.ItemPageSize   = 10;
                nodeInfo2.IsShowOnMenu   = isShowOnMenu;
                nodeInfo2.IsShowOnNav    = false;
                nodeInfo2.IsTop          = false;
                nodeInfo2.IsRecommend    = false;
                nodeInfo2.CustomLink     = string.Empty;
                nodeInfo2.Lang           = base.cultureLang;
                nodeInfo2.AutoTimeStamp  = System.DateTime.Now;
                nodeInfo2.NodeSetting.EnableAddInParent = true;
                nodeInfo2.NodeSetting.AllowComment      = true;
                nodeInfo2.NodeSetting.NeedLogin         = false;
                string empty = string.Empty;
                nodeInfo2.NodeSetting.EnableViewUGroups = empty;
                string empty2 = string.Empty;
                nodeInfo2.NodeSetting.EnableViewULevel      = empty2;
                nodeInfo2.NodeSetting.TemplateOfNodeIndex   = templateOfNodeIndex;
                nodeInfo2.NodeSetting.TemplateOfNodeList    = templateOfNodeList;
                nodeInfo2.NodeSetting.TemplateOfNodeContent = templateOfNodeContent;
                int num = 0;
                if (SinGooCMS.BLL.Node.Add(nodeInfo2, out num) == NodeAddStatus.Success)
                {
                    ContentInfo entity = new ContentInfo
                    {
                        NodeID        = num,
                        NodeName      = nodeInfo2.NodeName,
                        ModelID       = modelByName.AutoID,
                        TableName     = modelByName.TableName,
                        Title         = "栏目(" + nodeInfo2.NodeName + ")的测试标题",
                        Summary       = "栏目(" + nodeInfo2.NodeName + ")的测试摘要",
                        Content       = "栏目(" + nodeInfo2.NodeName + ")的测试内容",
                        Sort          = SinGooCMS.BLL.Content.MaxSort + 1,
                        Lang          = base.cultureLang,
                        Inputer       = base.LoginAccount.AccountName,
                        Status        = 99,
                        AutoTimeStamp = System.DateTime.Now
                    };
                    int num2 = SinGooCMS.BLL.Content.Add(entity);
                    if (num2 > 0)
                    {
                        System.Collections.Generic.IList <ContFieldInfo> customFieldListByModelID = ContField.GetCustomFieldListByModelID(modelByName.AutoID);
                        foreach (ContFieldInfo current in customFieldListByModelID)
                        {
                            if (current.FieldName == "ContID")
                            {
                                current.Value = num2.ToString();
                            }
                            else
                            {
                                current.Value = string.Empty;
                            }
                        }
                        SinGooCMS.BLL.Content.AddCustomContent(modelByName, customFieldListByModelID);
                    }
                    if (node.HasChildNodes)
                    {
                        foreach (XmlNode node2 in node.ChildNodes)
                        {
                            this.AddNode(node2, num);
                        }
                    }
                }
            }
        }
Ejemplo n.º 14
0
 public string GetModelName(int intModelID)
 {
     return(ContModel.GetCacheModelByID(intModelID).ModelName);
 }