Ejemplo n.º 1
0
        public bool SaveChanges()
        {
            ArrayList arrayList = new ArrayList();

            if (Changes.Count > 0)
            {
                if (Changes.Contains("Name"))
                {
                    arrayList.Add("name='" + SQL.Prepare(iName) + "'");
                }
                if (Changes.Contains("Type"))
                {
                    arrayList.Add("type=" + iType);
                    Changes.Remove("Type");
                }
                CC.SQL.ExecQuery("UPDATE series SET " + string.Join(",", CC.StringList(arrayList)) + " WHERE id=" + ID);
                if (Settings.Default.OrganizeMethod != 0)
                {
                    if (Changes.Contains("Name"))
                    {
                        //Rename folders
                        string text  = Settings.Default.LibraryDir + "\\" + CC.URLize(PublisherName) + "\\" + CC.URLize(GroupName) + "\\" + CC.URLize(OldName) + "\\";
                        string text2 = Settings.Default.LibraryDir + "\\" + CC.URLize(PublisherName) + "\\" + CC.URLize(GroupName) + "\\" + CC.URLize(Name) + "\\";
                        CC.SQL.ExecQuery("UPDATE issues SET filename=" + CC.SQLReplaceLeft("filename", text, text2));
                        CC.Rename(text, text2);
                    }
                    Changes.Remove("Name");
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        public void AdoptSeries(ArrayList Series)
        {
            SQL       sQL       = new SQL();
            string    text      = Settings.Default.LibraryDir + "\\" + CC.URLize(PublisherName) + "\\" + CC.URLize(Name);
            string    text2     = "";
            ArrayList arrayList = new ArrayList();

            foreach (ComicSeries item in Series)
            {
                if (Settings.Default.OrganizeMethod != 0)
                {
                    text2 = Settings.Default.LibraryDir + "\\" + CC.URLize(item.PublisherName) + "\\" + CC.URLize(item.GroupName);
                    sQL.ExecQuery("UPDATE issues SET filename=" + CC.SQLReplaceLeft("filename", text2, text) + " WHERE series_id=" + item.ID);
                    try
                    {
                        Directory.Move(text2 + "\\" + CC.URLize(item.Name), text + "\\" + CC.URLize(item.Name));
                    }
                    catch
                    {
                    }
                }
                arrayList.Add(Convert.ToString(item.ID));
                item.GroupID   = ID;
                item.GroupName = Name;
            }
            sQL.ExecQuery("UPDATE series SET group_id=" + ID + ", pub_id=" + PublisherID + " WHERE id IN (" + string.Join(",", CC.StringList(arrayList)) + ")");
        }
Ejemplo n.º 3
0
        public bool SaveChanges()
        {
            ArrayList arrayList = new ArrayList();

            //SQL sQL = new SQL();
            if (Changes.Count > 0)
            {
                if (Changes.Contains("Name"))
                {
                    arrayList.Add("name='" + SQL.Prepare(iName) + "'");
                }
                if (Changes.Contains("PublisherID"))
                {
                    arrayList.Add("pub_id='" + iPublisherID + "'");
                    CC.SQL.ExecQuery("UPDATE series SET pub_id=" + iPublisherID + " WHERE group_id=" + ID);
                }
                CC.SQL.ExecQuery("UPDATE groups SET " + string.Join(",", CC.StringList(arrayList)) + " WHERE id=" + ID);
                if (Settings.Default.OrganizeMethod != 0)
                {
                    Query query = CC.SQL.ExecQuery("SELECT name FROM publishers WHERE id=" + PublisherID);
                    query.NextResult();

                    string name = (string)query.hash[0];
                    query.Close();

                    if (Changes.Contains("Name"))
                    {
                        string text  = Settings.Default.LibraryDir + "\\" + CC.URLize(name) + "\\" + CC.URLize(OldName) + "\\";
                        string text2 = Settings.Default.LibraryDir + "\\" + CC.URLize(name) + "\\" + CC.URLize(Name) + "\\";
                        CC.SQL.ExecQuery("UPDATE issues SET filename=" + CC.SQLReplaceLeft("filename", text, text2));
                        CC.Rename(text, text2);
                    }
                    if (Changes.Contains("PublisherID"))
                    {
                        query = CC.SQL.ExecQuery("SELECT name FROM publishers WHERE id=" + OldPublisherID);
                        query.NextResult();

                        string name2 = (string)query.hash[0];
                        query.Close();
                        string text  = Settings.Default.LibraryDir + "\\" + CC.URLize(name2) + "\\" + CC.URLize(Name) + "\\";
                        string text2 = Settings.Default.LibraryDir + "\\" + CC.URLize(name) + "\\" + CC.URLize(Name) + "\\";
                        CC.SQL.ExecQuery("UPDATE issues SET filename=" + CC.SQLReplaceLeft("filename", text, text2));
                        CC.Rename(text, text2);
                    }
                }
                Changes.Remove("Name");
                Changes.Remove("PublisherID");
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
        //Handle the assignment of groups to publisher, including moving directories
        public void AdoptGroups(ArrayList Groups)
        {
            SQL    sQL   = new SQL();
            string text  = Settings.Default.LibraryDir + "\\" + Name + "\\";
            string text2 = "";

            if (Settings.Default.OrganizeMethod != 0)
            {
                foreach (ComicSeries Group in Groups)
                {
                    text2 = Settings.Default.LibraryDir + "\\" + Group.PublisherName + "\\";
                    sQL.ExecQuery("UPDATE issues SET filename=" + CC.SQLReplaceLeft("filename", text2, text) + " WHERE series_id=" + Group.ID);
                    Directory.Move(text2 + Group.Name + "\\", text + Group.Name + "\\");
                }
            }
            sQL.ExecQuery("UPDATE series SET group_id=" + ID + " WHERE series_id IN (" + string.Join(",", CC.StringList(Groups)) + ")");
        }