internal MessageAndSerializerFunc(IRosMessage msg, TopicManager.SerializeFunc serfunc, bool ser, bool nc)
 {
     this.msg = msg;
     this.serfunc = serfunc;
     serialize = ser;
     nocopy = nc;
 }
 private static void WriteImageWithTopicLink(this MamlWriter writer, TopicManager topicManager, ArtItem artItem, XmlSchemaType type)
 {
     var topic = topicManager.GetTopic(type);
     if (topic != null)
     {
         writer.WriteHtmlArtItemWithTopicLink(artItem, topic);
     }
     else
     {
         writer.WriteHtmlArtItemWithText(artItem, type.QualifiedName.Name);
     }
 }
Exemplo n.º 3
0
        public Context(IMessageReporter messageReporter, Configuration configuration)
        {
            ProblemReporter = new ProblemReporter(messageReporter);
            Configuration = configuration;

            SchemaSetManager = new SchemaSetManager(this);
            SchemaSetManager.Initialize();

            SourceCodeManager = new SourceCodeManager(this);
            SourceCodeManager.Initialize();

            TopicManager = new TopicManager(this);
            TopicManager.Initialize();

            DocumentationManager = new DocumentationManager(this);
            DocumentationManager.Initialize();
        }
        public static void WriteTypeName(this MamlWriter writer, TopicManager topicManager, XmlSchemaType schemaType)
        {
            if (schemaType == null || schemaType == XmlSchemaType.GetBuiltInComplexType(XmlTypeCode.Item))
                return;

            XmlSchemaSimpleType simpleType;
            XmlSchemaComplexType complexType;

            if (Casting.TryCast(schemaType, out simpleType))
            {
                if (simpleType.QualifiedName.IsEmpty)
                    return;

                writer.WriteImageWithTopicLink(topicManager, ArtItem.SimpleType, simpleType);
                return;
            }

            if (Casting.TryCast(schemaType, out complexType))
            {
                if (!complexType.QualifiedName.IsEmpty)
                {
                    writer.WriteImageWithTopicLink(topicManager, ArtItem.ComplexType, complexType);
                    return;
                }

                var baseType = complexType.BaseXmlSchemaType;
                if (baseType == null || complexType.ContentModel == null)
                    return;

                var isExtension = complexType.ContentModel.Content is XmlSchemaComplexContentExtension ||
                                  complexType.ContentModel.Content is XmlSchemaSimpleContentExtension;

                var artItem = isExtension
                                ? ArtItem.Extension
                                : ArtItem.Restriction;

                writer.WriteImageWithTopicLink(topicManager, artItem, baseType);
                return;
            }

            throw ExceptionBuilder.UnexpectedSchemaObjectType(schemaType);
        }
Exemplo n.º 5
0
        protected void rptrLanguageDivs_SEO_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var txtMetaKeywords    = (TextBox)e.Item.FindControl("txtMetaKeywords");
                var txtMetaDescription = (TextBox)e.Item.FindControl("txtMetaDescription");
                var txtMetaTitle       = (TextBox)e.Item.FindControl("txtMetaTitle");
                var lblLanguageId      = (Label)e.Item.FindControl("lblLanguageId");

                if (this.TopicId > 0)
                {
                    int languageId = int.Parse(lblLanguageId.Text);

                    var content = TopicManager.GetLocalizedTopic(this.Topic.Name, languageId);
                    if (content != null)
                    {
                        txtMetaKeywords.Text    = content.MetaKeywords;
                        txtMetaDescription.Text = content.MetaDescription;
                        txtMetaTitle.Text       = content.MetaTitle;
                    }
                }
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BindView();
            string topname;

            if (!IsPostBack)
            {
                try
                {
                    if (Request.QueryString["top_name"] != null)
                    {
                        topname = Request.QueryString["top_name"].ToString();
                        TopicManager.delete(topname);
                        BindView();
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("错误原因:" + ex.Message);
                }
            }
        }
Exemplo n.º 7
0
 protected void SaveButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             Topic topic = TopicManager.GetTopicById(this.TopicId);
             if (topic != null)
             {
                 DateTime       nowDT          = DateTime.Now;
                 LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, this.LanguageId);
                 if (localizedTopic != null)
                 {
                     localizedTopic = TopicManager.UpdateLocalizedTopic(localizedTopic.TopicLocalizedId,
                                                                        localizedTopic.TopicId, localizedTopic.LanguageId, txtTitle.Text, txtBody.Content,
                                                                        localizedTopic.CreatedOn, nowDT, txtMetaKeywords.Text, txtMetaDescription.Text, txtMetaTitle.Text);
                     Response.Redirect("TopicLocalizedDetails.aspx?TopicID=" + localizedTopic.TopicId.ToString() + "&LanguageID=" + localizedTopic.LanguageId.ToString());
                 }
                 else
                 {
                     localizedTopic = TopicManager.InsertLocalizedTopic(this.TopicId,
                                                                        this.LanguageId, txtTitle.Text, txtBody.Content, nowDT, nowDT,
                                                                        txtMetaKeywords.Text, txtMetaDescription.Text, txtMetaTitle.Text);
                     Response.Redirect("TopicLocalizedDetails.aspx?TopicID=" + this.TopicId.ToString() + "&LanguageID=" + this.LanguageId.ToString());
                 }
             }
             else
             {
                 Response.Redirect("Topics.aspx");
             }
         }
         catch (Exception exc)
         {
             ProcessException(exc);
         }
     }
 }
