Example #1
0
        public ActionResult Report()
        {
            var data = from t in db.Applications
                       join p in db.Processed_Applications on t.Id equals p.applicationid

                       orderby t.Id ascending
                       select t;
            List <POCO> lst = new List <POCO>();

            foreach (var j in data)
            {
                POCO pm = new POCO();
                pm.Id        = j.Id;
                pm.Name      = j.name;
                pm.Age       = j.age;
                pm.DOB       = j.dob;
                pm.Address   = j.address;
                pm.Branch_id = j.branch_id;
                pm.Class_id  = j.classid;

                lst.Add(pm);
            }
            int data7 = db.Applications.Count();

            Session["totalcount"] = data7;
            int res = db.Processed_Applications.Count(x => x.comments == "Processed");

            Session["processedcount"] = res;
            // Session["datta"] = lst;
            return(View(lst));
        }
Example #2
0
        public Bet(UserDataManager manager, Match match, POCO.BetPoco poco)
        {
            Id = poco._id;
            MyMatch = match;
            MatchHash = poco.match_hash;
            UserContext = manager.User;

            SetOutcome(poco.outcome);

            if (match != null)
            {
                if (match.Player1 != null && poco.offerer_choice_id == match.Player1.Id)
                {
                    OffererChoice = match.Player1;
                    TakerChoice = match.Player2;
                }
                else
                {
                    OffererChoice = match.Player2;
                    TakerChoice = match.Player1;
                }
            }

            var offerer = new POCO.UserBase { _id = poco.offerer_id, username = poco.offerer_username };
            Offerer = manager.GetPgUser(offerer);
            OffererOdds = poco.offerer_odds;
            OffererWager = poco.offerer_wager;

            var taker = new POCO.UserBase { _id = poco.taker_id, username = poco.taker_username };
            if (!string.IsNullOrWhiteSpace(taker._id))
                Taker = manager.GetPgUser(taker);
        }
Example #3
0
        public void ShouldNotAddMetadata_WhenValueIsNull()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                ttc.ConfigureMetadata(m =>
                {
                    m.IpAddress = "192.168.2.23";
                    m.Country   = null;
                    m.Device    = string.Empty;
                });

                EntityTracker.TrackAllProperties <POCO>();
                POCO entity = new POCO();

                ttc.POCOes.Add(entity);
                ttc.SaveChanges();

                entity.AssertAuditForAddition(ttc, entity.Id, null,
                                              x => x.Color, x => x.Height, x => x.StartTime, x => x.Id);

                entity.AssertMetadata(ttc, entity.Id, new Dictionary <string, string>
                {
                    ["IpAddress"] = "192.168.2.23",
                    ["Device"]    = string.Empty
                });
            }
        }
Example #4
0
        public void Can_recognise_global_tracking_indicator_when_enabled()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            EntityTracker
            .TrackAllProperties <POCO>();

            POCO model = new POCO
            {
                Color     = "Red",
                Height    = 67.4,
                StartTime = new DateTime(2015, 5, 5)
            };

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                ttc.POCOes.Add(model);
                ttc.SaveChanges();

                model.AssertAuditForAddition(ttc, model.Id, null,
                                             x => x.Color,
                                             x => x.Id,
                                             x => x.Height,
                                             x => x.StartTime);
            }
        }
Example #5
0
        private void AddAnOuting()
        {
            POCO outing = new POCO();

            Console.WriteLine("What type of event? \n" +
                              "1 for Golf \n" +
                              "2 for Bowling \n" +
                              "3 for Amusement Park \n" +
                              "4 for Concert");
            string eventType = Console.ReadLine();

            Console.WriteLine("How many people will be there? ");
            string numberOfPeople = Console.ReadLine();

            Console.WriteLine("What date will it be? ");
            string date = Console.ReadLine();

            Console.WriteLine("What is the cost per person? ");
            string costPerPerson = Console.ReadLine();

            decimal eventCost = int.Parse(numberOfPeople) * decimal.Parse(costPerPerson);

            //Why did it need POCO.Events instead of just (Events) to cast here?
            outing.EventType      = (POCO.Events) int.Parse(eventType);
            outing.NumberofPeople = int.Parse(numberOfPeople);
            outing.Date           = DateTime.Parse(date);
            outing.CostPerPerson  = decimal.Parse(costPerPerson);
            outing.CostOfEvent    = eventCost;

            repoWindow.AddAnOuting(outing);
        }
Example #6
0
        public async Task ShouldAddSingleMetadata_WhenSingleMetadataIsProvided_Async()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                ttc.ConfigureMetadata(m =>
                {
                    m.IpAddress = "192.168.2.23";
                });

                EntityTracker.TrackAllProperties <POCO>();
                POCO entity = new POCO();

                ttc.POCOes.Add(entity);
                await ttc.SaveChangesAsync("bilal");

                entity.AssertAuditForAddition(ttc, entity.Id, "bilal",
                                              x => x.Color, x => x.Height, x => x.StartTime, x => x.Id);

                entity.AssertMetadata(ttc, entity.Id, new Dictionary <string, string>
                {
                    ["IpAddress"] = "192.168.2.23"
                });
            }
        }
        public static void Test()
        {
            POCO poco = new POCO();

            poco.Endpoints.Http.AddRange(new string[] { "http://*:5000", "http://localhost:5000", "http://machinename:5000" });

            poco.Endpoints.Https.Add(new HttpsEndpoint()
            {
                Url = "https://*:5005",
                CertificateRegistryEntry    = "ssl_cert",
                CertificateKeyRegistryEntry = "ssl_key"
            });


            poco.Endpoints.Https.Add(new HttpsEndpoint()
            {
                Url = "https://*:5006",
                CertificateRegistryEntry    = "ssl_cert",
                CertificateKeyRegistryEntry = "ssl_key"
            });

            string json = System.Text.Json.JsonSerializer.Serialize(poco);

            System.Console.WriteLine(json);
        }
