예제 #1
0
 public void Test_UpdateApplied()
 {
     AppliedDAO applied4 = new AppliedDAO() { AppliedID = 3, ApplicantID = 3, ApplicationID = 3, JobOpeningID = 4 };
     appliedService.UpdateApplied(applied4);
     Assert.AreEqual(appliedService.GetAppliedByID(3).AppliedID, 3);
     Assert.AreEqual(appliedService.GetAppliedByID(3).JobOpeningID, 4);
 }
예제 #2
0
 public void Test_CreateApplied()
 {
     AppliedDAO applied4 = new AppliedDAO() { AppliedID = 4, ApplicantID = 4, ApplicationID = 4, JobOpeningID = 4 };
     appliedService.CreateApplied(applied4);
     Assert.AreEqual(appliedService.GetApplieds().Count, 4);
     Assert.IsNotNull(appliedService.GetAppliedByID(4));
 }
예제 #3
0
 private void initializeApplied(AppliedDAO applied, int id, int appliedID, int applicantID, int applicantionID, int applicationID, int JobOpeningID, DateTime dateApplied)
 {
     applied.ID = id;
     applied.AppliedID = appliedID;
     applied.ApplicantID = applicantID;
     applied.ApplicationID = applicationID;
     applied.JobOpeningID = JobOpeningID;
     applied.DateApplied = dateApplied;
 }
예제 #4
0
        internal void SetUp()
        {
            AppliedDAO applied1 = new AppliedDAO() { AppliedID = 1, ApplicantID = 1, ApplicationID = 1, JobOpeningID = 1 };
            AppliedDAO applied2 = new AppliedDAO() { AppliedID = 2, ApplicantID = 2, ApplicationID = 2, JobOpeningID = 2 };
            AppliedDAO applied3 = new AppliedDAO() { AppliedID = 3, ApplicantID = 3, ApplicationID = 3, JobOpeningID = 3 };

            Applieds.Add(applied1);
            Applieds.Add(applied2);
            Applieds.Add(applied3);
        }
예제 #5
0
 public bool UpdateApplied(AppliedDAO newApp)
 {
     foreach (var a in Applieds)
         if (a.AppliedID == newApp.AppliedID)
         {
             Applieds.Remove(a);
             Applieds.Add(newApp);
             return true;
         }
     return false;
 }
예제 #6
0
 public bool CreateApplied(AppliedDAO a)
 {
     Applieds.Add(a);
     return true;
 }
        public bool CreateApplied(AppliedDAO app)
        {
            Applied a = new Applied
            {
                Applied_ID = app.AppliedID,
                Applicant_ID = app.ApplicantID,
                Application_ID = app.ApplicationID,
                JobOpening_ID = app.JobOpeningID,
                DateApplied = app.DateApplied
            };

            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                db.Applieds.InsertOnSubmit(a);

                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
                }
            }

            return true;
        }
 public bool UpdateApplied(AppliedDAO newApp)
 {
     throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason("Unsupported Method"));
 }
        public IList<AppliedDAO> GetAppliedsByName(string first, string last, string ssn)
        {
            try
            {
                using (AESDatabaseDataContext db = new AESDatabaseDataContext())
                {
                    Applicant applicant = (from a in db.Applicants where a.SSN == ssn && a.FirstName == first && a.LastName == last select a).FirstOrDefault();
                    IList<Applied> applieds = (from a in db.Applieds where a.Applicant_ID == applicant.Applicant_ID select a).ToList();
                    List<AppliedDAO> result = new List<AppliedDAO>();

                    foreach (var a in applieds)
                    {
                        AppliedDAO app = new AppliedDAO
                        {
                            ID = a.Applied_ID,
                            AppliedID = a.Applied_ID,
                            ApplicantID = a.Applicant_ID,
                            ApplicationID = a.Application_ID,
                            JobOpeningID = a.JobOpening_ID,
                            DateApplied = a.DateApplied
                        };

                        result.Add(app);
                    }

                    return result;
                }
            }
            catch (Exception e)
            {
                throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
            }
        }
예제 #10
0
        public IList<AppliedDAO> GetApplieds()
        {
            try
            {
                using (AESDatabaseDataContext db = new AESDatabaseDataContext())
                {
                    IList<Applied> applieds = (from applied in db.Applieds select applied).OrderBy(o => o.Applied_ID).ToList();
                    List<AppliedDAO> result = new List<AppliedDAO>();
                    foreach (var a in applieds)
                    {
                        AppliedDAO temp = new AppliedDAO
                        {
                            ID = a.Applied_ID,
                            AppliedID = a.Applied_ID,
                            ApplicantID = a.Applicant_ID,
                            ApplicationID = a.Application_ID,
                            JobOpeningID = a.JobOpening_ID,
                            DateApplied = a.DateApplied
                        };

                        result.Add(temp);
                    }

                    return (result != null ? result : null);
                }
            }
            catch (Exception e)
            {
                throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
            }
        }
예제 #11
0
        public AppliedDAO GetAppliedByID(int id)
        {
            try
            {
                using (AESDatabaseDataContext db = new AESDatabaseDataContext())
                {
                    Applied applied = db.Applieds.Single(a => a.Applied_ID == id);
                    AppliedDAO result = new AppliedDAO
                    {
                        ID = applied.Applied_ID,
                        AppliedID = applied.Applied_ID,
                        ApplicantID = applied.Applicant_ID,
                        ApplicationID = applied.Application_ID,
                        JobOpeningID = applied.JobOpening_ID,
                        DateApplied = applied.DateApplied
                    };

                    return (result != null ? result : null);
                }
            }
            catch (Exception e)
            {
                throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
            }
        }