Exemplo n.º 8
0
        private void BindData()
        {
            Language language = LanguageManager.GetLanguageByID(this.LanguageID);
            Topic    topic    = TopicManager.GetTopicByID(this.TopicID);

            if (language != null && topic != null)
            {
                this.lblLanguage.Text = language.Name;
                this.lblTopic.Text    = topic.Name;
                LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, this.LanguageID);
                if (localizedTopic != null)
                {
                    this.txtTitle.Text = localizedTopic.Title;
                    string topicURL = SEOHelper.GetTopicUrl(localizedTopic.TopicID, localizedTopic.Title);
                    this.hlURL.NavigateUrl = topicURL;
                    this.hlURL.Text        = topicURL;
                    this.txtBody.Value     = localizedTopic.Body;

                    this.pnlCreatedOn.Visible = true;
                    this.pnlUpdatedOn.Visible = true;
                    this.lblCreatedOn.Text    = DateTimeHelper.ConvertToUserTime(localizedTopic.CreatedOn).ToString();
                    this.lblUpdatedOn.Text    = DateTimeHelper.ConvertToUserTime(localizedTopic.UpdatedOn).ToString();
                    this.ShowOnHomePage.Value = localizedTopic.ShowOnHomePage;
                }
                else
                {
                    this.DeleteButton.Visible = false;

                    this.pnlCreatedOn.Visible = false;
                    this.pnlUpdatedOn.Visible = false;
                }
            }
            else
            {
                Response.Redirect("Topics.aspx");
            }
        }
        private static void WriteName(this MamlWriter writer, ChildEntry entry,
                                      TopicManager topicManager, int index)
        {
            switch (entry.ChildType)
            {
            case ChildType.Element:
            case ChildType.ElementExtension:
                var element     = (XmlSchemaElement)entry.Particle;
                var isExtension = (entry.ChildType == ChildType.ElementExtension);
                writer.WriteElementLink(topicManager, element,
                                        isExtension, index);
                break;

            case ChildType.Any:
                writer.WriteArtItemWithText(ArtItem.AnyElement,
                                            "Any", index);
                break;

            case ChildType.All:
                writer.WriteArtItemWithText(ArtItem.All, "All", index);
                break;

            case ChildType.Choice:
                writer.WriteArtItemWithText(ArtItem.Choice,
                                            "Choice", index);
                break;

            case ChildType.Sequence:
                writer.WriteArtItemWithText(ArtItem.Sequence,
                                            "Sequence", index);
                break;

            default:
                throw ExceptionBuilder.UnhandledCaseLabel(entry.ChildType);
            }
        }
Exemplo n.º 10
0
        protected void rptrLanguageDivs_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var txtTitle = (TextBox)e.Item.FindControl("txtTitle");
                var txtBody  = (AjaxControlToolkit.HTMLEditor.Editor)e.Item.FindControl("txtBody");
                var pnlUrl   = (HtmlTableRow)e.Item.FindControl("pnlUrl");
                var hlUrl    = (HyperLink)e.Item.FindControl("hlUrl");

                var lblLanguageId = (Label)e.Item.FindControl("lblLanguageId");

                int languageId = int.Parse(lblLanguageId.Text);

                if (this.TopicId > 0)
                {
                    var content = TopicManager.GetLocalizedTopic(this.Topic.Name, languageId);
                    if (content != null)
                    {
                        txtTitle.Text   = content.Title;
                        txtBody.Content = content.Body;
                        pnlUrl.Visible  = true;
                        string url = SEOHelper.GetTopicUrl(content.TopicId, content.Title);
                        hlUrl.Text        = url;
                        hlUrl.NavigateUrl = url;
                    }
                    else
                    {
                        pnlUrl.Visible = false;
                    }
                }
                else
                {
                    pnlUrl.Visible = false;
                }
            }
        }
        private static void WriteSingle(this MamlWriter writer, TopicManager topicManager,
                                        SimpleTypeStructureNode node, int indentLevel)
        {
            switch (node.NodeType)
            {
            case SimpleTypeStructureNodeType.Any:
                writer.WriteIndent(indentLevel);
                writer.WriteString("Any");
                break;

            case SimpleTypeStructureNodeType.Mixed:
                writer.WriteIndent(indentLevel);
                writer.WriteString("Mixed");
                break;

            case SimpleTypeStructureNodeType.NamedType:
                writer.WriteIndent(indentLevel);
                writer.WriteTypeName(topicManager, (XmlSchemaType)node.Node);
                break;

            case SimpleTypeStructureNodeType.List:
                writer.StartArtItem(ArtItem.List, indentLevel);
                writer.WriteTypeNamesMarkup(topicManager, node.Children);
                writer.EndArtItem();
                break;

            case SimpleTypeStructureNodeType.Union:
                writer.StartArtItem(ArtItem.Union, indentLevel);
                writer.WriteTypeNamesMarkup(topicManager, node.Children);
                writer.EndArtItem();
                break;

            default:
                throw ExceptionBuilder.UnhandledCaseLabel(node.NodeType);
            }
        }