Example #8
0
        public void LoggingModelTest()
        {
            var c            = new POCO();
            var actualLine   = Line(c);
            var expectedLine = Line(new POCOLoggingModel());

            Assert.AreEqual(expectedLine, actualLine);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Config"/> class.
        /// </summary>
        /// <param name="poco">The poco.</param>
        /// <param name="filePath">The file path.</param>
        private Config(POCO.Config poco, string filePath) : this()
        {
            var @default = GetDefault();

            TempSchemaPostfix = poco.TempSchemaPostfix ?? @default.TempSchemaPostfix ;

            _filePath = filePath;
        }
        public LauncherInfo(POCO.GamePoco poco)
        {
            Id = poco._id;
            DisplayName = poco.name;
            PlayerCount = poco.player_count;

            IsOfficialGame = true;
            FilePath = "";
            Arguments = "";
        }
Example #11
0
    public static POCO Combine(params POCO[] sources)
    {
        var obj = new POCO();

        for (int i = 0; i < sources.Length; i++)
        {
            merge(sources[i], obj);
        }
        return(obj);
    }
        public void Can_recognise_global_tracking_indicator_when_disabled()
        {
            GlobalTrackingConfig.Enabled = false;
            EntityTracker
            .TrackAllProperties <POCO>();

            POCO model = ObjectFactory.Create <POCO>(false, true, Db);

            model.AssertNoLogs(Db, model.Id);
        }
Example #13
0
        public ActionResult Report(POCO poo)
        {
            if (Request.Form["ddlpr"].ToString() == "Processed")
            {
                var data = from t in db.Applications
                           join p in db.Processed_Applications on t.Id equals p.applicationid
                           where p.comments == "Processed"
                           orderby t.Id ascending
                           select t;
                List <POCO> lst = new List <POCO>();
                foreach (var j in data)
                {
                    POCO pm = new POCO();
                    pm.Id        = j.Id;
                    pm.Name      = j.name;
                    pm.Age       = j.age;
                    pm.DOB       = j.dob;
                    pm.Address   = j.address;
                    pm.Branch_id = j.branch_id;
                    pm.Class_id  = j.classid;

                    lst.Add(pm);
                }
                // Session["datta"] = lst;
                return(View(lst));
            }
            else
            {
                var data1 = (from t in db.Applications
                             join p in db.Processed_Applications on t.Id equals p.applicationid
                             where p.comments != "Processed"
                             select t).ToList();

                Session["datta1"] = data1;
                List <POCO> lst = new List <POCO>();

                foreach (var j in data1)
                {
                    POCO pm = new POCO();
                    pm.Id        = j.Id;
                    pm.Name      = j.name;
                    pm.Age       = j.age;
                    pm.DOB       = j.dob;
                    pm.Address   = j.address;
                    pm.Branch_id = j.branch_id;
                    pm.Class_id  = j.classid;

                    lst.Add(pm);
                }
                // Session["datta"] = lst;
                return(View(lst));
            }
        }
Example #14
0
    static void Main()
    {
        var obj1 = new POCO {
            Field1 = 123
        };
        var obj2 = new POCO {
            Field2 = "abc"
        };
        var merged = POCO.Combine(obj1, obj2);

        Console.WriteLine(merged.Field1);
        Console.WriteLine(merged.Field2);
    }
Example #15
0
        static void Main(string[] args)
        {
            //generics demo
            //Generics.Tester.Test();

            //Delegates and lambdas demo
            //GeneralConcepts.DelegatesAndLambdas.Tester.Test();

            //Linq demo
            GeneralConcepts.Linq.Tester.Test();

            var poco = new POCO();
        }
        public void Can_recognise_global_tracking_indicator_when_disabled()
        {
            GlobalTrackingConfig.Enabled = false;
            EntityTracker
            .TrackAllProperties <POCO>();

            POCO model = ObjectFactory <POCO> .Create();

            db.POCOs.Add(model);
            db.SaveChanges();

            model.AssertNoLogs(db, model.Id);
        }
Example #17
0
 public void AddAdmin(POCO.Admin pocoAdmin, ref List<string> errors)
 {
     admin db_Admin = new admin();
     try
     {
         db_Admin.First = pocoAdmin.FirstName;
         db_Admin.Last = pocoAdmin.LastName;
         this.context.admins.Add(db_Admin);
         this.context.SaveChanges();
     }
     catch (Exception e)
     {
         errors.Add("Error occured in AdminRepository.AddAdminById: " + e);
     }
 }
Example #18
0
        public void LoggingModelTestWithValues()
        {
            var s0 = "This string should be logged";
            var s1 = "This string should also be logged";
            var c  = new POCO()
            {
                publicStringField    = s0,
                PublicStringProperty = s1
            };
            var line = Line(c);

            Assert.IsTrue(
                line.Contains(s0) && line.Contains(s1),
                message: $"line didn't contain:\n{s0} \nand {s1}"
                );
        }
Example #19
0
        public void Can_recognise_global_tracking_indicator_when_disabled()
        {
            GlobalTrackingConfig.Enabled = false;

            EntityTracker
            .TrackAllProperties <POCO>()
            .Except(x => x.StartTime)
            .And(x => x.Color);

            POCO model = ObjectFactory.Create <POCO>();

            Db.POCOs.Add(model);
            Db.SaveChanges();

            model.AssertNoLogs(Db, model.Id);
        }
Example #20
0
        public void AddTa(POCO.Ta ta, ref List<string> errors)
        {
            var db_Ta = new TeachingAssistant();

            try
            {
                db_Ta.ta_type_id = int.Parse(ta.TaType);
                db_Ta.first = ta.FirstName;
                db_Ta.last = ta.LastName;
                this.context.TeachingAssistants.Add(db_Ta);
                this.context.SaveChanges();
            }
            catch (Exception e)
            {
                errors.Add("Error occured in TaRepository.AddTa: " + e);
            }
        }
Example #21
0
        public void AddCourse(POCO.Course c, ref List<string> errors)
        {
            var db_course = new course();

            try
            {
                db_course.course_level = c.Level;
                db_course.course_description = c.Description;
                db_course.course_title = c.Title;
                this.context.courses.Add(db_course);
                this.context.SaveChanges();
            }
            catch (Exception e)
            {
                errors.Add("Error occured in CourseRepository.AddCourse: " + e);
            }
        }
Example #22
0
        public Match(POCO.MatchPoco poco)
        {
            Id = poco._id;
            MatchHash = poco.match_hash;
            IsBetting = poco.betting;
            Map = poco.map;
            TeamSize = poco.team_size;

            if (poco.bets != null)
            {
                foreach (POCO.BetPoco bet in poco.bets)
                {
                    Bet item = new Bet(bet);
                    Bets.Add(item);
                }
            }
        }
 public GameRoomItem(POCO.GameRoomPoco poco)
 {
     Id = poco._id;
     GameId = poco.game_id;
     Description = poco.description;
     MaxMemberCount = poco.max_member_count;
     MemberCount = poco.member_count;
     Position = poco.position;
     IsLocked = poco.is_locked;
     Password = poco.password;
     IsAdvertising = poco.is_advertising;
     IsBetting = poco.betting;
     BettingType = poco.betting_type;
     IsTeamBotPlaced = poco.is_team_bot_placed;
     Owner = UserDataManager.UserData.GetPgUser(poco.owner);
     FillAdmins(poco.admins);
 }
Example #24
0
 public void Set(POCO.Person person)
 {
     if (person.Id == 0)
     {
       _context.Peoples.Add(person);
     }
     else
     {
         var personToUpdate = _context.Peoples.Single(x => x.Id == person.Id);
         personToUpdate.FirstName = person.FirstName;
         personToUpdate.LastName = person.LastName;
         personToUpdate.Job = person.Job;
         personToUpdate.Salary = person.Salary;
         personToUpdate.BirthDate = person.BirthDate;
         personToUpdate.EducationLevelId = person.EducationLevelId;
         personToUpdate.JobLevelId = person.JobLevelId;
     }
     _context.SaveChanges();
 }
        public void Can_recognise_global_tracking_indicator_when_enabled()
        {
            EntityTracker.TrackAllProperties <POCO>();

            POCO model = new POCO
            {
                Color     = "Red",
                Height    = 67.4,
                StartTime = new DateTime(2015, 5, 5)
            };

            db.POCOs.Add(model);
            db.SaveChanges();

            model.AssertAuditForAddition(db, model.Id, null,
                                         x => x.Color,
                                         x => x.Id,
                                         x => x.Height,
                                         x => x.StartTime);
        }
        public async Task ShouldAddSingleMetadata_WhenSingleMetadataIsProvided_Async()
        {
            Db.ConfigureMetadata(m =>
            {
                m.IpAddress = "192.168.2.23";
            });

            EntityTracker.TrackAllProperties <POCO>();
            POCO entity = ObjectFactory.Create <POCO>();

            Db.POCOs.Add(entity);
            await Db.SaveChangesAsync("bilal");

            entity.AssertAuditForAddition(Db, entity.Id, "bilal",
                                          x => x.Color, x => x.Height, x => x.StartTime, x => x.Id);

            entity.AssertMetadata(Db, entity.Id, new Dictionary <string, string>
            {
                ["IpAddress"] = "192.168.2.23"
            });
        }
Example #27
0
        public void Can_recognise_global_tracking_indicator_when_disabled()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            GlobalTrackingConfig.Enabled = false;

            EntityTracker
            .TrackAllProperties <POCO>()
            .Except(x => x.StartTime)
            .And(x => x.Color);

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                POCO model = new POCO();
                ttc.POCOes.Add(model);
                ttc.SaveChanges();

                model.AssertNoLogs(ttc, model.Id);
            }
        }
