当前位置: 首页>>代码示例>>C#>>正文


C# Side.ToString方法代码示例

本文整理汇总了C#中Side.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Side.ToString方法的具体用法?C# Side.ToString怎么用?C# Side.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Side的用法示例。


在下文中一共展示了Side.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddWord

        public void AddWord(int id, Side side, WordType type, IWord word)
        {
            if (word != null && word.Word.Length > 0)
            {
                using (NpgsqlConnection con = PostgreSQLConn.CreateConnection(Parent.CurrentUser))
                {
                    using (NpgsqlCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = "SELECT \"InsertWordIfNotExists\"(:id,:cardid,:isdefault,:text,:side,:type);";
                        cmd.Parameters.Add("id", word.Id);
                        cmd.Parameters.Add("isdefault", word.Default);
                        cmd.Parameters.Add("cardid", id);
                        cmd.Parameters.Add("text", word.Word);
                        cmd.Parameters.Add("side", side.ToString());
                        cmd.Parameters.Add("type", type.ToString());
                        PostgreSQLConn.ExecuteNonQuery(cmd, Parent.CurrentUser);

                        Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(ObjectLifetimeIdentifier.GetCacheObject(side, type), id));
                    }
                }
            }
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:22,代码来源:PgSqlWordsConnector.cs

示例2: AddWords

        public void AddWords(int id, Side side, WordType type, List<IWord> words)
        {
            if (words.Count > 0)
            {
                using (NpgsqlConnection con = PostgreSQLConn.CreateConnection(Parent.CurrentUser))
                {
                    using (NpgsqlCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = string.Empty;
                        int paramnum = 0;
                        string textparamname, idparametername, isdefaultparametername;
                        foreach (IWord word in words)
                        {
                            if (word != null && word.Word.Length > 0)
                            {
                                paramnum++;
                                textparamname = string.Format("text{0}", paramnum);
                                idparametername = string.Format("id{0}", paramnum);
                                isdefaultparametername = string.Format("isdefault{0}", paramnum);

                                cmd.CommandText += string.Format("SELECT \"InsertWordIfNotExists\"(:{0},:cardid,:{1},:{2},:side,:type);",
                                    idparametername, isdefaultparametername, textparamname);

                                cmd.Parameters.Add(textparamname, word.Word);
                                cmd.Parameters.Add(idparametername, word.Id);
                                cmd.Parameters.Add(isdefaultparametername, word.Default);
                            }
                        }

                        cmd.Parameters.Add("cardid", id);
                        cmd.Parameters.Add("side", side.ToString());
                        cmd.Parameters.Add("type", type.ToString());
                        PostgreSQLConn.ExecuteNonQuery(cmd, Parent.CurrentUser);

                        Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(ObjectLifetimeIdentifier.GetCacheObject(side, type), id));
                    }
                }
            }
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:39,代码来源:PgSqlWordsConnector.cs

示例3: ClearAllWords

        public void ClearAllWords(int id, Side side, WordType type)
        {
            using (NpgsqlConnection con = PostgreSQLConn.CreateConnection(Parent.CurrentUser))
            {
                using (NpgsqlCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = "DELETE FROM \"TextContent\" WHERE cards_id=:id AND side=:side AND type=:type";
                    cmd.Parameters.Add("id", id);
                    cmd.Parameters.Add("side", side.ToString());
                    cmd.Parameters.Add("type", type.ToString());
                    PostgreSQLConn.ExecuteNonQuery(cmd, Parent.CurrentUser);

                    Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(ObjectLifetimeIdentifier.GetCacheObject(side, type), id));
                }
            }
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:16,代码来源:PgSqlWordsConnector.cs