Exemplo n.º 12
0
        public void Removing()
        {
            var topics = new TopicManager();

            Assert.AreEqual(0, topics.GetPeers("alpha").Count());

            topics.AddInterest("alpha", a);
            topics.AddInterest("alpha", b);
            Assert.AreEqual(2, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("alpha", a);
            Assert.AreEqual(b, topics.GetPeers("alpha").First());
            Assert.AreEqual(1, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("alpha", a);
            Assert.AreEqual(b, topics.GetPeers("alpha").First());
            Assert.AreEqual(1, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("alpha", b);
            Assert.AreEqual(0, topics.GetPeers("alpha").Count());

            topics.RemoveInterest("beta", b);
            Assert.AreEqual(0, topics.GetPeers("beta").Count());
        }
Exemplo n.º 13
0
 public TopicController(TopicManager topicManager)
 {
     this.topicManager = topicManager;
 }
Exemplo n.º 14
0
            public void Work(List <string> connectedUsers, Semaphore databaseSemaphore, Semaphore TopicManagerAccessSemaphore, Semaphore PrivateMessageManagerAccessSemaphore)
            {
                //vars used all over the work method

                //connection to the db
                var dbCon = new SQLiteConnection(@"uri=file:" + Globals.DB_PATH);
                //statement for sql requests
                string statement = "";
                //request maker and executer
                SQLiteCommand cmd;
                //request's result reader
                SQLiteDataReader rdr;

                while (KeepWorking)
                {
                    Message message = (Message)Communication.rcvMsg(Comm.GetStream());
                    Log.LogInfo(message.MessageType.ToString(), LogType.Comm_Input);
                    switch (message.MessageType)
                    {
                    case MessageType.Connection_Test:
                        break;

                    case MessageType.Connection_Success:
                        break;

                    case MessageType.SendMessage_To_Server:
                        break;

                    case MessageType.SendMessage_To_Client:
                        break;

                    case MessageType.Login:
                        string[] login_Password = message.MessageBody.Split(';');
                        databaseSemaphore.WaitOne();

                        dbCon.Open();

                        statement = "SELECT * FROM " + Globals.DB_TABLE_PROFILES + " WHERE " +
                                    Globals.DB_LOGIN + "='" + login_Password[0] + "' AND " +
                                    Globals.DB_PASSWORD + "='" + login_Password[1] + "'";

                        cmd = new SQLiteCommand(statement, dbCon);
                        rdr = cmd.ExecuteReader();

                        if (rdr.Read())
                        {
                            rdr.Close();
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Create_Account, "success"));
                            Log.LogInfo("login successful", LogType.Comm_Output);
                            User = login_Password[0];
                            PrivateMessageManagerAccessSemaphore.WaitOne();
                            PrivateMessageManager.GetLinkPMEventHandler(User).EventHandler += ClientLink_PrivateMessageEventHandler;
                            PrivateMessageManagerAccessSemaphore.Release();
                        }
                        else
                        {
                            rdr.Close();
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Create_Account, "error;login or password incorrect"));
                            Log.LogInfo("login failed", LogType.Comm_Output);
                        }

                        dbCon.Close();

                        databaseSemaphore.Release();

                        break;

                    case MessageType.Disconnect:
                        PrivateMessageManagerAccessSemaphore.WaitOne();
                        PrivateMessageManager.GetLinkPMEventHandler(User).EventHandler += ClientLink_PrivateMessageEventHandler;
                        PrivateMessageManager.RemoveLinkPMEventHandler(User);
                        User = null;
                        PrivateMessageManagerAccessSemaphore.Release();

                        break;

                    case MessageType.Create_Account:
                        string[] accountInfos = message.MessageBody.Split(' ');
                        databaseSemaphore.WaitOne();

                        dbCon.Open();

                        statement = "SELECT * FROM " + Globals.DB_TABLE_PROFILES + " WHERE " +
                                    Globals.DB_LOGIN + "='" + accountInfos[0] + "'";

                        cmd = new SQLiteCommand(statement, dbCon);
                        rdr = cmd.ExecuteReader();
                        if (rdr.Read())
                        {
                            rdr.Close();
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Create_Account, "error;login exists"));
                            Log.LogInfo("creation of account failed : login exists already", LogType.Comm_Output);
                        }
                        else
                        {
                            rdr.Close();
                            //add profile to database
                            cmd             = new SQLiteCommand(dbCon);
                            cmd.CommandText = "INSERT INTO " + Globals.DB_TABLE_PROFILES + " (" + Globals.DB_LOGIN + "," + Globals.DB_PASSWORD + ") VALUES(@login, @password)";
                            cmd.Parameters.AddWithValue("@login", accountInfos[0]);
                            cmd.Parameters.AddWithValue("@password", accountInfos[1]);
                            cmd.Prepare();
                            cmd.ExecuteNonQuery();
                            Log.LogInfo("creation of account successful", LogType.Application_Work);
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Create_Account, "success;profile created"));
                            Log.LogInfo("creation of account successful", LogType.Comm_Output);
                        }

                        dbCon.Close();

                        databaseSemaphore.Release();

                        PrivateMessageManagerAccessSemaphore.WaitOne();
                        PrivateMessageManager.GetLinkPMEventHandler(User).EventHandler += ClientLink_PrivateMessageEventHandler;
                        PrivateMessageManagerAccessSemaphore.Release();

                        break;

                    case MessageType.Update:
                        break;

                    case MessageType.Create_Topic:
                        databaseSemaphore.WaitOne();

                        dbCon.Open();

                        statement = "SELECT * FROM " + Globals.DB_TABLE_TOPICS + " WHERE " +
                                    Globals.DB_TOPICS_NAME + "='" + message.MessageBody + "'";
                        cmd = new SQLiteCommand(statement, dbCon);
                        rdr = cmd.ExecuteReader();
                        if (rdr.Read())
                        {
                            rdr.Close();
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Create_Topic, "error"));
                            //LOG
                        }
                        else
                        {
                            //add topic to db
                            cmd             = new SQLiteCommand(dbCon);
                            cmd.CommandText = "INSERT INTO " + Globals.DB_TABLE_TOPICS + " (" + Globals.DB_TOPICS_NAME + ") VALUES(@name)";
                            cmd.Parameters.AddWithValue("@name", message.MessageBody.Replace("'", "''"));
                            cmd.Prepare();
                            cmd.ExecuteNonQuery();
                            //LOG

                            //check topic id
                            statement = "SELECT " + Globals.DB_TOPICS_ID + " FROM " + Globals.DB_TABLE_TOPICS + " WHERE " +
                                        Globals.DB_TOPICS_NAME + "='" + message.MessageBody + "'";
                            cmd = new SQLiteCommand(statement, dbCon);
                            (rdr = cmd.ExecuteReader()).Read();

                            //create topic table
                            cmd             = new SQLiteCommand(dbCon);
                            cmd.CommandText = "CREATE TABLE IF NOT EXISTS topics_" + rdr.GetInt32(0) + "( 'idMessage' INTEGER PRIMARY KEY AUTOINCREMENT,'Date' TEXT,'User' TEXT,'Message' TEXT); ";
                            cmd.Prepare();
                            cmd.ExecuteNonQuery();
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Create_Topic, "success"));
                        }

                        dbCon.Close();

                        databaseSemaphore.Release();

                        message = (Message)Communication.rcvMsg(Comm.GetStream());

                        break;

                    case MessageType.List_Topic:
                        databaseSemaphore.WaitOne();

                        dbCon.Open();

                        statement = "SELECT * FROM " + Globals.DB_TABLE_TOPICS;
                        cmd       = new SQLiteCommand(statement, dbCon);
                        rdr       = cmd.ExecuteReader();
                        while (rdr.Read())
                        {
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.List_Topic, rdr.GetInt32(0) + ";" + rdr.GetString(1)));
                            //LOG
                        }
                        Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Join_Topic));
                        //LOG
                        rdr.Close();
                        dbCon.Close();

                        databaseSemaphore.Release();
                        break;

                    case MessageType.Join_Topic:
                        databaseSemaphore.WaitOne();

                        dbCon.Open();

                        statement = "SELECT * FROM " + Globals.DB_TABLE_TOPICS + " WHERE " +
                                    Globals.DB_TOPICS_ID + "='" + message.MessageBody + "'";
                        cmd = new SQLiteCommand(statement, dbCon);
                        rdr = cmd.ExecuteReader();
                        rdr.Read();
                        //send topic name again, should clean this up in client
                        Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Join_Topic, rdr.GetString(1)));
                        //LOG
                        statement = "SELECT * FROM topics_" + message.MessageBody;
                        cmd       = new SQLiteCommand(statement, dbCon);
                        rdr       = cmd.ExecuteReader();
                        while (rdr.Read())
                        {
                            //chat format : User : date     text
                            Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Join_Topic, rdr.GetString(2) + ":" + rdr.GetString(1) + "\t" + rdr.GetString(3)));
                            //LOG
                        }
                        rdr.Close();
                        dbCon.Close();

                        databaseSemaphore.Release();
                        Communication.sendMsg(Comm.GetStream(), new Message(MessageType.Chat_Topic));
                        //LOG

                        //store topic id for later use
                        CurrentTopic = message.MessageBody;

                        TopicManagerAccessSemaphore.WaitOne();
                        TopicManager.GetTopicEventHandler(CurrentTopic).EventHandler += ClientLink_TopicEventHandler;
                        TopicManagerAccessSemaphore.Release();

                        break;

                    case MessageType.Chat_Topic:
                        Console.WriteLine(message.MessageBody);
                        string[] topicID_messageBody = message.MessageBody.Split(';');
                        DateTime dateTime            = DateTime.Now;

                        /*
                         * databaseSemaphore.WaitOne();
                         *
                         * dbCon.Open();
                         *
                         * //add messsage to db
                         * //doesn't work for some reasons ...
                         * cmd = new SQLiteCommand(dbCon);
                         * cmd.CommandText = "INSERT INTO topics_" + topicID_messageBody[0] + "('Date','User','Message') VALUES('@date','@user','@message')";
                         * cmd.Parameters.AddWithValue("@date", dateTime.Date.ToString());
                         * cmd.Parameters.AddWithValue("@user", User);
                         * cmd.Parameters.AddWithValue("@message", topicID_messageBody[1].Replace("'", "''"));
                         * cmd.Prepare();
                         * cmd.ExecuteNonQuery();
                         *
                         * dbCon.Close();
                         *
                         * databaseSemaphore.Release();
                         */
                        TopicManagerAccessSemaphore.WaitOne();
                        TopicManager.TopicEventManager[CurrentTopic].NewMessageEvent(User, dateTime, topicID_messageBody[1]);
                        TopicManagerAccessSemaphore.Release();

                        break;

                    case MessageType.leave_topic:
                        TopicManagerAccessSemaphore.WaitOne();
                        TopicManager.GetTopicEventHandler(CurrentTopic).EventHandler -= ClientLink_TopicEventHandler;
                        TopicManagerAccessSemaphore.Release();
                        CurrentTopic = null;
                        break;

                    case MessageType.Chat_PrivateMessage:
                        string[] User_messageBody = message.MessageBody.Split(';');
                        dateTime = DateTime.Now;
                        PrivateMessageManagerAccessSemaphore.WaitOne();
                        PrivateMessageManager.PrivateMessageEventManager[User_messageBody[0]].NewMessageEvent(User, dateTime, User_messageBody[1], User_messageBody[0]);
                        PrivateMessageManagerAccessSemaphore.Release();
                        break;

                    default:
                        break;
                    }
                }
            }