Example #28
0
        private static void Main(String[] args)
        {
            // Create your object
            var input = new POCO
            {
                Cake      = true,
                Vegetable = false,
                Sub       = new SubPOCO
                {
                    SubValue = true
                }
            };

            // Serialize like you normally would
            var payload = LightWeight.Serialize(input);

            // Use the outputted byte array
            Console.WriteLine(BitConverter.ToString(payload));

            // Deserialize like you normally would
            var output = LightWeight.Deserialize <POCO>(payload);
        }
Example #29
0
        public void LoadData()
        {
            POCO a = new POCO(2, 3, DateTime.Parse("	2019-07-31	"), 50.98);
            POCO b = new POCO(1, 5, DateTime.Parse("	2019-12-24	"), 81.48);
            POCO c = new POCO(1, 8, DateTime.Parse("	2019-09-12	"), 15.61);
            POCO d = new POCO(2, 12, DateTime.Parse("	2019-05-03	"), 13.68);
            POCO e = new POCO(4, 4, DateTime.Parse("	2019-04-24	"), 63.4);
            POCO f = new POCO(3, 11, DateTime.Parse("	2019-05-24	"), 43.04);
            POCO g = new POCO(1, 2, DateTime.Parse("	2019-11-30	"), 7.04);
            POCO h = new POCO(1, 3, DateTime.Parse("	2019-03-24	"), 25.49);
            POCO i = new POCO(2, 9, DateTime.Parse("	2019-05-26	"), 83.75);
            POCO j = new POCO(2, 1, DateTime.Parse("	2019-01-03	"), 51.55);
            POCO k = new POCO(4, 12, DateTime.Parse("	2019-07-13	"), 17.59);
            POCO l = new POCO(4, 1, DateTime.Parse("	2019-03-30	"), 40.77);
            POCO m = new POCO(2, 10, DateTime.Parse("	2019-10-27	"), 53.85);
            POCO n = new POCO(3, 5, DateTime.Parse("	2019-01-21	"), 0.21);
            POCO o = new POCO(1, 7, DateTime.Parse("	2019-02-14	"), 31.73);
            POCO p = new POCO(2, 10, DateTime.Parse("	2019-04-07	"), 19.69);
            POCO q = new POCO(4, 6, DateTime.Parse("	2019-03-20	"), 15.48);


            ListOfOutings.Add(a);
            ListOfOutings.Add(b);
            ListOfOutings.Add(c);
            ListOfOutings.Add(d);
            ListOfOutings.Add(e);
            ListOfOutings.Add(f);
            ListOfOutings.Add(h);
            ListOfOutings.Add(i);
            ListOfOutings.Add(j);
            ListOfOutings.Add(k);
            ListOfOutings.Add(l);
            ListOfOutings.Add(m);
            ListOfOutings.Add(n);
            ListOfOutings.Add(o);
            ListOfOutings.Add(p);
            ListOfOutings.Add(q);
        }