示例4: CreateNewWord

        public IWord CreateNewWord(int id, string word, Side side, WordType type, bool isDefault)
        {
            if (word != null)
            {
                using (NpgsqlConnection con = PostgreSQLConn.CreateConnection(Parent.CurrentUser))
                {
                    using (NpgsqlCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = "INSERT INTO \"TextContent\" (cards_id, text, side, type, position, is_default) VALUES (:id, :text, :side, :type, " +
                            "(COALESCE((SELECT position FROM \"TextContent\" WHERE cards_id=:id AND side=:side AND type=:type ORDER BY position DESC LIMIT 1), 0) + 10), " +
                            ":isdefault) RETURNING id";
                        cmd.Parameters.Add("id", id);
                        cmd.Parameters.Add("text", word);
                        cmd.Parameters.Add("side", side.ToString());
                        cmd.Parameters.Add("type", type.ToString());
                        cmd.Parameters.Add("isdefault", isDefault);

                        Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(ObjectLifetimeIdentifier.GetCacheObject(side, type), id));

                        return new DbWord(Convert.ToInt32(PostgreSQLConn.ExecuteScalar(cmd, Parent.CurrentUser)), word, type, isDefault, Parent);
                    }
                }
            }
            else
                return null;
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:26,代码来源:PgSqlWordsConnector.cs

示例5: RemoveMediaNodes

 /// <summary>
 /// Removes the media nodes.
 /// </summary>
 /// <param name="media">The media.</param>
 /// <param name="side">The side.</param>
 /// <remarks>Documented by Dev03, 2007-08-07</remarks>
 private void RemoveMediaNodes(IMedia media, Side side)
 {
     string tagPrefix = side.ToString().ToLower();
     //remove existing media nodes with the same file path
     string xpath = String.Format("{0}audio[text() = '{1}']|{0}exampleaudio[text() = '{1}']|{0}image[text() = '{1}']|{0}video[text() = '{1}']|unusedmedia[text() = '{1}']",
         tagPrefix, media.Filename.Replace("'", "&apos;"));
     foreach (XmlNode existingNode in m_card.SelectNodes(xpath))
         existingNode.ParentNode.RemoveChild(existingNode);
     Initialize();   //reload the question/answer media lists
 }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:16,代码来源:XmlCard.cs