Exemplo n.º 15
0
        public Topic SaveInfo()
        {
            //system info
            Topic topic = TopicManager.GetTopicById(this.TopicId);

            if (topic != null)
            {
                topic = TopicManager.UpdateTopic(topic.TopicId, txtSystemName.Text,
                                                 cbIsPasswordProtected.Checked, txtPassword.Text.Trim(), cbIncludeInSitemap.Checked);
            }
            else
            {
                topic = TopicManager.InsertTopic(txtSystemName.Text,
                                                 cbIsPasswordProtected.Checked, txtPassword.Text.Trim(), cbIncludeInSitemap.Checked);
            }


            //localizable info
            DateTime nowDT = DateTime.UtcNow;

            foreach (RepeaterItem item in rptrLanguageDivs.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    var txtTitle      = (TextBox)item.FindControl("txtTitle");
                    var txtBody       = (AjaxControlToolkit.HTMLEditor.Editor)item.FindControl("txtBody");
                    var lblLanguageId = (Label)item.FindControl("lblLanguageId");

                    int    languageId = int.Parse(lblLanguageId.Text);
                    string title      = txtTitle.Text;
                    string body       = txtBody.Content;

                    var content = TopicManager.GetLocalizedTopic(topic.Name, languageId);
                    if (content == null)
                    {
                        content = TopicManager.InsertLocalizedTopic(topic.TopicId,
                                                                    languageId, title, body, nowDT, nowDT,
                                                                    string.Empty, string.Empty, string.Empty);
                    }
                    else
                    {
                        content = TopicManager.UpdateLocalizedTopic(content.TopicLocalizedId,
                                                                    content.TopicId, content.LanguageId, title, body,
                                                                    content.CreatedOn, nowDT, content.MetaKeywords,
                                                                    content.MetaDescription, content.MetaTitle);
                    }
                }
            }
            foreach (RepeaterItem item in rptrLanguageDivs_SEO.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    var txtMetaKeywords    = (TextBox)item.FindControl("txtMetaKeywords");
                    var txtMetaDescription = (TextBox)item.FindControl("txtMetaDescription");
                    var txtMetaTitle       = (TextBox)item.FindControl("txtMetaTitle");
                    var lblLanguageId      = (Label)item.FindControl("lblLanguageId");

                    int    languageId      = int.Parse(lblLanguageId.Text);
                    string metaKeywords    = txtMetaKeywords.Text;
                    string metaDescription = txtMetaDescription.Text;
                    string metaTitle       = txtMetaTitle.Text;

                    var content = TopicManager.GetLocalizedTopic(topic.Name, languageId);
                    if (content == null)
                    {
                        //localized topic should be already created in previous step
                    }
                    else
                    {
                        content = TopicManager.UpdateLocalizedTopic(content.TopicLocalizedId,
                                                                    content.TopicId, content.LanguageId, content.Title, content.Body,
                                                                    content.CreatedOn, nowDT, metaKeywords,
                                                                    metaDescription, metaTitle);
                    }
                }
            }

            return(topic);
        }