Example #30
0
        public void AddInstructor(POCO.Instructor ins, ref List<string> errors)
        {
            var db_instructor = new instructor();
            var db_staff = new staff();

            try
            {
                db_instructor.first_name = ins.FirstName;
                db_instructor.last_name = ins.LastName;
                db_instructor.title = ins.Title;
                db_staff.First = ins.FirstName;
                db_staff.Last = ins.LastName;
                db_staff.email = ins.FirstName.ToLower().Substring(0, 1) + ins.LastName.ToLower() + "@ucsd.edu";
                db_staff.password = ins.Password;
                this.context.instructors.Add(db_instructor);
                this.context.staffs.Add(db_staff);
                this.context.SaveChanges();
            }
            catch (Exception e)
            {
                errors.Add("Error occured in InstructorRepository.AddInstructor: " + e);
            }
        }
        private void refreshFields(POCO.Client client)
        {
            clearFields();
            if (client == null)
            {
                MessageBox.Show("Not Found!");
            }
            else
            {
                this.firstName.Text = client.FirstName;
                this.clientId = client.ID;
                this.lastName.Text = client.LastName;
                this.cnp.Text = client.CNP;
                this.icn.Text = client.ICN;
                this.address.Text = client.Address;

                foreach (var a in client.Accounts)
                {
                    accountList.Rows.Add(new object[] { a.ID, a.Number, a.Type, a.Currency, a.Amount, a.CreationDate });
                }
                searchCNP.Clear();
            }
        }
Example #32
0
        public Resultat<ParcoursDto> GetParcoursSessionByClient(POCO.Client client)
        {
            return Resultat<ParcoursDto>.SafeExecute<ParcoursService>(
                  result =>
                  {
                      ParcoursDto currentParcoursDto = new ParcoursDto();

                      currentParcoursDto.GraphDictionnary = new Dictionary<OffreReferenceDto, IList<SessionHistoriqueDto>>();

                      context.LoadProperty(client, c => c.Offres);
                      var offres = context.Utilisateurs.OfType<Client>()
                          .Where(c => c.Id == client.Id)
                          .Select(c => c.Offres).First();

                      foreach (Offre offre in offres)
                      {
                          var offreReferences = context.OffresReferences.Where(or => or.Id == offre.OffresReferencesId).FirstOrDefault();
                          var offreSession = context.Utilisateurs_ClientSessions.Where(o => o.OffreId == offre.OffresReferencesId).Where(o => o.Utilisateurs_ClientId == client.Id).Where(o => o.Note != null).ToList<Utilisateurs_ClientSessions>();

                          IList<SessionHistoriqueDto> currentListHistoricalSessionDto = new List<SessionHistoriqueDto>();

                          foreach (Utilisateurs_ClientSessions currentUtilisateurSession in offreSession)
                          {

                              var ReelSession = context.Sessions.Where(s => s.Id == currentUtilisateurSession.SessionId).FirstOrDefault();
                              if (ReelSession.HeureFin.HasValue)
                              {
                                  currentListHistoricalSessionDto.Add(new SessionHistoriqueDto() { Date = (DateTime)ReelSession.HeureFin, Note = Convert.ToDouble(currentUtilisateurSession.Note) });
                              }

                          }

                          currentParcoursDto.GraphDictionnary.Add(new OffreReferenceDto() { Name = offreReferences.Nom }, currentListHistoricalSessionDto);
                      }
                      result.Valeur = currentParcoursDto;
                  });
        }
        public void ShouldNotAddMetadata_WhenValueIsNull()
        {
            Db.ConfigureMetadata(m =>
            {
                m.IpAddress = "192.168.2.23";
                m.Country   = null;
                m.Device    = string.Empty;
            });

            EntityTracker.TrackAllProperties <POCO>();
            POCO entity = ObjectFactory.Create <POCO>();

            Db.POCOs.Add(entity);
            Db.SaveChanges();

            entity.AssertAuditForAddition(Db, entity.Id, null,
                                          x => x.Color, x => x.Height, x => x.StartTime, x => x.Id);

            entity.AssertMetadata(Db, entity.Id, new Dictionary <string, string>
            {
                ["IpAddress"] = "192.168.2.23",
                ["Device"]    = string.Empty
            });
        }
        public ActionResult Report()
        {
            var data = from t in oaf.Applications
                       join p in oaf.Processed_applications on t.Id equals p.App_id
                       orderby t.Id ascending
                       select t;
            List <POCO> lst = new List <POCO>();

            foreach (var j in data)
            {
                POCO pm = new POCO();
                pm.Id        = j.Id;
                pm.Name      = j.Name;
                pm.Age       = j.Age;
                pm.DOB       = j.DOB;
                pm.Address   = j.Address;
                pm.Branch_id = j.Branch_id;
                pm.Class_id  = j.Class_id;

                lst.Add(pm);
            }

            return(View(lst));
        }
 public void Update(POCO.GameRoomPoco poco)
 {
     Description = poco.description;
     MaxMemberCount = poco.max_member_count;
     MemberCount = poco.member_count;
     Password = poco.password;
     IsLocked = poco.is_locked;
     IsBetting = poco.betting;
     BettingType = poco.betting_type;
     IsAdvertising = poco.is_advertising;
     Owner = UserDataManager.UserData.GetPgUser(poco.owner);
     MatchId = poco.match_id;
     IsTeamBotPlaced = poco.is_team_bot_placed;
 }
 public POCO.FederalDistrict AddFederalDistrict(POCO.FederalDistrict federalDistrict)
 {
     throw new NotImplementedException();
 }
 public POCO.FederalSubject AddFederalSubject(POCO.FederalSubject federationSubject)
 {
     throw new NotImplementedException();
 }
