Beispiel #1
0
        public Boolean DeleteJobApplication(Seeker s, Job j)
        {
            if (s != null && j != null)
            {
                var v = from application in db.TabJobApplications
                        where application.Applicant == s.Username && application.JId == GetJobIdByTitle(j.Title)
                        select application;

                TabJobApplication app = v.First();

                db.TabJobApplications.DeleteOnSubmit(app);
                db.SubmitChanges();

                return(true);
            }

            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public Boolean InserLogin(Object any)
        {
            if (any is Recruiter)
            {
                Recruiter obj = (Recruiter)any;
                Login     log = new Login();

                log.uname  = obj.Username;
                log.pass   = obj.Password;
                log.type   = Convert.ToString(typeof(Recruiter));
                log.status = "valid";

                db.Logins.InsertOnSubmit(log);
                db.SubmitChanges();

                return(true);
            }

            else if (any is Seeker)
            {
                Seeker obj = (Seeker)any;

                Login log = new Login();

                log.uname  = obj.Username;
                log.pass   = obj.Password;
                log.type   = Convert.ToString(typeof(Seeker));
                log.status = "valid";

                db.Logins.InsertOnSubmit(log);
                db.SubmitChanges();

                return(true);
            }

            else
            {
                return(false);
            }
        }
Beispiel #3
0
        public Boolean Report(Person obj, MetroTextBox title, MetroTextBox description)
        {
            if (obj != null)
            {
                TabReport report = new TabReport();

                if (obj is Recruiter)
                {
                    Recruiter rec = (Recruiter)obj;

                    report.ReportTitle       = title.Text;
                    report.ReportDescription = description.Text;
                    report.ReportedBy        = rec.Username;
                    report.ReporterType      = "Recruiter";

                    db.TabReports.InsertOnSubmit(report);
                    db.SubmitChanges();

                    return(true);
                }

                else if (obj is Seeker)
                {
                    Seeker seek = (Seeker)obj;

                    report.ReportTitle       = title.Text;
                    report.ReportDescription = description.Text;
                    report.ReportedBy        = seek.Username;
                    report.ReporterType      = "Seeker";

                    db.TabReports.InsertOnSubmit(report);
                    db.SubmitChanges();

                    return(true);
                }
            }

            return(false);
        }
Beispiel #4
0
        public Boolean AddJobApplicationDetails(Job job, Seeker sek)
        {
            if (job != null && sek != null && CheckUserStatus(sek))
            {
                var v = from m in db.TabJobApplications
                        where m.JId == this.GetJobIdByTitle(job.Title) && m.Applicant == sek.Username
                        select m;

                var p = from q in db.TabJobs
                        where q.JId == Convert.ToInt32(GetJobIdByTitle(job.Title))
                        select q;

                if (v.Count() == 0)
                {
                    TabJobApplication application = new TabJobApplication();
                    application.JId       = this.GetJobIdByTitle(job.Title);
                    application.Applicant = sek.Username;
                    application.JTitle    = job.Title;
                    application.PostedBy  = p.First().PostedBy;



                    db.TabJobApplications.InsertOnSubmit(application);
                    db.SubmitChanges();

                    return(true);
                }

                else
                {
                    return(false);
                }
            }

            else
            {
                return(false);
            }
        }
Beispiel #5
0
        public void ViewMyProfileSeeker(Seeker r, MetroLabel name, MetroLabel username, MetroLabel email, MetroLabel dob, MetroLabel mobile, MetroLabel address, ListBox box)
        {
            box.Items.Clear();
            var v = from a in db.TabSeekers
                    where a.uname == r.Username
                    select a;

            name.Text     = v.First().fname + " " + v.First().lname;
            username.Text = v.First().uname;
            email.Text    = v.First().email;
            dob.Text      = v.First().dob.ToShortDateString();
            mobile.Text   = v.First().mobile;
            address.Text  = v.First().address;

            var p = from b in db.TabSkills
                    where b.user == r.Username
                    select b;

            foreach (var item in p)
            {
                box.Items.Add(item.skill);
            }
        }
Beispiel #6
0
        public void CheckForNewMail(Person p, ListView view)
        {
            view.Items.Clear();

            if (p is Recruiter)
            {
                Recruiter r = (Recruiter)p;

                var v = from mail in db.TabMails
                        where mail.Receiver == GetMailAddress(r)
                        select mail;

                foreach (var item in v)
                {
                    ListViewItem lv = new ListViewItem(item.Subject);
                    lv.SubItems.Add(item.Sender);
                    view.Items.Add(lv);
                }
            }

            else if (p is Seeker)
            {
                Seeker s = (Seeker)p;

                var v = from mail in db.TabMails
                        where mail.Receiver == GetMailAddress(s)
                        select mail;

                foreach (var item in v)
                {
                    ListViewItem lv = new ListViewItem(item.Subject);
                    lv.SubItems.Add(item.Sender);
                    view.Items.Add(lv);
                }
            }
        }
Beispiel #7
0
        public void ViewEditProfileSeeker(Seeker r, MetroTextBox fname, MetroTextBox lname, MetroTextBox email, MetroTextBox mobile, MetroTextBox address, ListBox box)
        {
            box.Items.Clear();
            var v = from a in db.TabSeekers
                    where a.uname == r.Username
                    select a;

            TabSeeker tab = v.First();

            fname.Text   = tab.fname;
            lname.Text   = tab.lname;
            email.Text   = tab.email;
            mobile.Text  = tab.mobile;
            address.Text = tab.address;

            var p = from b in db.TabSkills
                    where b.user == r.Username
                    select b;

            foreach (var item in p)
            {
                box.Items.Add(item.skill);
            }
        }
Beispiel #8
0
        public Boolean SendMailTo(string to, string subject, string body, Person by)
        {
            if (body != null)
            {
                TabMail mail = new TabMail();

                if (by is Seeker)
                {
                    Seeker seek = (Seeker)by;

                    mail.Sender   = this.GetMailAddress(seek);
                    mail.Receiver = to;
                    mail.Subject  = subject;
                    mail.Body     = body;

                    db.TabMails.InsertOnSubmit(mail);
                    db.SubmitChanges();

                    return(true);
                }

                else if (by is Recruiter)
                {
                    Recruiter rec = (Recruiter)by;

                    mail.Sender   = this.GetMailAddress(rec);
                    mail.Receiver = to;
                    mail.Subject  = subject;
                    mail.Body     = body;

                    db.TabMails.InsertOnSubmit(mail);
                    db.SubmitChanges();

                    return(true);
                }

                else if (by is Admin)
                {
                    mail.Sender   = "admin@admin";
                    mail.Receiver = to;
                    mail.Subject  = subject;
                    mail.Body     = body;

                    db.TabMails.InsertOnSubmit(mail);
                    db.SubmitChanges();

                    return(true);
                }

                else
                {
                    return(false);
                }
            }


            else
            {
                return(false);
            }
        }
Beispiel #9
0
        public Boolean ChangePasswordFor(Person obj, MetroTextBox oldPass, MetroTextBox newPass)
        {
            if (obj != null)
            {
                Login login;

                if (obj is Recruiter)
                {
                    Recruiter rec = (Recruiter)obj;

                    var v = from a in db.Logins
                            where a.uname == rec.Username && a.pass == oldPass.Text
                            select a;

                    if (v.Count() == 1)
                    {
                        login = v.First();

                        login.uname = rec.Username;
                        login.pass  = newPass.Text;

                        db.SubmitChanges();
                    }

                    return(true);
                }

                else if (obj is Seeker)
                {
                    Seeker seek = (Seeker)obj;

                    var v = from a in db.Logins
                            where a.uname == seek.Username && a.pass == oldPass.Text
                            select a;

                    if (v.Count() == 1)
                    {
                        login = v.First();

                        login.uname = seek.Username;
                        login.pass  = newPass.Text;

                        db.SubmitChanges();
                    }

                    return(true);
                }

                else if (obj is Admin)
                {
                    Admin admin = (Admin)obj;

                    var v = from a in db.Logins
                            where a.uname == admin.Username && a.pass == oldPass.Text
                            select a;

                    if (v.Count() == 1)
                    {
                        login = v.First();

                        login.uname = admin.Username;
                        login.pass  = newPass.Text;

                        db.SubmitChanges();
                    }

                    return(true);
                }
            }
            return(false);
        }
Beispiel #10
0
        public Boolean InsertNew(Object any)
        {
            if (any is Recruiter)
            {
                Recruiter    obj = (Recruiter)any;
                TabRecruiter rec = new TabRecruiter();

                rec.fname        = obj.FirstName;
                rec.lname        = obj.LastName;
                rec.uname        = obj.Username;
                rec.mobile       = obj.MobileNumber;
                rec.email        = obj.EmailAddress;
                rec.address      = obj.Address;
                rec.designation  = obj.Designation;
                rec.organisation = obj.Organisation;
                rec.dob          = obj.DateOfBirth;
                rec.gender       = obj.Gender;

                db.TabRecruiters.InsertOnSubmit(rec);
                db.SubmitChanges();

                if (this.InserLogin(obj))
                {
                    return(true);
                }

                else
                {
                    return(false);
                }
            }

            else if (any is Seeker)
            {
                Seeker obj = (Seeker)any;

                TabSeeker seek = new TabSeeker();

                seek.fname   = obj.FirstName;
                seek.lname   = obj.LastName;
                seek.uname   = obj.Username;
                seek.mobile  = obj.MobileNumber;
                seek.email   = obj.EmailAddress;
                seek.address = obj.Address;
                seek.dob     = obj.DateOfBirth;
                seek.gender  = obj.Gender;

                db.TabSeekers.InsertOnSubmit(seek);
                db.SubmitChanges();

                foreach (var i in obj.skills)
                {
                    db.TabSkills.InsertOnSubmit(new TabSkill()
                    {
                        uname = obj.Username + obj.skills.IndexOf(i), skill = i, user = obj.Username
                    });
                }

                db.SubmitChanges();

                if (this.InserLogin(obj))
                {
                    return(true);
                }

                else
                {
                    return(false);
                }
            }


            return(false);
        }