Exemplo n.º 16
0
 public NewsController(TopicManager topicManager, NewsManager newsManager)
 {
     _topics = topicManager;
     _news   = newsManager;
 }
 private static void WriteElementLink(this MamlWriter writer, TopicManager topicManager, XmlSchemaElement element, bool isExtension)
 {
     var artItem = element.RefName.IsEmpty && !isExtension
                     ? ArtItem.Element
                     : ArtItem.ElementRef;
     var topic = topicManager.GetTopic(element);
     if (topic != null)
         writer.WriteHtmlArtItemWithTopicLink(artItem, topic);
     else
         writer.WriteHtmlArtItemWithText(artItem, element.QualifiedName.Name);
 }
Exemplo n.º 18
0
 protected void BindTopwlkh()
 {
     huatiView4.DataSource = TopicManager.topwlkh();
     huatiView4.DataBind();
 }
 private static void WriteSingle(this MamlWriter writer, TopicManager topicManager, SimpleTypeStructureNode node)
 {
     switch (node.NodeType)
     {
         case SimpleTypeStructureNodeType.Any:
             writer.WriteString("Any");
             break;
         case SimpleTypeStructureNodeType.Mixed:
             writer.WriteString("Mixed");
             break;
         case SimpleTypeStructureNodeType.NamedType:
             writer.WriteTypeName(topicManager, (XmlSchemaType)node.Node);
             break;
         case SimpleTypeStructureNodeType.List:
             writer.StartHtmlArtItem(ArtItem.List);
             writer.WriteTypeNamesMarkup(topicManager, node.Children);
             writer.EndHtmlArtItem();
             break;
         case SimpleTypeStructureNodeType.Union:
             writer.StartHtmlArtItem(ArtItem.Union);
             writer.WriteTypeNamesMarkup(topicManager, node.Children);
             writer.EndHtmlArtItem();
             break;
         default:
             throw ExceptionBuilder.UnhandledCaseLabel(node.NodeType);
     }
 }
 private static void WriteConstructorItemAndFacet(this MamlWriter writer, int level, TopicManager topicManager, SimpleTypeStructureNode node)
 {
     switch (node.NodeType)
     {
         case SimpleTypeStructureNodeType.Restriction:
             writer.WriteConstructor(level, topicManager, node, ArtItem.Restriction, "Restriction");
             break;
         case SimpleTypeStructureNodeType.List:
             writer.WriteConstructor(level, topicManager, node, ArtItem.List, "List");
             break;
         case SimpleTypeStructureNodeType.Union:
             writer.WriteConstructor(level, topicManager, node, ArtItem.Union, "Union");
             break;
         case SimpleTypeStructureNodeType.FacetEnumeration:
             writer.WriteFacet(level, node, "Enumeration");
             break;
         case SimpleTypeStructureNodeType.FacetMaxExclusive:
             writer.WriteFacet(level, node, "Max Exclusive");
             break;
         case SimpleTypeStructureNodeType.FacetMaxInclusive:
             writer.WriteFacet(level, node, "Max Inclusive");
             break;
         case SimpleTypeStructureNodeType.FacetMinExclusive:
             writer.WriteFacet(level, node, "Min Exclusive");
             break;
         case SimpleTypeStructureNodeType.FacetMinInclusive:
             writer.WriteFacet(level, node, "Min Inclusive");
             break;
         case SimpleTypeStructureNodeType.FacetFractionDigits:
             writer.WriteFacet(level, node, "Fraction Digits");
             break;
         case SimpleTypeStructureNodeType.FacetLength:
             writer.WriteFacet(level, node, "Length");
             break;
         case SimpleTypeStructureNodeType.FacetMaxLength:
             writer.WriteFacet(level, node, "Max Length");
             break;
         case SimpleTypeStructureNodeType.FacetMinLength:
             writer.WriteFacet(level, node, "Min Length");
             break;
         case SimpleTypeStructureNodeType.FacetTotalDigits:
             writer.WriteFacet(level, node, "Total Digits");
             break;
         case SimpleTypeStructureNodeType.FacetPattern:
             writer.WriteFacet(level, node, "Pattern");
             break;
         case SimpleTypeStructureNodeType.FacetWhiteSpace:
             writer.WriteFacet(level, node, "White Space");
             break;
         default:
             throw ExceptionBuilder.UnhandledCaseLabel(node.NodeType);
     }
 }