Example #38
0
        private void RemoveObsoleteValues(POCO.Config poco, Config @default)
        {
            if (CrmSvcUtilRelativePath == @"CrmSvcUtil Ref\crmsvcutil.exe")
            {
                // 5.14.2015 XTB changed to use the Plugins Directory, but then MEF changed Paths to be realtive to Dll. 
                CrmSvcUtilRelativePath = @default.CrmSvcUtilRelativePath;
            }
            foreach (var value in poco.ExtensionArguments.Where(a => string.Equals(a.Value, "DLaB.CrmSvcUtilExtensions.Entity.OverridePropertyNames,DLaB.CrmSvcUtilExtensions", StringComparison.InvariantCultureIgnoreCase)).ToList())
            {
                // Pre 2.13.2016, this was the default value.  Replaced with a single naming service that both Entities and OptionSets can use
                poco.ExtensionArguments.Remove(value);
            }

            // Pre 2.13.2016, this was the default value.  Not Needed Anymore
            var old = "OpportunityProduct.OpportunityStateCode,opportunity_statuscode|" +
                      "OpportunityProduct.PricingErrorCode,qooi_pricingerrorcode|" +
                      "ResourceGroup.GroupTypeCode,constraintbasedgroup_grouptypecode";
            if (string.Equals(poco.ExtensionConfig.PropertyEnumMappings, old, StringComparison.InvariantCultureIgnoreCase) || string.Equals(poco.ExtensionConfig.PropertyEnumMappings, old + "|", StringComparison.InvariantCultureIgnoreCase))
            {
                poco.ExtensionConfig.PropertyEnumMappings = string.Empty;
            }
        }
Example #39
0
        void TransformCode(TreeNode Node, ToolStripMenuItem menu)
        {
            if (Node.ToolTipText != ENodeType.DbTable.ToString())
            {
                return;
            }

            var    columns   = DB.GetDbColumns(Node.Parent.Tag.ToString(), ((DbTable)Node.Tag).TableName);
            var    tableName = ((DbTable)Node.Tag).TableName;
            var    package   = "com.cnblogs.lzrabbit";
            var    ns        = "com.cnblogs.lzrabbit";
            T4Base t4;

            string str = this.menuCode.DropDownItems.Cast <ToolStripMenuItem>().Single(item => item.Checked).Text;

            switch (menu.Text)
            {
            case "POCO":
                t4 = new POCO
                {
                    Package   = package,
                    Namespace = ns,
                    DbColumns = columns,
                    TableName = tableName,
                };
                break;

            case "POJO":
                t4 = new POJO
                {
                    Package   = package,
                    Namespace = ns,
                    DbColumns = columns,
                    TableName = tableName,
                };
                break;

            case "MyBatis":
                if (DB.DbType == EDbType.MySql)
                {
                    t4 = new MyBatis_MySQL
                    {
                        Package   = package,
                        Namespace = ns,
                        DbColumns = columns,
                        TableName = tableName,
                    }
                }
                ;
                else
                {
                    t4 = new MyBatis_SQLServer
                    {
                        Package   = package,
                        Namespace = ns,
                        DbColumns = columns,
                        TableName = tableName,
                    }
                };

                break;

            default:
                t4 = new POCO
                {
                    Package   = package,
                    Namespace = ns,
                    DbColumns = columns,
                    TableName = tableName,
                };
                break;
            }
            this.txtCode.Text = t4.TransformText();
        }
Example #40
0
 public void Delete(POCO.Person person)
 {
     var personToDelete = _context.Peoples.Single(x => x.Id == person.Id);
     _context.Peoples.Remove(personToDelete);
     _context.SaveChanges();
 }
Example #41
0
        public float Get_Couv(IRepositoryVague<POCO.Donnees.Vague, Guid> vagueRepository, List<InsertionViewTv> insertionViewTvs, List<InsertionViewPr> insertionViewPrs, List<InsertionViewRd> insertionViewRds,
               Filter filter, POCO.Donnees.Vague vague)
        {
            var insertions=new List<InsertionTv>();
               foreach (var insertionViewTv in insertionViewTvs)
               {
                   var insertion = new InsertionTv();
                   insertion.Date = insertionViewTv.Start;

                   int quart = int.Parse(((int)insertionViewTv.Start.TimeOfDay.TotalMinutes / 15).ToString());
                   quart = (quart + 76) % 96;
                   var jour = (int)insertionViewTv.Start.DayOfWeek;
                   jour = ((jour) % 7) + 1;
                   insertion.NumeroQuartHeure = quart;
                   insertion.SupportTv = insertionViewTv.SupportTv;
                   insertions.Add(insertion);
               }

               var planTV = new PlanTV(){
                   Name = "test",
                   InsertionTvs = insertions,
                   id = Guid.NewGuid()
               };

            var criterionTvSupport = new Criterion("planTv", planTV, CriteriaOperator.Equal);
            var criterionSignlalitiques = new Criterion("Signalitique", planTV.GetSignalitique(filter,vague), CriteriaOperator.Equal);
            var QueryTv = new Query();
            QueryTv.Add(criterionTvSupport);
            QueryTv.Add(criterionSignlalitiques);
            var indicateur=vagueRepository.GetIndicateurRadioTele(QueryTv, vague);
            return indicateur.Gouverture;
        }
Example #42
0
        public Resultat<IList<OffresReference>> GetIListOffreByClient(POCO.Client client)
        {
            return Resultat<IList<OffresReference>>.SafeExecute<PlanningService>(
            result =>
               {

               IList<OffresReference> resultatOffresReferenceRequete = new List<OffresReference>();

               // On recupere tout les packs
               var OffersForCurrentUser = context.Offres.Where(o => o.ClientId == client.Id).ToList();

               foreach(Offre offre in OffersForCurrentUser)
               {
               var OffresReferences = context.OffresReferences.Where(or => or.Id == offre.OffresReferencesId).First();
               resultatOffresReferenceRequete.Add(OffresReferences);
               }

               result.Valeur = resultatOffresReferenceRequete;

               });
        }
Example #43
0
        ////good method for validation when adding new course
        public bool IsNotDuplicateAdmin(POCO.Admin adminPoco, ref List<string> errors)
        {
            var db_Admin = new admin();

            try
            {
                db_Admin = this.context.admins.Find(db_Admin);

                if (db_Admin == null)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                errors.Add("Error occured in AdminRepository.IsDuplicateAdmin: " + e);
            }

            return true;
        }
 public void DeleteEnterprise(POCO.Enterprise enterprise)
 {
     throw new NotImplementedException();
 }
