コード例 #1
0
        private void DataAssigment()
        {
            Tags    dataTag     = TagsLibraryFunctions.CreateDateTag(dateTimePicker1.Value.ToString());
            TagType dataTagType = TagTypesLibraryFunctions.CreateAndReturn("Data");
            Media   dataMedia   = MediaLibraryFunctions.GetMedia(pictureBoxModifyProety.Tag.ToString());

            TableWaysLibraryFunctions.CreateTableWay(dataMedia, dataTag, dataTagType);
        }
コード例 #2
0
        private void buttonDeleteTag_Click(object sender, EventArgs e)
        {
            string forDeteleTags = this.textBoxNewTags.Text.ToString();

            Regex           usedRegex        = new Regex(@"^((?<key>[A-Za-z]+)\s*[;]\s*)+$", RegexOptions.Compiled);
            MatchCollection forDeleteTagList = usedRegex.Matches(forDeteleTags);

            Media mediaDB;

            //foreach (var item in forDeleteTagList)
            //{
            //    Console.WriteLine(item.ToString());
            //}
            if (forDeleteTagList.Count == 0)
            {
                ErrForm errForm = new ErrForm("Format Incorect Please use this format: tagName;");
                errForm.ShowDialog();
            }

            try {
                foreach (Match match in forDeleteTagList)
                {
                    GroupCollection groups     = match.Groups;
                    var             countGroup = groups["key"].Captures.Count;

                    Console.WriteLine("countGroup");
                    Console.WriteLine(countGroup);

                    for (int i = 0; i < countGroup; i++)
                    {
                        string itemTagDelete = groups["key"].Captures[i].ToString();
                        //string itemTagType = groups["value"].Captures[i].ToString();
                        Console.WriteLine("itemTagDelete");
                        Console.WriteLine(itemTagDelete);

                        Tags tagDB = TagsLibraryFunctions.GetTag(itemTagDelete);
                        if (tagDB == null)
                        {
                            continue;
                        }

                        TagsLibraryFunctions.DeleteTag(tagDB);
                        //Console.WriteLine(TagsLibraryFunctions.DeleteTag(tagDB));

                        mediaDB = MediaLibraryFunctions.GetMedia(pictureBoxModifyProety.Tag.ToString());
                        TableWaysLibraryFunctions.DeleteTableWay(mediaDB);
                        ShowTags(mediaDB.Media_path);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrForm errForm = new ErrForm(ex.ToString());
                errForm.ShowDialog();
            }
        }
コード例 #3
0
        private void buttonSearchAfterTag_Click(object sender, EventArgs e)
        {
            var mediaGivenName    = this.textBoxSearchAfterMediaLabel.Text;
            var tagGivenValue     = this.textBoxSearchAfterTagLabel.Text;
            var tagTypeGivenValue = this.textBoxSearchAfterTagTypeLabel.Text;

            //Console.WriteLine(mediaGivenName);
            //Console.WriteLine(tagGivenValue);
            //Console.WriteLine(tagTypeGivenValue);

            if ((tagTypeGivenValue == null) && (tagTypeGivenValue == null) && (mediaGivenName == null))
            {
                Console.WriteLine("all is null");
            }
            else
            {
                if (tagTypeGivenValue != null)
                {
                    TagType k = TagTypesLibraryFunctions.GetTagTypes(tagTypeGivenValue);
                    if (k != null)
                    {
                        Console.WriteLine("k"); Console.WriteLine(k);
                        //this.textBoxSearchAfterTagTypeLabel.Text = null;
                        GetDBAfterIdTagType(k.Id_TagType);
                    }
                }
                if (tagGivenValue != null)
                {
                    Tags k = TagsLibraryFunctions.GetTag(tagGivenValue);
                    if (k != null)
                    {
                        Console.WriteLine("k"); Console.WriteLine(k.Value_tag);
                        //this.textBoxSearchAfterTagLabel.Text = null;
                        GetDBAfterIdTag(k.Id_Tags);
                    }
                }
                if (mediaGivenName != null)
                {
                    Console.WriteLine("k"); Console.WriteLine(mediaGivenName);
                    GetDBAfterMediaName(mediaGivenName);
                }
            }
        }
コード例 #4
0
        private void buttonSaveInModifyPropety_Click(object sender, EventArgs e)
        {
            Console.WriteLine(dateTimePicker1.Value);

            try
            {
                string newTagsString = this.textBoxNewTags.Text.ToString();
                Regex  regex         = new Regex(@"^((?<key>[A-Za-z]+)\s*-\s*(?<value>[A-Za-z]+)\s*[,;]\s*)+$", RegexOptions.Compiled);
                /*Regex regex = new Regex(@"(?<key>\w)", RegexOptions.Compiled);*/

                MatchCollection newTagList = regex.Matches(newTagsString);
                Console.WriteLine("count new tag list");
                Console.WriteLine(newTagList.Count);
                if (newTagList.Count == 0)
                {
                    ErrForm errForm = new ErrForm("Format Incorect Please use this format: tagName - tagCategory;");
                    errForm.ShowDialog();
                }
                Media mediaDB;
                foreach (Match match in newTagList)
                {
                    GroupCollection groups     = match.Groups;
                    var             countGroup = groups["key"].Captures.Count;
                    //Console.WriteLine("countGroup");
                    //Console.WriteLine(countGroup);

                    for (int i = 0; i < countGroup; i++)
                    {
                        string itemTag     = groups["key"].Captures[i].ToString();
                        string itemTagType = groups["value"].Captures[i].ToString();
                        //Console.WriteLine("itemTag");
                        //Console.WriteLine(itemTag);
                        //Console.WriteLine("itemTagType");
                        //Console.WriteLine(itemTagType);

                        var tagDB = TagsLibraryFunctions.CreateTagAnReturnTag(itemTag);
                        mediaDB = MediaLibraryFunctions.GetMedia(pictureBoxModifyProety.Tag.ToString());

                        TagType tagTypeDB = new TagType();
                        if (TagTypesLibraryFunctions.GetTagTypes(itemTagType) != null)
                        {
                            tagTypeDB = TagTypesLibraryFunctions.GetTagTypes(itemTagType);
                            //Console.WriteLine("gasit");
                        }
                        else
                        {
                            tagTypeDB = TagTypesLibraryFunctions.CreateTagTypeAndReturnIt(itemTagType);
                            //Console.WriteLine("nou");
                        }

                        TableWaysLibraryFunctions.CreateTableWay(mediaDB, tagDB, tagTypeDB);

                        //Console.WriteLine(pictureBoxModifyProety.Tag.ToString());
                        ShowTags(mediaDB.Media_path);
                    }
                }
                DataAssigment();
            }
            catch (Exception ex)
            {
                ErrForm errForm = new ErrForm(ex.ToString());
                errForm.ShowDialog();
            }
        }
コード例 #5
0
 public void DataDelete(Tags tag)
 {
     TagsLibraryFunctions.DeleteTag(tag);
 }
コード例 #6
0
        private void tableTagsManagerT()
        {
            tableTagsManager.AutoSize    = true;
            tableTagsManager.RowCount    = 1;
            tableTagsManager.ColumnCount = 4;
            tableTagsManager.RowStyles.Add(new RowStyle());

            tableTagsManager.ColumnStyles.Add(new ColumnStyle());
            tableTagsManager.ColumnStyles.Add(new ColumnStyle());
            tableTagsManager.ColumnStyles.Add(new ColumnStyle());
            tableTagsManager.ColumnStyles.Add(new ColumnStyle());

            Label tagValue = new Label();

            tagValue.Text      = "Tag Value";
            tagValue.BackColor = Color.FromArgb(103, 146, 137);
            //tagValue.AutoSize = true;
            Label tagID = new Label();

            tagID.Text      = "Tag Category Id";
            tagID.BackColor = Color.FromArgb(103, 146, 137);
            //tagID.AutoSize = true;
            Label tagCategory = new Label();

            tagCategory.Text      = "Tag Category";
            tagCategory.BackColor = Color.FromArgb(103, 146, 137);
            //tagCategory.AutoSize = true;
            Label tagSerach = new Label();

            tagSerach.Text      = "Search";
            tagSerach.BackColor = Color.FromArgb(103, 146, 137);
            //tagSerach.AutoSize = true;
            tableTagsManager.Controls.Add(tagID, 0, 0);
            tableTagsManager.Controls.Add(tagCategory, 1, 0);
            tableTagsManager.Controls.Add(tagValue, 2, 0);
            tableTagsManager.Controls.Add(tagSerach, 3, 0);

            List <Tags> newTag = TagsLibraryFunctions.GetTagAll();
            int         count  = 1;

            foreach (var item in newTag)
            {
                tableTagsManager.RowStyles.Add(new RowStyle());
                Label newLabelValue    = new Label();
                Label newLabelId       = new Label();
                Label newLabelCategory = new Label();
                var   newLabelSearch   = new Button();
                newLabelValue.Text = item.Value_tag;

                var init = TableWaysLibraryFunctions.GetTableWaysIdTagsCategory(item.Id_Tags);
                newLabelCategory.Text      = TagTypesLibraryFunctions.GetTagTypes(init).Value_tagType;
                newLabelId.Text            = TagTypesLibraryFunctions.GetTagTypes(init).Id_TagType.ToString();
                newLabelValue.BackColor    = Color.FromArgb(244, 192, 149);
                newLabelCategory.BackColor = Color.FromArgb(244, 192, 149);
                newLabelId.BackColor       = Color.FromArgb(244, 192, 149);

                tableTagsManager.Controls.Add(newLabelId, 0, count);
                tableTagsManager.Controls.Add(newLabelCategory, 1, count);
                tableTagsManager.Controls.Add(newLabelValue, 2, count);


                newLabelSearch.Text      = "Vezi tot";
                newLabelSearch.BackColor = Color.FromArgb(244, 192, 149);
                newLabelSearch.Tag       = TagTypesLibraryFunctions.GetTagTypes(init).Id_TagType;
                newLabelSearch.Click    += NewLabelSearch_Click;
                tableTagsManager.Controls.Add(newLabelSearch, 3, count);

                count++;
                tableTagsManager.RowCount++;
            }
        }