Exemplo n.º 21
0
 internal void Load(TopicManager topicManager)
 {
     Clear();
     AddEntries(topicManager.Topics);
 }
Exemplo n.º 22
0
 public HomeController(OracleSession session)
 {
     _topics = new TopicManager(session.Connection);
 }
Exemplo n.º 23
0
 public PostController(TopicManager topic)
 {
     _topic = topic;
 }
        private static void WriteAttributeTopicLink(this MamlWriter writer, TopicManager topicManager, XmlSchemaAttribute attribute, bool isExtension)
        {
            var artItem = attribute.RefName.IsEmpty && !isExtension
                            ? ArtItem.Attribute
                            : ArtItem.AttributeRef;

            var topic = topicManager.GetTopic(attribute);
            if (topic != null)
                writer.WriteHtmlArtItemWithTopicLink(artItem, topic);
            else
                writer.WriteHtmlArtItemWithText(artItem, attribute.QualifiedName.Name);
        }
Exemplo n.º 25
0
 public TopicController(OracleSession session)
 {
     _topics = new TopicManager(session.Connection);
     _users  = new UserManager(session.Connection);
 }
Exemplo n.º 26
0
 protected void BindTopxdww()
 {
     huatiView3.DataSource = TopicManager.topxdww();
     huatiView3.DataBind();
 }
 private static void WriteSingleItemAndFacet(this MamlWriter writer, int level, TopicManager topicManager, SimpleTypeStructureNode node)
 {
     writer.StartTableRowEntry();
     writer.WriteHtmlIndent(level);
     writer.WriteSingle(topicManager, node);
     writer.EndTableRowEntry();
     writer.StartTableRowEntry();
     writer.EndTableRowEntry();
 }