Example #45
0
        public void UpdateAdmin(POCO.Admin adminPoco, ref List<string> errors)
        {
            var db_Admin = new admin();

            try
            {
                db_Admin = this.context.admins.Find(adminPoco.Id);
                db_Admin.First = adminPoco.FirstName;
                db_Admin.Last = adminPoco.LastName;
                this.context.SaveChanges();
            }
            catch (Exception e)
            {
                errors.Add("Error occured in AdminRepository.UpdateAdmin: " + e);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EarlyBoundGeneratorConfig"/> class.
        /// </summary>
        /// <param name="poco">The poco.</param>
        /// <param name="filePath">The file path.</param>
        private EarlyBoundGeneratorConfig(POCO.Config poco, string filePath)
        {
            var @default = GetDefault();
            var defaultConfig = @default.ExtensionConfig;
            var pocoConfig = poco.ExtensionConfig;

            CrmSvcUtilRelativePath = poco.CrmSvcUtilRelativePath ?? @default.CrmSvcUtilRelativePath;
            RemoveObsoleteValues(poco, @default);

            AudibleCompletionNotification = poco.AudibleCompletionNotification.GetValueOrDefault(@default.AudibleCompletionNotification);
            IncludeCommandLine = poco.IncludeCommandLine.GetValueOrDefault(@default.IncludeCommandLine);
            MaskPassword = poco.MaskPassword.GetValueOrDefault(@default.MaskPassword);


            if (new Version(poco.Version) < new Version("1.2016.6.1"))
            {
                // Storing of UnmappedProperties and EntityAttributeSpecified Names switched from Key,Value1,Value2|Key,Value1,Value2 to Key:Value1,Value2|Key:Value1,Value2
                // Also convert from a List to a HashSet
                pocoConfig.EntityAttributeSpecifiedNames = ConvertNonColonDelimitedDictionaryListToDictionaryHash(pocoConfig.EntityAttributeSpecifiedNames);
                pocoConfig.UnmappedProperties = ConvertNonColonDelimitedDictionaryListToDictionaryHash(pocoConfig.UnmappedProperties);

            }

            ExtensionConfig = new ExtensionConfig
            {
                ActionsToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.ActionsToSkip, defaultConfig.ActionsToSkip),
                AddDebuggerNonUserCode = pocoConfig.AddDebuggerNonUserCode.GetValueOrDefault(defaultConfig.AddDebuggerNonUserCode),
                AddNewFilesToProject = pocoConfig.AddNewFilesToProject.GetValueOrDefault(defaultConfig.AddNewFilesToProject),
                CreateOneFilePerAction = pocoConfig.CreateOneFilePerAction.GetValueOrDefault(defaultConfig.CreateOneFilePerAction),
                CreateOneFilePerEntity = pocoConfig.CreateOneFilePerEntity.GetValueOrDefault(defaultConfig.CreateOneFilePerEntity),
                CreateOneFilePerOptionSet = pocoConfig.CreateOneFilePerOptionSet.GetValueOrDefault(defaultConfig.CreateOneFilePerOptionSet),
                EntitiesToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.EntitiesToSkip, defaultConfig.EntitiesToSkip),
                EntityAttributeSpecifiedNames = AddMissingDictionaryHashDefaultValues(pocoConfig.EntityAttributeSpecifiedNames, defaultConfig.EntityAttributeSpecifiedNames),
                GenerateAttributeNameConsts = pocoConfig.GenerateAttributeNameConsts.GetValueOrDefault(defaultConfig.GenerateAttributeNameConsts),
                GenerateAnonymousTypeConstructor = pocoConfig.GenerateAnonymousTypeConstructor.GetValueOrDefault(defaultConfig.GenerateAnonymousTypeConstructor),
                GenerateEntityRelationships = pocoConfig.GenerateEntityRelationships.GetValueOrDefault(defaultConfig.GenerateEntityRelationships),
                GenerateEnumProperties = pocoConfig.GenerateEnumProperties.GetValueOrDefault(defaultConfig.GenerateEnumProperties),
                InvalidCSharpNamePrefix = pocoConfig.InvalidCSharpNamePrefix ?? defaultConfig.InvalidCSharpNamePrefix,
                MakeReadonlyFieldsEditable = pocoConfig.MakeReadonlyFieldsEditable ?? defaultConfig.MakeReadonlyFieldsEditable,
                LocalOptionSetFormat = pocoConfig.LocalOptionSetFormat ?? defaultConfig.LocalOptionSetFormat,
                OptionSetsToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.OptionSetsToSkip, defaultConfig.OptionSetsToSkip),
                PropertyEnumMappings = AddPipeDelimitedMissingDefaultValues(pocoConfig.PropertyEnumMappings, defaultConfig.PropertyEnumMappings),
                RemoveRuntimeVersionComment = pocoConfig.RemoveRuntimeVersionComment.GetValueOrDefault(defaultConfig.RemoveRuntimeVersionComment),
                UnmappedProperties = AddMissingDictionaryHashDefaultValues(pocoConfig.UnmappedProperties, defaultConfig.UnmappedProperties),
                UseDeprecatedOptionSetNaming = pocoConfig.UseDeprecatedOptionSetNaming.GetValueOrDefault(defaultConfig.UseDeprecatedOptionSetNaming),
                UseTfsToCheckoutFiles = pocoConfig.UseTfsToCheckoutFiles.GetValueOrDefault(defaultConfig.UseTfsToCheckoutFiles),
                UseXrmClient = pocoConfig.UseXrmClient.GetValueOrDefault(defaultConfig.UseXrmClient)
            };

            ExtensionArguments = AddMissingArguments(poco.ExtensionArguments, @default.ExtensionArguments);
            UserArguments = AddMissingArguments(poco.UserArguments, @default.UserArguments);
            Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();


            _filePath = filePath;
        }
