public void PopulateTreeview(MaintenancePlan maintPlan)
        {
            int db = 0;
            int dateindex = 0;
            treeView1.Nodes.Clear();
                foreach (string dB in maintPlan.DBs())
                {

                    treeView1.Nodes.Add(dB);
                    foreach (DateTime date in maintPlan.GetDates(dB))
                    {
                        treeView1.Nodes[db].Nodes.Add(date.ToString("d"));
                        treeView1.Nodes[db].LastNode.Tag = maintPlan.GetFullBackupFile(dB, date);

                        if (maintPlan.LogBKFolder != null)
                        {
                            foreach (DateTime time in maintPlan.GetLogTimes(dB,date))
                            {
                                treeView1.Nodes[db].Nodes[dateindex].Nodes.Add(time.ToString("hh:mm tt"));
                                treeView1.Nodes[db].Nodes[dateindex].LastNode.Tag = maintPlan.GetLogBackupFile(dB, time);
                            }
                            dateindex++;
                        }

                    }
                    dateindex = 0;
                    db++;
                }
        }
Example #2
0
        /// <summary>
        /// Accepts a MaintenancePlan and returns a list of strings containing The users selected databases
        /// </summary>
        /// <param name="maintPlan"></param>
        /// <returns></returns>
        public static List<string> GetDB(MaintenancePlan maintPlan)
        {
            List<string> databases = new List<string>();
            string strIndex = "";
            int intIndex = 0;
            do
            {
                do
                {
                    strIndex = "";
                    Console.Clear();
                    Console.WriteLine("Choose databases from below list\n");
                    Console.WriteLine(CreateIndexedString(maintPlan.DBs()));
                    Console.Write("[All]: ");

                    strIndex = Console.ReadLine();

                    if (strIndex == "")
                        strIndex = maintPlan.DBs().Count.ToString();

                } while (!Int32.TryParse(strIndex, out intIndex));
                intIndex = Convert.ToInt32(strIndex);

            } while (maintPlan.DBs().Count < intIndex);
            if (intIndex == maintPlan.DBs().Count)
                databases.AddRange(maintPlan.DBs());
            else
                databases.Add(maintPlan.DBs()[intIndex]);

            return databases;
        }