Exemplo n.º 28
0
 protected void BindTopqcxs()
 {
     huatiView5.DataSource = TopicManager.topqcxs();
     huatiView5.DataBind();
 }
        private static void WriteTypeNamesMarkup(this MamlWriter writer, TopicManager topicManager, IEnumerable<SimpleTypeStructureNode> children)
        {
            var isFirst = true;
            foreach (var node in children)
            {
                if (node.NodeType != SimpleTypeStructureNodeType.NamedType)
                    continue;

                if (isFirst)
                    isFirst = false;
                else
                    writer.WriteString(", ");

                var simpleType = (XmlSchemaSimpleType)node.Node;
                var topic = topicManager.GetTopic(simpleType);

                if (topic != null)
                    writer.WriteHtmlTopicLink(topic);
                else
                    writer.WriteString(simpleType.QualifiedName.Name);
            }
        }
 private static void WriteName(this MamlWriter writer, ChildEntry entry, TopicManager topicManager)
 {
     switch (entry.ChildType)
     {
         case ChildType.Element:
         case ChildType.ElementExtension:
             var element = (XmlSchemaElement)entry.Particle;
             var isExtension = (entry.ChildType == ChildType.ElementExtension);
             writer.WriteElementLink(topicManager, element, isExtension);
             break;
         case ChildType.Any:
             writer.WriteHtmlArtItemWithText(ArtItem.AnyElement, "Any");
             break;
         case ChildType.All:
             writer.WriteHtmlArtItemWithText(ArtItem.All, "All");
             break;
         case ChildType.Choice:
             writer.WriteHtmlArtItemWithText(ArtItem.Choice, "Choice");
             break;
         case ChildType.Sequence:
             writer.WriteHtmlArtItemWithText(ArtItem.Sequence, "Sequence");
             break;
         default:
             throw ExceptionBuilder.UnhandledCaseLabel(entry.ChildType);
     }
 }
 private static void WriteConstructor(this MamlWriter writer, int level, TopicManager topicManager, SimpleTypeStructureNode node, ArtItem constructionArtItem, string constructName)
 {
     writer.StartTableRowEntry();
     writer.WriteHtmlIndent(level);
     writer.StartHtmlArtItem(constructionArtItem);
     if (ContainsNamedTypes(node.Children))
         writer.WriteTypeNamesMarkup(topicManager, node.Children);
     else
         writer.WriteString(constructName);
     writer.EndHtmlArtItem();
     writer.EndTableRowEntry();
     writer.StartTableRowEntry();
     writer.EndTableRowEntry();
 }