Example #47
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Config"/> class.
        /// </summary>
        /// <param name="poco">The poco.</param>
        /// <param name="filePath">The file path.</param>
        private Config(POCO.Config poco, string filePath)
        {
            var @default = GetDefault();
            var defaultConfig = @default.ExtensionConfig;
            var pocoConfig = poco.ExtensionConfig;

            CrmSvcUtilRelativePath = poco.CrmSvcUtilRelativePath ?? @default.CrmSvcUtilRelativePath;
            RemoveObsoleteValues(poco, @default);

            IncludeCommandLine = poco.IncludeCommandLine.GetValueOrDefault(@default.IncludeCommandLine);
            MaskPassword = poco.MaskPassword.GetValueOrDefault(@default.MaskPassword);
            ExtensionConfig = new ExtensionConfig
            {
                ActionsToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.ActionsToSkip, defaultConfig.ActionsToSkip),
                AddDebuggerNonUserCode = pocoConfig.AddDebuggerNonUserCode.GetValueOrDefault(defaultConfig.AddDebuggerNonUserCode),
                AddNewFilesToProject = pocoConfig.AddNewFilesToProject.GetValueOrDefault(defaultConfig.AddNewFilesToProject),
                CreateOneFilePerAction = pocoConfig.CreateOneFilePerAction.GetValueOrDefault(defaultConfig.CreateOneFilePerAction),
                CreateOneFilePerEntity = pocoConfig.CreateOneFilePerEntity.GetValueOrDefault(defaultConfig.CreateOneFilePerEntity),
                CreateOneFilePerOptionSet = pocoConfig.CreateOneFilePerOptionSet.GetValueOrDefault(defaultConfig.CreateOneFilePerOptionSet),
                EntitiesToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.EntitiesToSkip, defaultConfig.EntitiesToSkip),
                EntityAttributeSpecifiedNames = AddPipeThenCommaDelimitedMissingDefaultValues(pocoConfig.EntityAttributeSpecifiedNames, defaultConfig.EntityAttributeSpecifiedNames),
                GenerateAttributeNameConsts = pocoConfig.GenerateAttributeNameConsts.GetValueOrDefault(defaultConfig.GenerateAttributeNameConsts),
                GenerateAnonymousTypeConstructor = pocoConfig.GenerateAnonymousTypeConstructor.GetValueOrDefault(defaultConfig.GenerateAnonymousTypeConstructor),
                GenerateEntityRelationships = pocoConfig.GenerateEntityRelationships.GetValueOrDefault(defaultConfig.GenerateEntityRelationships),
                GenerateEnumProperties = pocoConfig.GenerateEnumProperties.GetValueOrDefault(defaultConfig.GenerateEnumProperties),
                InvalidCSharpNamePrefix = pocoConfig.InvalidCSharpNamePrefix ?? defaultConfig.InvalidCSharpNamePrefix,
                MakeReadonlyFieldsEditable = pocoConfig.MakeReadonlyFieldsEditable ?? defaultConfig.MakeReadonlyFieldsEditable,
                LocalOptionSetFormat = pocoConfig.LocalOptionSetFormat ?? defaultConfig.LocalOptionSetFormat,
                OptionSetsToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.OptionSetsToSkip, defaultConfig.OptionSetsToSkip),
                PropertyEnumMappings = AddPipeDelimitedMissingDefaultValues(pocoConfig.PropertyEnumMappings, defaultConfig.PropertyEnumMappings),
                RemoveRuntimeVersionComment = pocoConfig.RemoveRuntimeVersionComment.GetValueOrDefault(defaultConfig.RemoveRuntimeVersionComment),
                UnmappedProperties = AddPipeThenCommaDelimitedMissingDefaultValues(pocoConfig.UnmappedProperties, defaultConfig.UnmappedProperties),
                UseDeprecatedOptionSetNaming = pocoConfig.UseDeprecatedOptionSetNaming.GetValueOrDefault(defaultConfig.UseDeprecatedOptionSetNaming),
                UseTfsToCheckoutFiles = pocoConfig.UseTfsToCheckoutFiles.GetValueOrDefault(defaultConfig.UseTfsToCheckoutFiles),
                UseXrmClient = pocoConfig.UseXrmClient.GetValueOrDefault(defaultConfig.UseXrmClient)
            };

            ExtensionArguments = AddMissingArguments(poco.ExtensionArguments, @default.ExtensionArguments);
            UserArguments = AddMissingArguments(poco.UserArguments, @default.UserArguments);
            Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            _filePath = filePath;
        }
 public POCO.Enterprise AddEnterprise(POCO.Enterprise enterprise)
 {
     throw new NotImplementedException();
 }
 public int Save(POCO.Account account)
 {
     Account a = Mapper.Map<POCO.Account, Account>(account);
     return repository.saveAccount(a);
 }
Example #50
0
        public Resultat<IList<TypeSession>> GetListTypeSessionByOffre(POCO.Client client, int offreId)
        {
            return Resultat<IList<TypeSession>>.SafeExecute<PlanningService>(
                       result =>
                       {

                           var currentClient = context.Utilisateurs.OfType<Client>().Where(u => u.Id == client.Id).First();

                           List<int> typeSession = new List<int>();

                           if ((bool)client.IsCoded)
                           {
                               typeSession = context.OffresReferencesTypeSessions
                              .Where(orts => orts.OffresReferencesId == offreId).Where(orts => orts.TypeSessionId != 5)
                              .Select(orts => orts.TypeSessionId).ToList();
                           }
                           else
                           {
                               typeSession = context.OffresReferencesTypeSessions
                               .Where(orts => orts.OffresReferencesId == offreId)
                               .Select(orts => orts.TypeSessionId).ToList();

                           }

                           IList<TypeSession> TypeSessionByOffre = new List<TypeSession>();

                           foreach (int TypeSession in typeSession)
                           {

                               var typeSessionFinalObject = context.TypeSessions
                                   .Where(Ts => Ts.Id == TypeSession).FirstOrDefault();
                               TypeSessionByOffre.Add(typeSessionFinalObject);
                           }

                           result.Valeur = TypeSessionByOffre;
                       });
        }
