Esempio n. 1
0
        public static Configuration AddConfigurationTypeEntry(
            EnlistmentDC dc,
            bool submit,
            short id,
            User u,
            Email e,
            PhoneSKU p,
            Command c,
            BuildXml b,
            Enlistment1 en,
            BuildType bt)
        {
            Configuration o = new Configuration
            {
                ID          = id,
                User        = u,
                Email       = e,
                PhoneSKU    = p,
                Command     = c,
                BuildXml    = b,
                Enlistment1 = en,
                BuildType   = bt
            };

            dc.Configurations.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 2
0
        public static Configuration AddConfigurationTypeEntry(
            EnlistmentDC dc,
            bool submit,
            short id,
            short userId,
            short emailId,
            short phoneSkuId,
            short commandId,
            short buildXmlId,
            short enlistmentId,
            short dailyBuild)
        {
            Configuration o = new Configuration {
                ID         = id, UserID = userId,
                EmailID    = emailId, PhoneSkuID = phoneSkuId, CommandID = commandId,
                BuildXmlID = buildXmlId, EnlistmentID = enlistmentId, DailyBuild = dailyBuild
            };

            dc.Configurations.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 3
0
        public static bool ModifySmallPopulationEntry(EnlistmentDC dc)
        {
            var cfg = from c in dc.Configurations
                      where c.PhoneSKU.Name == "CEPC"
                      select c;

            foreach (var x in cfg)
            {
                x.PhoneSKU.Name = "CEPC1";
            }
            dc.SubmitChanges();

            var mod = from c in dc.Configurations
                      where c.PhoneSKU.Name == "CEPC1"
                      select c;

            if (mod != null && mod.Count() > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        private void resetDataContextButton_Click(object sender, RoutedEventArgs e)
        {
            Shared.ResetDataContext();
            EnlistmentDC dc = this.viewModel.dc;

            this.configDataGridMan.ItemsSource = this.viewModel.dc.Configurations;
        }
Esempio n. 5
0
        public static void PopulateDbSmall(EnlistmentDC dc, bool submit)
        {
            BuildType bt = AddBuildTypeEntry(dc, submit, 1, "Full Build 1");

            AddBuildTypeEntry(dc, submit, 2, "Full Build 2");

            BuildXml bx = AddBuildXmlTypeEntry(dc, submit, 1, @"C:\FilePath1\Config.xml");

            AddBuildXmlTypeEntry(dc, submit, 2, @"C:\FilePath1\Config.xml");

            Command c = AddCommandTypeEntry(dc, submit, 1, "Rebuild", "Wm Rebuild");

            AddCommandTypeEntry(dc, submit, 2, "Build", "Wm Build");

            User u = AddUserTypeEntry(dc, submit, 1, "Dave", "Hoover");

            AddUserTypeEntry(dc, submit, 2, "John", "Wang");


            Email e = AddEmailTypeEntry(dc, submit, 1, 2, true, "*****@*****.**");

            AddEmailTypeEntry(dc, submit, 2, u, true, "*****@*****.**");

            Enlistment1 en = AddEnlistmentTypeEntry(dc, submit, 1, @"F:\Enlistment1");

            AddEnlistmentTypeEntry(dc, submit, 2, @"F:\Enlistment2");

            PhoneSKU p = AddPhoneSkuTypeEntry(dc, submit, 1, "CEPC");

            AddPhoneSkuTypeEntry(dc, submit, 2, "XDE");

            Configuration cfg = AddConfigurationTypeEntry(dc, submit, 1, 2, 2, 2, 2, 2, 2, 2);

            AddConfigurationTypeEntry(dc, submit, 2, u, e, p, c, bx, en, bt);
        }
Esempio n. 6
0
        private void ConfigureItemsSelection(string field, ComboBox b)
        {
            EnlistmentDC dc = this.viewModel.dc;

            switch (field)
            {
            case BuildTypeField:
            {
                var items = from c in dc.BuildTypes select c.Name;
                b.ItemsSource = items;
            }
            break;

            case BuildXmlField:
            {
                var items = from c in dc.BuildXmls select c.FilePath;
                b.ItemsSource = items;
            }
            break;

            case BuildCommandField:
            {
                var items = from c in dc.Commands select c.Command1;
                b.ItemsSource = items;
            }
            break;

            case EmailField:
            {
                var items = from c in dc.Emails select c.EmailAccount;
                b.ItemsSource = items;
            }
            break;

            case EnlistmentField:
            {
                var items = from c in dc.Enlistments select c.Path;
                b.ItemsSource = items;
            }
            break;

            case PhoneSkuField:
            {
                var items = from c in dc.PhoneSKUs select c.Name;
                b.ItemsSource = items;
            }
            break;

            case UserField:
            {
                var items = from c in dc.Users select c.LastName;
                b.ItemsSource = items;
            }
            break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 7
0
        private void deleteTestRowButton_Click(object sender, RoutedEventArgs e)
        {
            EnlistmentDC dc    = this.viewModel.dc;
            var          query = from s in dc.Configurations
                                 where s.PhoneSkuID == 3
                                 select s;

            dc.Configurations.DeleteAllOnSubmit(query);
            dc.SubmitChanges();
            queryButton_Click(sender, e);
        }
Esempio n. 8
0
        public static BuildXml AddBuildXmlTypeEntry(EnlistmentDC dc, bool submit, short id, string filePath)
        {
            BuildXml o = new BuildXml {
                FileID = id, FilePath = filePath
            };

            dc.BuildXmls.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 9
0
        public static PhoneSKU AddPhoneSkuTypeEntry(EnlistmentDC dc, bool submit, short id, string name)
        {
            PhoneSKU o = new PhoneSKU {
                ID = id, Name = name
            };

            dc.PhoneSKUs.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 10
0
        public static User AddUserTypeEntry(EnlistmentDC dc, bool submit, short id, string firstName, string lastName)
        {
            User o = new User {
                UserID = id, FirstName = firstName, LastName = lastName
            };

            dc.Users.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 11
0
        public static Email AddEmailTypeEntry(EnlistmentDC dc, bool submit, short emailID, User u, bool primaryAccount, string emailAccount)
        {
            Email o = new Email {
                EmailID = emailID, EmailAccount = emailAccount, Primary = primaryAccount, User = u
            };

            dc.Emails.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 12
0
        public static Enlistment1 AddEnlistmentTypeEntry(EnlistmentDC dc, bool submit, short id, string path)
        {
            Enlistment1 o = new Enlistment1 {
                Id = id, Path = path
            };

            dc.Enlistments.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 13
0
        public static Command AddCommandTypeEntry(EnlistmentDC dc, bool submit, short id, string command, string commandLine)
        {
            Command o = new Command {
                CommandID = id, Command1 = command, CommandLine = commandLine
            };

            dc.Commands.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 14
0
        public static BuildType AddBuildTypeEntry(EnlistmentDC dc, bool submit, short id, string name)
        {
            BuildType o = new BuildType {
                ID = id, Name = name
            };

            dc.BuildTypes.InsertOnSubmit(o);
            if (submit)
            {
                dc.SubmitChanges();
            }
            return(o);
        }
Esempio n. 15
0
        private void Initialize(MainWindow mainWindowReference)
        {
            InitializeComponent();
            this.mainWindow  = mainWindowReference;
            this.DataContext = this.viewModel;
            Configurations   = CollectionViewSource.GetDefaultView(this.viewModel.dc.Configurations);
            this.configDataGridMan.ItemsSource = Configurations;
            EnlistmentDC dc = this.viewModel.dc;

            this.ConfigurationFieldSelectComboxBox(this.query0FieldSelectComboBox);
            this.ConfigurationFieldSelectComboxBox(this.query1FieldSelectComboBox);
            this.ConfigurationFieldSelectComboxBox(this.query2FieldSelectComboBox);
            this.ConfigurationFieldSelectComboxBox(this.query3FieldSelectComboBox);
        }
Esempio n. 16
0
        private void modifyTestRowButton_Click(object sender, RoutedEventArgs e)
        {
            EnlistmentDC dc    = this.viewModel.dc;
            var          query = (from s in dc.Configurations
                                  where s.PhoneSkuID == 3
                                  select s);
            var command = (from s in dc.Commands
                           where s.CommandID == 4
                           select s).First();

            foreach (Configuration c in query)
            {
                c.Command = command;
            }


            dc.SubmitChanges();
            queryButton_Click(sender, e);
        }
Esempio n. 17
0
        public static bool DeleteEntriesFromSmallPopulationEntry(EnlistmentDC dc)
        {
            var cfg = from c in dc.Configurations
                      where c.PhoneSKU.Name == "CEPC"
                      select c;

            dc.Configurations.DeleteAllOnSubmit(cfg);
            dc.SubmitChanges();

            var mod = from c in dc.Configurations
                      where c.PhoneSKU.Name == "CEPC"
                      select c;

            if (mod != null && mod.Count() > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 18
0
        private void addTestRowButton_Click(object sender, RoutedEventArgs e)
        {
            EnlistmentDC dc    = this.viewModel.dc;
            short        maxId = (short)(from s in dc.Configurations
                                         select s.ID).Max <short>();

            maxId += 1;
            this.testConfigItem = new Configuration
            {
                ID           = maxId,
                UserID       = 1,
                EmailID      = 1,
                PhoneSkuID   = 3,
                CommandID    = 1,
                BuildXmlID   = 1,
                EnlistmentID = 1,
                DailyBuild   = 1
            };
            dc.Configurations.InsertOnSubmit(this.testConfigItem);
            dc.SubmitChanges();
            queryButton_Click(sender, e);
        }
Esempio n. 19
0
        public static bool VerifySmallPopulation(EnlistmentDC dc)
        {
            int cfgCount    = (from c in dc.Configurations select c).Count();
            int btCount     = (from c in dc.BuildTypes select c).Count();
            int bxCount     = (from c in dc.BuildXmls select c).Count();
            int cmdCount    = (from c in dc.Commands select c).Count();
            int userCount   = (from c in dc.Users select c).Count();
            int emailCount  = (from c in dc.Emails select c).Count();
            int skuCount    = (from c in dc.PhoneSKUs select c).Count();
            int enlistCount = (from c in dc.Enlistments select c).Count();
            int s           = smallDbTableCount;

            if (cfgCount != s || btCount != s || bxCount != s || cmdCount != s ||
                userCount != s || emailCount != s || skuCount != s || enlistCount != s)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 20
0
        private IEnumerable <Configuration> ExecuteQuery(IEnumerable <Configuration> orig,
                                                         string field,
                                                         string item)
        {
            EnlistmentDC dc = this.viewModel.dc;
            IEnumerable <Configuration> source;

            if (orig.Count() == 0)
            {
                source = (from c in dc.Configurations select c).AsEnumerable <Configuration>();
            }
            else
            {
                source = orig;
            }
            IEnumerable <Configuration> cfg = null;

            switch (field)
            {
            case BuildTypeField:
            {
                cfg = from c in source
                      where c.BuildType.Name == item
                      select c;
            }
            break;

            case BuildXmlField:
            {
                cfg = from c in source
                      where c.BuildXml.FilePath == item
                      select c;
            }
            break;

            case BuildCommandField:
            {
                cfg = from c in source
                      where c.Command.Command1 == item
                      select c;
            }
            break;

            case EmailField:
            {
                cfg = from c in source
                      where c.Email.EmailAccount == item
                      select c;
            }
            break;

            case EnlistmentField:
            {
                cfg = from c in source
                      where c.Enlistment1.Path == item
                      select c;
            }
            break;

            case PhoneSkuField:
            {
                cfg = from c in source
                      where c.PhoneSKU.Name == item
                      select c;
            }
            break;

            case UserField:
            {
                cfg = from c in source
                      where c.User.LastName == item
                      select c;
            }
            break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(cfg);
        }
 static Shared()
 {
     EnlistmentDataContext = new EnlistmentDC(@"Data\Enlistment.sdf");
 }
 public static void ResetDataContext()
 {
     EnlistmentDataContext.Dispose();
     EnlistmentDataContext = null;
     EnlistmentDataContext = new EnlistmentDC(@"Data\Enlistment.sdf");
 }