示例6: GenerateCard

        /// <summary>
        /// Generates the card.
        /// </summary>
        /// <param name="card">The card.</param>
        /// <param name="side">The side.</param>
        /// <param name="answer">The answer.</param>
        /// <param name="correct">if set to <c>true</c> [correct].</param>
        /// <returns></returns>
        /// <remarks>Documented by Dev05, 2008-01-04</remarks>
        public string GenerateCard(Card card, Side side, string answer, bool correct)
        {
            XmlNode cardNode = (XmlNode)card.BaseCard.Card;
            XmlDocument cardDocument = new XmlDocument();
            cardDocument.CreateXmlDeclaration("1.0", "utf-16", "");
            cardDocument.LoadXml(cardNode.OuterXml);

            //PrepareMedia(cardDocument);

            XsltArgumentList xsltArguments = new XsltArgumentList();
            xsltArguments.AddParam("correctAnswerText", string.Empty, Properties.Resources.XSL_CORRECT);
            xsltArguments.AddParam("correctFeedbackText", string.Empty, Properties.Resources.XSL_FEEDBACK_CORRECT);
            xsltArguments.AddParam("wrongFeedbackText", string.Empty, Properties.Resources.XSL_FEEDBACK_WRONG);
            xsltArguments.AddParam("youEnteredText", string.Empty, Properties.Resources.XSL_YOUENTERED);
            xsltArguments.AddParam("clickForQuestion", string.Empty, Properties.Resources.XSL_CLICKFORQ);
            xsltArguments.AddParam("clickForExample", string.Empty, Properties.Resources.XSL_CLICKFORE);
            xsltArguments.AddParam("resizePicture", string.Empty, Properties.Resources.XSL_RESIZE_PICTURE);
            xsltArguments.AddParam("restorePicture", string.Empty, Properties.Resources.XSL_RESTORE_PICTURE);
            xsltArguments.AddParam("listeningModeText", string.Empty, Properties.Resources.XSL_LISTENING_MODE_IMAGE_BUTTON_TEXT);
            xsltArguments.AddParam("userAnswer", string.Empty, answer);
            xsltArguments.AddParam("correct", string.Empty, correct ? "true" : "false");

            // pass through what mode(s) we are in
            if (card.BaseCard is PreviewCard)
                xsltArguments.AddParam("slideshowMode", string.Empty, true.ToString().ToLower());
            else
                xsltArguments.AddParam("slideshowMode", string.Empty, this.CurrentLearnLogic.SlideShow.ToString().ToLower());
            xsltArguments.AddParam("selfAssessmentMode", string.Empty, this.Settings.SelfAssessment.ToString().ToLower());
            xsltArguments.AddParam("learningBox", string.Empty, this.LearningBox);
            xsltArguments.AddParam("cardBox", string.Empty, card.BaseCard.Box);

            // the promoted property of CardStateChangedShowResultEventArgs is passed through as bool correct
            xsltArguments.AddParam("promoted", string.Empty, correct ? "true" : "false");

            string promoteMessage;
            if (card.BaseCard.Box == 10)
            {
                promoteMessage = Properties.Resources.XSL_PROMOTE_HIGHEST_MESSAGE;
            }
            else
            {
                promoteMessage = Properties.Resources.XSL_PROMOTE_MESSAGE.Replace("{box_number}", card.BaseCard.Box.ToString());
            }

            xsltArguments.AddParam("promotedMessage", string.Empty, promoteMessage);
            xsltArguments.AddParam("demotedMessage", string.Empty, Properties.Resources.XSL_DEMOTE_MESSAGE);
            //in case we are in self assement mode
            xsltArguments.AddParam("selfassesmentDemotedMessage", string.Empty, Properties.Resources.XSL_SELFASSESMENT_DEMOTE_MESSAGE);
            xsltArguments.AddParam("selfassesmentPromotedMessage", string.Empty, Properties.Resources.XSL_SELFASSESMENT_PROMOTE_MESSAGE);

            switch (LearnMode)
            {
                case LearnModes.Sentence:
                    xsltArguments.AddParam("mode", string.Empty, "sentencemode");
                    break;
                case LearnModes.ListeningComprehension:
                    xsltArguments.AddParam("mode", string.Empty, "listeningmode");
                    break;
                case LearnModes.ImageRecognition:
                    xsltArguments.AddParam("mode", string.Empty, "imagemode");
                    break;
                case LearnModes.MultipleChoice:
                case LearnModes.Word:
                default:
                    xsltArguments.AddParam("mode", string.Empty, "wordmode");
                    break;
            }

            xsltArguments.AddParam("displayImages", string.Empty, Settings.ShowImages.Value ? "true" : "false");
            xsltArguments.AddParam("question2answer", string.Empty, Settings.QueryDirections.Question2Answer.Value ? "true" : "false");
            xsltArguments.AddParam("autoPlaySound", string.Empty, Settings.AutoplayAudio.Value ? "true" : "false");
            xsltArguments.AddParam("baseURL", string.Empty,
                Uri.UnescapeDataString(new Uri(DirectoryName.Replace(@"\", @"/")).AbsoluteUri) + "/");
            xsltArguments.AddParam("stylePath", string.Empty,
                Uri.UnescapeDataString(new Uri(StylePath).AbsoluteUri) + "/");
            xsltArguments.AddExtensionObject("urn:cardobject", card);

            XsltSettings settings = new XsltSettings(false, false);     //disable scripts and document()

            string stylesheet = string.Empty;
            CompiledTransform? ct = card.BaseCard.Settings != null ? (side == Side.Question ? card.BaseCard.Settings.QuestionStylesheet : card.BaseCard.Settings.AnswerStylesheet) : null;

            if (!xslTransformer.ContainsKey(side) || xslTransformer[side] == null)
            #if DEBUG
                xslTransformer[side] = new XslCompiledTransform(true);
            #else
                xslTransformer[side] = new XslCompiledTransform();
            #endif

            if (!CurrentlyLoadedStyleSheet.ContainsKey(side) || CurrentlyLoadedStyleSheet[side] == null)
                CurrentlyLoadedStyleSheet[side] = string.Empty;
//.........这里部分代码省略.........
开发者ID:hmehr,项目名称:OSS,代码行数:101,代码来源:Dictionary.cs

示例7: ClearAllWords

        /// <summary>
        /// Clears all words.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="side">The side.</param>
        /// <param name="type">The type.</param>
        /// <remarks>Documented by Dev03, 2009-01-09</remarks>
        public void ClearAllWords(int id, Side side, WordType type)
        {
            SqlCeCommand cmd = MSSQLCEConn.CreateCommand(Parent.CurrentUser);
            cmd.CommandText = "DELETE FROM TextContent WHERE [email protected] AND [email protected] AND [email protected]";
            cmd.Parameters.Add("@id", id);
            cmd.Parameters.Add("@side", side.ToString());
            cmd.Parameters.Add("@type", type.ToString());
            MSSQLCEConn.ExecuteNonQuery(cmd);

            Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(ObjectLifetimeIdentifier.GetCacheObject(side, type), id));
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:18,代码来源:MsSqlCeWordsConnector.cs

示例8: Order

 public Order(Side s = Side.undefined, string sym = "undef symbol", string f = "n/a")
 {
     side=s.ToString(); //todo: side as Side and still be able to associate it to a grid element in xaml
     symbol=sym;
     fills = f;
 }
开发者ID:hbdevelop1,项目名称:cs,代码行数:6,代码来源:MainWindow.xaml.cs

示例9: SendOrder

        private void SendOrder(Side side)
        {
            try
            {
                Trace.WriteLine(String.Format("Send New Order: Type={0} Side={1} Symbol=[{2}] Qty=[{3}] LimitPrice=[{4}] TIF={5}",
                    this.OrderType.ToString(), side.ToString(), this.Symbol,
                    this.OrderQtyString, this.LimitPriceString, this.TimeInForce.ToString()));

                Dictionary<int, string> customFieldsDict = new Dictionary<int, string>();
                foreach (CustomFieldRecord cfr in this.CustomFields)
                    customFieldsDict[cfr.Tag] = cfr.Value;

                int orderQty = int.Parse(this.OrderQtyString);
                decimal limitPrice = decimal.Parse(this.LimitPriceString);

                QuickFix.FIX42.NewOrderSingle nos = MessageCreator42.NewOrderSingle(
                    customFieldsDict,
                    this.OrderType, side, this.Symbol, orderQty, this.TimeInForce, limitPrice);

                OrderRecord r = new OrderRecord(nos);
                lock (_ordersLock)
                {
                    Orders.Add(r);
                }

                _qfapp.Send(nos);

            }
            catch (Exception e)
            {
                Trace.WriteLine("Failed to send order\n" + e.ToString());
            }
        }
开发者ID:RJPalmer,项目名称:qfn_uidemo,代码行数:33,代码来源:OrderViewModel.cs

示例10: AddWords

        /// <summary>
        /// Adds the words.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="side">The side.</param>
        /// <param name="type">The type.</param>
        /// <param name="words">The words.</param>
        /// <remarks>Documented by Dev03, 2009-01-09</remarks>
        /// <remarks>Documented by Dev08, 2009-01-19</remarks>
        public void AddWords(int id, Side side, WordType type, List<IWord> words)
        {
            if (words.Count > 0)
            {
                //SqlCeCommand cmd1 = MSSQLCEConn.CreateCommand(Parent.CurrentUser);
                //SqlCeCommand cmd2 = MSSQLCEConn.CreateCommand(Parent.CurrentUser);
                //SqlCeCommand cmd3 = MSSQLCEConn.CreateCommand(Parent.CurrentUser);

                //SqlCeParameter paramWordId = new SqlCeParameter("@id", SqlDbType.Int);
                //SqlCeParameter paramCardId = new SqlCeParameter("@cardid", SqlDbType.Int);
                //SqlCeParameter paramType = new SqlCeParameter("@type", SqlDbType.NVarChar);
                //SqlCeParameter paramIsDefault = new SqlCeParameter("@isdefault", SqlDbType.Bit);
                //cmd1.CommandText = "SELECT count(*) FROM TextContent WHERE id = @wordid AND text = @word AND type = @type AND is_default = @isdefault;";
                //cmd1.Parameters.Add(paramWordId);
                //cmd1.Parameters.Add(paramCardId);
                //cmd1.Parameters.Add(paramType);
                //cmd1.Parameters.Add(paramIsDefault);

                //SqlCeParameter paramSide = new SqlCeParameter("@side", SqlDbType.NVarChar);
                //cmd2.CommandText = "SELECT position FROM TextContent WHERE [email protected] AND [email protected] AND [email protected] ORDER BY position DESC";
                //cmd2.Parameters.Add(paramWordId);
                //cmd2.Parameters.Add(paramSide);
                //cmd2.Parameters.Add(paramType);

                //SqlCeParameter paramText = new SqlCeParameter("@text", SqlDbType.NText);
                //SqlCeParameter paramPosition = new SqlCeParameter("@position", SqlDbType.Int);
                //cmd3.CommandText = @"INSERT INTO TextContent (cards_id, text, side, type, position, is_default) VALUES (@id, @text, @:side, @type, @position, @isdefault); SELECT @@IDENTITY;";
                //cmd3.Parameters.Add(paramCardId);
                //cmd3.Parameters.Add(paramText);
                //cmd3.Parameters.Add(paramSide);
                //cmd3.Parameters.Add(paramType);
                //cmd3.Parameters.Add(paramPosition);
                //cmd3.Parameters.Add(paramIsDefault);

                foreach (IWord word in words)
                {
                    if (word != null && word.Word.Length > 0)
                    {
                        //paramCardId.Value = id;
                        //paramWordId.Value = word.Id;
                        //paramText.Value = word.Word;
                        //paramSide.Value = side.ToString();
                        //paramType.Value = type.ToString();
                        //paramIsDefault.Value = word.Default;

                        SqlCeCommand cmd1 = MSSQLCEConn.CreateCommand(Parent.CurrentUser);
                        cmd1.CommandText = "SELECT count(*) FROM TextContent WHERE id = @wordid AND text = @word AND type = @type AND is_default = @isdefault;";
                        cmd1.Parameters.Add("@wordid", word.Id);
                        cmd1.Parameters.Add("@word", word.Word);
                        cmd1.Parameters.Add("@type", type.ToString());
                        cmd1.Parameters.Add("@isdefault", word.Default);

                        bool wordExists = (Convert.ToInt32(MSSQLCEConn.ExecuteScalar(cmd1)) > 0);
                        if (!wordExists)
                        {
                            int currentPos = 0;
                            SqlCeCommand cmd2 = MSSQLCEConn.CreateCommand(Parent.CurrentUser);
                            cmd2.CommandText = "SELECT position FROM TextContent WHERE cards_id[email protected] AND [email protected] AND [email protected] ORDER BY position DESC";
                            cmd2.Parameters.Add("@id", id);
                            cmd2.Parameters.Add("@side", side.ToString());
                            cmd2.Parameters.Add("@type", type.ToString());

                            object retval = MSSQLCEConn.ExecuteScalar(cmd2);
                            if (retval != DBNull.Value)
                                currentPos = Convert.ToInt32(retval);

                            //paramPosition.Value = currentPos + 10;
                            SqlCeCommand cmd3 = MSSQLCEConn.CreateCommand(Parent.CurrentUser);
                            cmd3.CommandText = "INSERT INTO TextContent (cards_id, text, side, type, position, is_default) VALUES (@id, @word, @side, @type, @position, @isdefault); SELECT @@IDENTITY;";
                            cmd3.Parameters.Add("@id", id);
                            cmd3.Parameters.Add("@word", word.Word);
                            cmd3.Parameters.Add("@side", side.ToString());
                            cmd3.Parameters.Add("@type", type.ToString());
                            cmd3.Parameters.Add("@position", currentPos + 10);
                            cmd3.Parameters.Add("@isdefault", word.Default);
                            MSSQLCEConn.ExecuteNonQuery(cmd3);
                        }
                    }
                }

                Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(ObjectLifetimeIdentifier.GetCacheObject(side, type), id));
            }
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:92,代码来源:MsSqlCeWordsConnector.cs

示例11: NameSide

 public NameSide(Side side)
 {
     this.side = side;
     m_strName = Helper.GetDisplayName(typeof(Side), side.ToString());
 }
开发者ID:RusselRains,项目名称:hostile-takeover,代码行数:5,代码来源:TriggersForm.cs

示例12: ClearCardMedia

        public void ClearCardMedia(int cardid, Side side, WordType type, EMedia mediatype)
        {
            using (SqlCeCommand cmd = MSSQLCEConn.CreateCommand(Parent.CurrentUser))
            {
                cmd.CommandText = "DELETE FROM \"Cards_MediaContent\" WHERE [email protected] AND [email protected] AND [email protected] " +
                    "AND media_id IN (SELECT id FROM \"MediaContent\" WHERE [email protected]);";
                cmd.Parameters.Add("@cardid", cardid);
                cmd.Parameters.Add("@side", side.ToString());
                cmd.Parameters.Add("@type", type.ToString());
                cmd.Parameters.Add("@mediatype", mediatype.ToString());
                cmd.ExecuteNonQuery();
            }

            Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(CacheObject.CardMedia, cardid));
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:15,代码来源:MsSqlCeCardMediaConnector.cs

示例13: CreateMediaNode

 /// <summary>
 /// Creates the media node.
 /// </summary>
 /// <param name="media">The media.</param>
 /// <param name="side">The side.</param>
 /// <remarks>Documented by Dev03, 2007-08-07</remarks>
 private void CreateMediaNode(IMedia media, Side side)
 {
     RemoveMediaNodes(media, side);  //remove old media nodes for this media resource
     string tagPrefix = side.ToString().ToLower();
     string typeString = media.MediaType.ToString().ToLower();
     switch (media.MediaType)
     {
         case EMedia.Audio:
             XmlElement xeMedia;
             if (!media.Active.GetValueOrDefault())
                 xeMedia = XmlHelper.CreateElementWithAttribute(m_card, "unusedmedia", media.Filename, "type", typeString);
             else
             {
                 if (((XmlAudio)media).Default.GetValueOrDefault())
                 {
                     xeMedia = (XmlElement)m_card.SelectSingleNode(tagPrefix + typeString + "[@id='std']");
                     if (xeMedia == null)
                     {
                         xeMedia = XmlHelper.CreateElementWithAttribute(m_card, tagPrefix + typeString, media.Filename, "id", "std");
                     }
                     else
                     {
                         DeleteFileFromMediaFolder(new XmlAudio(xeMedia.InnerText, Parent.GetChildParentClass(this)));
                         xeMedia.InnerText = media.Filename;
                     }
                 }
                 else if (((XmlAudio)media).Example.GetValueOrDefault())
                 {
                     xeMedia = (XmlElement)m_card.SelectSingleNode(tagPrefix + "example" + typeString);
                     if (xeMedia == null)
                     {
                         xeMedia = XmlHelper.CreateAndAppendElement(m_card, tagPrefix + "example" + typeString, media.Filename);
                     }
                     else
                     {
                         DeleteFileFromMediaFolder(new XmlAudio(xeMedia.InnerText, Parent.GetChildParentClass(this)));
                         xeMedia.InnerText = media.Filename;
                     }
                 }
                 if (!((XmlAudio)media).Default.GetValueOrDefault() && !((XmlAudio)media).Example.GetValueOrDefault())
                     xeMedia = XmlHelper.CreateAndAppendElement(m_card, tagPrefix + typeString, media.Filename);
             }
             break;
         case EMedia.Image:
             if (!media.Active.GetValueOrDefault())
                 xeMedia = XmlHelper.CreateElementWithAttribute(m_card, "unusedmedia", media.Filename, "type", typeString);
             else
                 xeMedia = XmlHelper.CreateAndAppendElement(m_card, tagPrefix + typeString, media.Filename);
             IImage image = (IImage)media;
             if ((image.Height > 0) && (image.Width > 0))
             {
                 XmlHelper.CreateAndAppendAttribute(xeMedia, "width", image.Width.ToString());
                 XmlHelper.CreateAndAppendAttribute(xeMedia, "height", image.Height.ToString());
             }
             break;
         case EMedia.Video:
         default:
             if (!media.Active.GetValueOrDefault())
                 XmlHelper.CreateElementWithAttribute(m_card, "unusedmedia", media.Filename, "type", typeString);
             else
                 XmlHelper.CreateAndAppendElement(m_card, tagPrefix + typeString, media.Filename);
             break;
     }
     Initialize();
 }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:71,代码来源:XmlCard.cs

示例14: ClearCardMedia

        public void ClearCardMedia(int cardid, Side side, WordType type, EMedia mediatype)
        {
            using (NpgsqlConnection con = PostgreSQLConn.CreateConnection(Parent.CurrentUser))
            {
                using (NpgsqlCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = "DELETE FROM \"Cards_MediaContent\" WHERE cards_id=:cardid AND side=:side AND type=:type " +
                        "AND media_id IN (SELECT id FROM \"MediaContent\" WHERE media_type=:mediatype);";
                    cmd.Parameters.Add("cardid", cardid);
                    cmd.Parameters.Add("side", side.ToString());
                    cmd.Parameters.Add("type", type.ToString());
                    cmd.Parameters.Add("mediatype", mediatype.ToString());
                    cmd.ExecuteNonQuery();
                }
            }

            Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(CacheObject.CardMedia, cardid));
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:18,代码来源:PgSqlCardMediaConnector.cs

示例15: CreateNewWord

        /// <summary>
        /// Creates the new word.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="word">The word.</param>
        /// <param name="side">The side.</param>
        /// <param name="type">The type.</param>
        /// <param name="isDefault">if set to <c>true</c> [is default].</param>
        /// <returns></returns>
        /// <remarks>Documented by Dev03, 2009-01-09</remarks>
        public IWord CreateNewWord(int id, string word, Side side, WordType type, bool isDefault)
        {
            if (word != null)
            {
                SqlCeCommand cmd = MSSQLCEConn.CreateCommand(Parent.CurrentUser);
                cmd.CommandText = "SELECT position FROM TextContent WHERE [email protected] AND [email protected] AND [email protected] ORDER BY position DESC";
                cmd.Parameters.Add("@id", id);
                cmd.Parameters.Add("@side", side.ToString());
                cmd.Parameters.Add("@type", type.ToString());

                int currentPos = 0;
                object retval = MSSQLCEConn.ExecuteScalar(cmd);
                if (retval != DBNull.Value)
                    currentPos = Convert.ToInt32(retval);
                cmd.Parameters.Clear();

                cmd.CommandText = @"INSERT INTO TextContent (cards_id, text, side, type, position, is_default) VALUES (@id, @text, @side, @type, @position, @isdefault); SELECT @@IDENTITY;";
                cmd.Parameters.Add("@id", id);
                cmd.Parameters.Add("@text", word);
                cmd.Parameters.Add("@side", side.ToString());
                cmd.Parameters.Add("@type", type.ToString());
                cmd.Parameters.Add("@position", currentPos + 10);
                cmd.Parameters.Add("@isdefault", isDefault);

                Parent.CurrentUser.Cache.Uncache(ObjectLifetimeIdentifier.GetIdentifier(ObjectLifetimeIdentifier.GetCacheObject(side, type), id));

                return new DbWord(Convert.ToInt32(MSSQLCEConn.ExecuteScalar(cmd)), word, type, isDefault, Parent);
            }
            else
                return null;
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:41,代码来源:MsSqlCeWordsConnector.cs


注:本文中的Side.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。