Example #51
0
 //add to the list of outings (spring event, holiday party)
 // List.add
 public void AddAnOuting(POCO newOuting)
 {
     ListOfOutings.Add(newOuting);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="Config"/> class.
        /// </summary>
        /// <param name="poco">The poco.</param>
        /// <param name="filePath">The file path.</param>
        private Config(POCO.Config poco, string filePath)
        {
            var @default = GetDefault();
            var defaultConfig = @default.ExtensionConfig;
            var pocoConfig = poco.ExtensionConfig;

            CrmSvcUtilRelativePath = poco.CrmSvcUtilRelativePath ?? @default.CrmSvcUtilRelativePath;
            if (CrmSvcUtilRelativePath == @"CrmSvcUtil Ref\crmsvcutil.exe")
            {
                // 5.14.2015 XTB changed to use the Plugins Directory, but then MEF changed Paths to be realtive to Dll. 
                CrmSvcUtilRelativePath = @default.CrmSvcUtilRelativePath;
            }
            IncludeCommandLine = poco.IncludeCommandLine.GetValueOrDefault(@default.IncludeCommandLine);
            MaskPassword = poco.MaskPassword.GetValueOrDefault(@default.MaskPassword);
            ExtensionConfig = new ExtensionConfig
            {
                ActionsToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.ActionsToSkip, defaultConfig.ActionsToSkip),
                AddDebuggerNonUserCode = pocoConfig.AddDebuggerNonUserCode.GetValueOrDefault(defaultConfig.AddDebuggerNonUserCode),
                AddNewFilesToProject = pocoConfig.AddNewFilesToProject.GetValueOrDefault(defaultConfig.AddNewFilesToProject),
                CreateOneFilePerAction = pocoConfig.CreateOneFilePerAction.GetValueOrDefault(defaultConfig.CreateOneFilePerAction),
                CreateOneFilePerEntity = pocoConfig.CreateOneFilePerEntity.GetValueOrDefault(defaultConfig.CreateOneFilePerEntity),
                CreateOneFilePerOptionSet = pocoConfig.CreateOneFilePerOptionSet.GetValueOrDefault(defaultConfig.CreateOneFilePerOptionSet),
                EntitiesToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.EntitiesToSkip, defaultConfig.EntitiesToSkip),
                EntityAttributeSpecifiedNames = AddPipeThenCommaDelimitedMissingDefaultValues(pocoConfig.EntityAttributeSpecifiedNames, defaultConfig.EntityAttributeSpecifiedNames),
                GenerateAttributeNameConsts = pocoConfig.GenerateAttributeNameConsts.GetValueOrDefault(defaultConfig.GenerateAttributeNameConsts),
                GenerateAnonymousTypeConstructor = pocoConfig.GenerateAnonymousTypeConstructor.GetValueOrDefault(defaultConfig.GenerateAnonymousTypeConstructor),
                GenerateEnumProperties = pocoConfig.GenerateEnumProperties.GetValueOrDefault(defaultConfig.GenerateEnumProperties),
                OptionSetsToSkip = AddPipeDelimitedMissingDefaultValues(pocoConfig.OptionSetsToSkip, defaultConfig.OptionSetsToSkip),
                PropertyEnumMappings = AddPipeDelimitedMissingDefaultValues(pocoConfig.PropertyEnumMappings, defaultConfig.PropertyEnumMappings),
                RemoveRuntimeVersionComment = pocoConfig.RemoveRuntimeVersionComment.GetValueOrDefault(defaultConfig.RemoveRuntimeVersionComment),
                UnmappedProperties = AddPipeThenCommaDelimitedMissingDefaultValues(pocoConfig.UnmappedProperties, defaultConfig.UnmappedProperties),
                UseTfsToCheckoutFiles = pocoConfig.UseTfsToCheckoutFiles.GetValueOrDefault(defaultConfig.UseTfsToCheckoutFiles),
                UseXrmClient = pocoConfig.UseXrmClient.GetValueOrDefault(defaultConfig.UseXrmClient)
            };

            ExtensionArguments = AddMissingArguments(poco.ExtensionArguments, @default.ExtensionArguments);
            UserArguments = AddMissingArguments(poco.UserArguments, @default.UserArguments);
            Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            _filePath = filePath;
        }
Example #53
0
    public void AddPocoToPacket(Packet packet, POCO poco)
    {
        string pocoStr = JsonUtility.ToJson(poco);

        packet.POCOJson = pocoStr;
    }
        public ActionResult Report(POCO poo)
        {
            var data2 = (from t in oaf.Processed_applications
                         where t.Comments == "Processed"
                         select t).ToList();

            Session["count"] = data2.Count();

            var dd = oaf.Applications.Count();

            Session["dd"] = dd;

            if (Request.Form["ddlpr"].ToString() == "Processed")
            {
                var data = from t in oaf.Applications
                           join p in oaf.Processed_applications on t.Id equals p.App_id
                           where p.Comments == "Processed"
                           orderby t.Id ascending
                           select t;
                List <POCO> lst = new List <POCO>();

                foreach (var j in data)
                {
                    POCO pm = new POCO();
                    pm.Id        = j.Id;
                    pm.Name      = j.Name;
                    pm.Age       = j.Age;
                    pm.DOB       = j.DOB;
                    pm.Address   = j.Address;
                    pm.Branch_id = j.Branch_id;
                    pm.Class_id  = j.Class_id;

                    lst.Add(pm);
                }

                return(View(lst));
            }
            else
            {
                var data1 = (from t in oaf.Applications
                             join p in oaf.Processed_applications on t.Id equals p.App_id
                             where p.Comments != "Processed"
                             select t).ToList();

                Session["datta1"] = data1;
                List <POCO> lst = new List <POCO>();

                foreach (var j in data1)
                {
                    POCO pm = new POCO();
                    pm.Id        = j.Id;
                    pm.Name      = j.Name;
                    pm.Age       = j.Age;
                    pm.DOB       = j.DOB;
                    pm.Address   = j.Address;
                    pm.Branch_id = j.Branch_id;
                    pm.Class_id  = j.Class_id;

                    lst.Add(pm);
                }

                return(View(lst));
            }
        }
Example #55
0
        ////good method for validation when adding new course
        public bool IsNotDuplicateCourse(POCO.Course c, ref List<string> errors)
        {
            try
            {
                var isDuplicate = this.context.courses.Where(
                    x => x.course_description == c.Description &&
                    x.course_level == c.CourseLevel.ToString() &&
                    x.course_title == c.Title).Count() > 0;

                if (isDuplicate)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            catch (Exception e)
            {
                errors.Add("Error occured in CourseRepository.IsDuplicateCourse: " + e);
            }

            return false;
        }
Example #56
0
        ////good method for validation when adding new course
        public bool IsDuplicateCourse(POCO.Ta ta, ref List<string> errors)
        {
            var db_Ta = new TeachingAssistant();

            try
            {
                db_Ta = this.context.TeachingAssistants.Find(db_Ta);

                if (db_Ta == null)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                errors.Add("Error occured in TaRepository.IsDuplicateCourse: " + e);
            }

            return true;
        }