Exemplo n.º 32
0
        protected void BindData()
        {
            StringBuilder warningResult = new StringBuilder();

            if (CurrencyManager.PrimaryExchangeRateCurrency == null)
            {
                warningResult.Append("Primary exchange rate currency is not set. <a href=\"Currencies.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            if (CurrencyManager.PrimaryStoreCurrency == null)
            {
                warningResult.Append("Primary store currency is not set. <a href=\"Currencies.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            if (MeasureManager.BaseWeightIn == null)
            {
                warningResult.Append("The weight that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            if (MeasureManager.BaseDimensionIn == null)
            {
                warningResult.Append("The dimension that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            LanguageCollection publishedLanguages = LanguageManager.GetAllLanguages(false);

            foreach (MessageTemplate messageTemplate in MessageManager.GetAllMessageTemplates())
            {
                foreach (Language language in publishedLanguages)
                {
                    LocalizedMessageTemplate localizedMessageTemplate = MessageManager.GetLocalizedMessageTemplate(messageTemplate.Name, language.LanguageID);
                    if (localizedMessageTemplate == null)
                    {
                        warningResult.AppendFormat("You don't have localized version of message template [{0}] for {1}. <a href=\"MessageTemplates.aspx\">Create it now</a>", messageTemplate.Name, language.Name);
                        warningResult.Append("<br />");
                        warningResult.Append("<br />");
                    }
                }
            }

            foreach (Topic topic in TopicManager.GetAllTopics())
            {
                foreach (Language language in publishedLanguages)
                {
                    LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, language.LanguageID);
                    if (localizedTopic == null)
                    {
                        warningResult.AppendFormat("You don't have localized version of topic [{0}] for {1}. <a href=\"Topics.aspx\">Create it now</a>", topic.Name, language.Name);
                        warningResult.Append("<br />");
                        warningResult.Append("<br />");
                    }
                }
            }

            string warnings = warningResult.ToString();

            if (!String.IsNullOrEmpty(warnings))
            {
                lblWarnings.Text = warnings;
            }
            else
            {
                this.Visible = false;
            }
        }
Exemplo n.º 33
0
 public GameThoughtsAndCrosses(IShuffleHelper <string> shuffleHelper)
 {
     _shuffleHelper = shuffleHelper;
     Letter         = new LetterManager(_shuffleHelper);
     Topics         = new TopicManager(_shuffleHelper);
 }
 private static void WriteSingleItemAndFacet(this MamlWriter writer, int level, TopicManager topicManager, SimpleTypeStructureNode node)
 {
     writer.StartTableRowEntry();
     writer.WriteHtmlIndent(level);
     writer.WriteSingle(topicManager, node);
     writer.EndTableRowEntry();
     writer.StartTableRowEntry();
     writer.EndTableRowEntry();
 }
Exemplo n.º 35
0
 public HomeController(TopicManager post)
 {
     _topic = post;
 }
Exemplo n.º 36
0
 public DictionaryManagerController(IDataRepository <Topic> _TopicManager, IDataRepository <Vocabulary> _VocabularyManager)
 {
     this._TopicManager      = _TopicManager as TopicManager;
     this._VocabularyManager = _VocabularyManager as VocabularyManager;
 }
Exemplo n.º 37
0
        public TopicManagerTests()
        {
            var shuffleHelper = new ShuffleHelper <string>();

            _topicManager = new TopicManager(shuffleHelper);
        }
Exemplo n.º 38
0
 protected void bind()
 {
     Repeater1.DataSource = TopicManager.Stopid(int.Parse(Request.QueryString["top_id"]));
     Repeater1.DataBind();
 }
Exemplo n.º 39
0
 private void Awake()
 {
     instance = this;
 }
        private static void WriteConstructorItemAndFacet(this MamlWriter writer,
                                                         int level, TopicManager topicManager, SimpleTypeStructureNode node)
        {
            switch (node.NodeType)
            {
            case SimpleTypeStructureNodeType.Restriction:
                writer.WriteConstructor(level, topicManager, node, ArtItem.Restriction, "Restriction");
                break;

            case SimpleTypeStructureNodeType.List:
                writer.WriteConstructor(level, topicManager, node, ArtItem.List, "List");
                break;

            case SimpleTypeStructureNodeType.Union:
                writer.WriteConstructor(level, topicManager, node, ArtItem.Union, "Union");
                break;

            case SimpleTypeStructureNodeType.FacetEnumeration:
                writer.WriteFacet(level, node, "Enumeration");
                break;

            case SimpleTypeStructureNodeType.FacetMaxExclusive:
                writer.WriteFacet(level, node, "Max Exclusive");
                break;

            case SimpleTypeStructureNodeType.FacetMaxInclusive:
                writer.WriteFacet(level, node, "Max Inclusive");
                break;

            case SimpleTypeStructureNodeType.FacetMinExclusive:
                writer.WriteFacet(level, node, "Min Exclusive");
                break;

            case SimpleTypeStructureNodeType.FacetMinInclusive:
                writer.WriteFacet(level, node, "Min Inclusive");
                break;

            case SimpleTypeStructureNodeType.FacetFractionDigits:
                writer.WriteFacet(level, node, "Fraction Digits");
                break;

            case SimpleTypeStructureNodeType.FacetLength:
                writer.WriteFacet(level, node, "Length");
                break;

            case SimpleTypeStructureNodeType.FacetMaxLength:
                writer.WriteFacet(level, node, "Max Length");
                break;

            case SimpleTypeStructureNodeType.FacetMinLength:
                writer.WriteFacet(level, node, "Min Length");
                break;

            case SimpleTypeStructureNodeType.FacetTotalDigits:
                writer.WriteFacet(level, node, "Total Digits");
                break;

            case SimpleTypeStructureNodeType.FacetPattern:
                writer.WriteFacet(level, node, "Pattern");
                break;

            case SimpleTypeStructureNodeType.FacetWhiteSpace:
                writer.WriteFacet(level, node, "White Space");
                break;

            default:
                throw ExceptionBuilder.UnhandledCaseLabel(node.NodeType);
            }
        }
Exemplo n.º 41
0
 protected void Bindhuati()
 {
     huatiView.DataSource = TopicManager.alltop();
     huatiView.DataBind();
 }
Exemplo n.º 42
0
        protected override void OnPreRender(EventArgs e)
        {
            StringBuilder warningResult = new StringBuilder();

            //currencies
            if (CurrencyManager.PrimaryExchangeRateCurrency == null)
            {
                warningResult.Append("Primary exchange rate currency is not set. <a href=\"Currencies.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }
            if (CurrencyManager.PrimaryStoreCurrency == null)
            {
                warningResult.Append("Primary store currency is not set. <a href=\"Currencies.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            //measures
            if (MeasureManager.BaseWeightIn == null)
            {
                warningResult.Append("The weight that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }
            if (MeasureManager.BaseDimensionIn == null)
            {
                warningResult.Append("The dimension that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            //languages
            LanguageCollection publishedLanguages = LanguageManager.GetAllLanguages(false);

            foreach (MessageTemplate messageTemplate in MessageManager.GetAllMessageTemplates())
            {
                foreach (Language language in publishedLanguages)
                {
                    LocalizedMessageTemplate localizedMessageTemplate = MessageManager.GetLocalizedMessageTemplate(messageTemplate.Name, language.LanguageId);
                    if (localizedMessageTemplate == null)
                    {
                        warningResult.AppendFormat("You don't have localized version of message template [{0}] for {1}. <a href=\"MessageTemplates.aspx\">Create it now</a>", messageTemplate.Name, language.Name);
                        warningResult.Append("<br />");
                        warningResult.Append("<br />");
                    }
                }
            }
            foreach (Topic topic in TopicManager.GetAllTopics())
            {
                foreach (Language language in publishedLanguages)
                {
                    LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, language.LanguageId);
                    if (localizedTopic == null)
                    {
                        warningResult.AppendFormat("You don't have localized version of topic [{0}] for {1}. <a href=\"Topics.aspx\">Create it now</a>", topic.Name, language.Name);
                        warningResult.Append("<br />");
                        warningResult.Append("<br />");
                    }
                }
            }

            //shipping methods
            var srcmList         = ShippingRateComputationMethodManager.GetAllShippingRateComputationMethods(false);
            int offlineSrcmCount = 0;

            foreach (var srcm in srcmList)
            {
                if (srcm.ShippingRateComputationMethodType == ShippingRateComputationMethodTypeEnum.Offline)
                {
                    offlineSrcmCount++;
                }
            }
            if (offlineSrcmCount > 1)
            {
                warningResult.Append("Only one offline shipping rate computation method is recommended to use");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            string warnings = warningResult.ToString();

            if (!String.IsNullOrEmpty(warnings))
            {
                lblWarnings.Text = warnings;
            }
            else
            {
                this.Visible = false;
            }

            base.OnPreRender(e);
        }
Exemplo n.º 43
0
 protected void Bindtopctwx()
 {
     huatiView2.DataSource = TopicManager.topctwx();
     huatiView2.DataBind();
 }