Пример #1
0
        //
        // GET: /رزومه/
        public ActionResult مشاهده(long HumanId)
        {
            ViewBag.HumanID = HumanId;
            ResumeViewModel Resume = new ResumeViewModel();

            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                HUMAN human = db.HUMen.FirstOrDefault(q => q.ID == HumanId);
                Resume.NAME   = human.NAME;
                Resume.GENDER = human.GENDER;
                Resume.USAGE  = human.USAGE;
                //Resume.Image = db.IMAGES.FirstOrDefault(q => q.HUMANID == HumanId).IMAGE1;
                List <long> ExperiencesIds = db.OWNERSEXPERIENCES.Where(q => q.EXPERIENCEOWNERID == HumanId).Select(q => q.EXPERIENCEID).ToList();
                Resume.Experiences = db.EXPERIENCES.Where(q => ExperiencesIds.Contains(q.ID)).ToList();
                List <long> EducationIds = db.OWNERSEDUCATIONS.Where(q => q.EDUCATIONOWNERID == HumanId).Select(q => q.EDUCATIONID).ToList();
                Resume.Educations = db.EDUCATONS.Where(q => EducationIds.Contains(q.ID)).ToList();
                List <long> SkillIlds = db.OWNERSSKILLS.Where(q => q.SKILLOWNERID == HumanId).Select(q => q.SKILLID).ToList();
                Resume.Skills = db.SKILLS.Where(q => SkillIlds.Contains(q.ID)).ToList();
                List <long> AdressIds = db.OWNERSADRESES.Where(q => q.ADRESSOWNERID == HumanId).Select(q => q.ADRESSID).ToList();
                Resume.Adresses = db.ADRESSES.Where(q => AdressIds.Contains(q.ID)).ToList();
                List <long> PhoneIds = db.OWNERSPHOES.Where(q => q.PHONEOWNERID == HumanId).Select(q => q.PHONENUMBERID).ToList();
                Resume.Phones = db.PHONES.Where(q => PhoneIds.Contains(q.ID)).ToList();
                List <long> CellPhoneIds = db.OWNERSCELLPHONES.Where(q => q.CELLPHONEOWNERID == HumanId).Select(q => q.CELLPHONEID).ToList();
                Resume.Cellphones = db.CELLPHONES.Where(q => CellPhoneIds.Contains(q.ID)).ToList();
                List <long> EmailIds = db.OWNERSMAILS.Where(q => q.MAILOWNERID == HumanId).Select(q => q.MAILADRESSID).ToList();
                Resume.Emails = db.MAILADRESSES.Where(q => EmailIds.Contains(q.ID)).ToList();
            }
            return(View(Resume));
        }
 public long SetEducation(EDUCATON Education, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             //long HumanID = 60111;
             //EDUCATON Education = new EDUCATON();
             //Education.EDUCATIONBRANCH = "asd";
             //Education.EDUCATIONDIPLOMA = "asd";
             //Education.EDUCATIONDURATION = 12;
             //Education.EDUCATIONLOCATION = "asd";
             //Education.FINALGRADE = 12;
             db.Configuration.ProxyCreationEnabled = false;
             db.EDUCATONS.Add(Education);
             db.SaveChanges();
             OWNERSEDUCATION owenersEducation = new OWNERSEDUCATION();
             owenersEducation.EDUCATIONID      = Education.ID;
             owenersEducation.EDUCATIONOWNERID = HumanID;
             db.OWNERSEDUCATIONS.Add(owenersEducation);
             db.SaveChanges();
             return(Education.ID);
         }
         catch
         {
             return(0);
         }
     }
 }
        public bool DeleteSkill(SKILL Entity)
        {
            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                try
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    //var employer = new Employ { Id = 1 };
                    //ctx.Employ.Attach(employer);
                    //ctx.Employ.Remove(employer);
                    //ctx.SaveChanges();
                    SKILL       entity = db.SKILLS.FirstOrDefault(q => q.ID == Entity.ID);
                    OWNERSSKILL Owner  = db.OWNERSSKILLS.FirstOrDefault(q => q.SKILLID == Entity.ID);
                    db.OWNERSSKILLS.Attach(Owner);
                    db.OWNERSSKILLS.Remove(Owner);
                    db.SaveChanges();
                    db.SKILLS.Attach(entity);
                    db.SKILLS.Remove(entity);
                    db.SaveChanges();

                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
 public long SetImage(long HumanID, ImageForTransfer Image)//IMAGE image)//long HumanID , byte[] Image)
 {
     try
     {
         using (KARYABDBEntities db = new KARYABDBEntities())
         {
             var _Image = db.IMAGES.Where(q => q.HUMANID == HumanID).FirstOrDefault();
             if (_Image != null)
             {
                 _Image.IMAGE1 = Convert.FromBase64String(Image.Bitmap);
                 db.SaveChanges();
                 return(_Image.ID);
             }
             else
             {
                 IMAGE image = new IMAGE();
                 image.HUMANID = HumanID;
                 image.IMAGE1  = Convert.FromBase64String(Image.Bitmap);
                 db.IMAGES.Add(image);
                 db.SaveChanges();
                 return(image.ID);
             }
         }
     }
     catch (Exception e)
     {
         return(0);
     }
 }
 public string GetPassword(string Email, string Answer)
 {
     try
     {
         using (KARYABDBEntities db = new KARYABDBEntities())
         {
             var Password = db.PASSWORDS.Where(q => q.EMAIL.Equals(Email) && q.ANSWER.Equals(Answer)).ToList();
             if (Password.Any() && Password.Count == 1)
             {
                 var password = Password.FirstOrDefault();
                 if (password.PASSWORD1 != null && password.HUMANID != null && password.CONFIRMPASSWORD != null && password.PASSWORD1.Equals(password.CONFIRMPASSWORD))
                 {
                     return(password.PASSWORD1);
                 }
                 else
                 {
                     return("-2");
                 }
             }
             else
             {
                 return("-1");
             }
         }
     }
     catch (Exception e)
     {
         return("0");
     }
 }
Пример #6
0
 public HUMAN GetHuman(long ID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             return(db.HUMen.Where(r => r.ID.Equals(ID)).Single());
         }
         catch
         {
             return(new HUMAN());
         }
     }
 }
        public long SetPassword(PASSWORD Password)//long HumanID ,string password,string confirmPassword,string email ,string answer)
        {
            //PASSWORD Password = new PASSWORD();
            //Password.ANSWER = answer;
            //Password.CONFIRMPASSWORD = confirmPassword;
            //Password.PASSWORD1 = password;
            //Password.EMAIL = email;
            //Password.HUMANID = HumanID;

            try
            {
                using (KARYABDBEntities db = new KARYABDBEntities())
                {
                    if (Password.PASSWORD1.Equals(Password.CONFIRMPASSWORD) &&
                        Password.ANSWER != null &&
                        Password.EMAIL != null &&
                        Password.HUMANID != null)
                    {
                        var EmailExist = db.PASSWORDS.Where(q => q.EMAIL == Password.EMAIL).ToList();
                        if (EmailExist.Any())
                        {
                            if (EmailExist.Any(q => q.ANSWER == Password.ANSWER))
                            {
                                return(-2);
                            }
                            else
                            {
                                return(-1);
                            }
                        }
                        else
                        {
                            db.PASSWORDS.Add(Password);
                            db.SaveChanges();
                            return(Password.ID);
                        }
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
            catch (Exception e)
            {
                return(0);
            }
        }
Пример #8
0
        public long SetHuman(HUMAN human)
        {
            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                try
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    db.HUMen.Add(human);
                    db.SaveChanges();

                    return(human.ID);
                }
                catch
                {
                    return(0);
                }
            }
        }
Пример #9
0
 public bool UpdateEmail(MAILADRESS Entity)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             // var Skill = db.SKILLS.FirstOrDefault(q => q.ID == SkillID);
             db.MAILADRESSES.Attach(Entity);
             var Entry = db.Entry(Entity);
             Entry.State = EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
        //
        // GET: /Image/

        public FileContentResult GetImage(long HumanId)
        {
            try
            {
                using (KARYABDBEntities db = new KARYABDBEntities())
                {
                    byte[] image = db.IMAGES.FirstOrDefault(q => q.HUMANID == HumanId).IMAGE1;
                    if (image != null)
                    {
                        string contentType = "image/png";
                        return(File(image, contentType));
                    }
                    return(null);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
 public long SetExperience(EXPERIENCE Experience, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             db.EXPERIENCES.Add(Experience);
             db.SaveChanges();
             OWNERSEXPERIENCE owenersExperience = new OWNERSEXPERIENCE();
             owenersExperience.EXPERIENCEID      = Experience.ID;
             owenersExperience.EXPERIENCEOWNERID = HumanID;
             db.OWNERSEXPERIENCES.Add(owenersExperience);
             db.SaveChanges();
             return(Experience.ID);
         }
         catch
         {
             return(0);
         }
     }
 }
 public SKILL GetSkill(long ID, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             if (db.OWNERSSKILLS.Any(r => r.SKILLOWNERID.Equals(HumanID) && r.SKILLID.Equals(ID)))
             {
                 return(db.SKILLS.Where(r => r.ID.Equals(ID)).Single());
             }
             else
             {
                 return(new SKILL());
             }
         }
         catch
         {
             return(new SKILL());
         }
     }
 }
 public long SetSkill(SKILL Skill, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             db.SKILLS.Add(Skill);
             db.SaveChanges();
             OWNERSSKILL owenersSkill = new OWNERSSKILL();
             owenersSkill.SKILLID      = Skill.ID;
             owenersSkill.SKILLOWNERID = HumanID;
             db.OWNERSSKILLS.Add(owenersSkill);
             db.SaveChanges();
             return(Skill.ID);
         }
         catch
         {
             return(0);
         }
     }
 }
 public List <SKILL> GetHumanSkills(long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             List <long> skillIds = new List <long>();
             skillIds = db.OWNERSSKILLS.Where(r => r.SKILLOWNERID.Equals(HumanID)).Select(r => r.SKILLID).ToList();
             List <SKILL> skills = new List <SKILL>();
             foreach (long item in skillIds)
             {
                 skills.Add(db.SKILLS.Where(r => r.ID.Equals(item)).Single());
             }
             return(skills);
         }
         catch
         {
             return(new List <SKILL>());
         }
     }
 }
 public EDUCATON GetEducation(long ID, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             if (db.OWNERSEDUCATIONS.Any(r => r.EDUCATIONOWNERID.Equals(HumanID) && r.EDUCATIONID.Equals(ID)))
             {
                 return(db.EDUCATONS.Where(r => r.ID.Equals(ID)).Single());
             }
             else
             {
                 return(new EDUCATON());
             }
         }
         catch
         {
             return(new EDUCATON());
         }
     }
 }
 public EXPERIENCE GetExperience(long ID, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             if (db.OWNERSEXPERIENCES.Any(r => r.EXPERIENCEOWNERID.Equals(HumanID) && r.EXPERIENCEID.Equals(ID)))
             {
                 return(db.EXPERIENCES.Where(r => r.ID.Equals(ID)).Single());
             }
             else
             {
                 return(new EXPERIENCE());
             }
         }
         catch
         {
             return(new EXPERIENCE());
         }
     }
 }
Пример #17
0
 public MAILADRESS GetEmail(long ID, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             if (db.OWNERSMAILS.Any(r => r.MAILOWNERID.Equals(HumanID) && r.MAILADRESSID.Equals(ID)))
             {
                 return(db.MAILADRESSES.Where(r => r.ID.Equals(ID)).Single());
             }
             else
             {
                 return(new MAILADRESS());
             }
         }
         catch
         {
             return(new MAILADRESS());
         }
     }
 }
Пример #18
0
 public long SetEmail(MAILADRESS Adress, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             db.MAILADRESSES.Add(Adress);
             db.SaveChanges();
             OWNERSMAIL owenersAdress = new OWNERSMAIL();
             owenersAdress.MAILADRESSID = Adress.ID;
             owenersAdress.MAILOWNERID  = HumanID;
             db.OWNERSMAILS.Add(owenersAdress);
             db.SaveChanges();
             return(Adress.ID);
         }
         catch
         {
             return(0);
         }
     }
 }
 public long SetPhone(PHONE Phone, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             db.PHONES.Add(Phone);
             db.SaveChanges();
             OWNERSPHO owenersPhone = new OWNERSPHO();
             owenersPhone.PHONENUMBERID = Phone.ID;
             owenersPhone.PHONEOWNERID  = HumanID;
             db.OWNERSPHOES.Add(owenersPhone);
             db.SaveChanges();
             return(Phone.ID);
         }
         catch
         {
             return(0);
         }
     }
 }
 public long SetCellPhone(CELLPHONE CellPhone, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             db.CELLPHONES.Add(CellPhone);
             db.SaveChanges();
             OWNERSCELLPHONE owenersCellPhone = new OWNERSCELLPHONE();
             owenersCellPhone.CELLPHONEID      = CellPhone.ID;
             owenersCellPhone.CELLPHONEOWNERID = HumanID;
             db.OWNERSCELLPHONES.Add(owenersCellPhone);
             db.SaveChanges();
             return(CellPhone.ID);
         }
         catch
         {
             return(0);
         }
     }
 }
 public CELLPHONE GetCellPhone(long ID, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             if (db.OWNERSCELLPHONES.Any(r => r.CELLPHONEOWNERID.Equals(HumanID) && r.CELLPHONEID.Equals(ID)))
             {
                 return(db.CELLPHONES.Where(r => r.ID.Equals(ID)).Single());
             }
             else
             {
                 return(new CELLPHONE());
             }
         }
         catch
         {
             return(new CELLPHONE());
         }
     }
 }
Пример #22
0
 public List <MAILADRESS> GetHumanEmails(long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             List <long> AdressIds = new List <long>();
             AdressIds = db.OWNERSMAILS.Where(r => r.MAILOWNERID.Equals(HumanID)).Select(r => r.MAILADRESSID).ToList();
             List <MAILADRESS> adresses = new List <MAILADRESS>();
             foreach (long item in AdressIds)
             {
                 var adress = db.MAILADRESSES.Where(r => r.ID.Equals(item)).SingleOrDefault();
                 adresses.Add(adress);
             }
             return(adresses);
         }
         catch (Exception e)
         {
             return(new List <MAILADRESS>());
         }
     }
 }
 public List <CELLPHONE> GetHumanCellPhones(long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             List <long> cellPhoneIds = new List <long>();
             cellPhoneIds = db.OWNERSCELLPHONES.Where(r => r.CELLPHONEOWNERID.Equals(HumanID)).Select(r => r.CELLPHONEID).ToList();
             List <CELLPHONE> cellPhones = new List <CELLPHONE>();
             foreach (long item in cellPhoneIds)
             {
                 var cellPhone = db.CELLPHONES.Where(r => r.ID.Equals(item)).SingleOrDefault();
                 cellPhones.Add(cellPhone);
             }
             return(cellPhones);
         }
         catch (Exception e)
         {
             return(new List <CELLPHONE>());
         }
     }
 }
 public List <EDUCATON> GetHumanEducations(long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             List <long> educationIds = new List <long>();
             educationIds = db.OWNERSEDUCATIONS.Where(r => r.EDUCATIONOWNERID.Equals(HumanID)).Select(r => r.EDUCATIONID).ToList();
             List <EDUCATON> educations = new List <EDUCATON>();
             foreach (long item in educationIds)
             {
                 var education = db.EDUCATONS.Where(r => r.ID.Equals(item)).SingleOrDefault();
                 educations.Add(education);
             }
             return(educations);
         }
         catch (Exception e)
         {
             return(new List <EDUCATON>());
         }
     }
 }
 public List <EXPERIENCE> GetHumanExperiences(long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             db.Configuration.ProxyCreationEnabled = false;
             List <long> experienceIds = new List <long>();
             experienceIds = db.OWNERSEXPERIENCES.Where(r => r.EXPERIENCEOWNERID.Equals(HumanID)).Select(r => r.EXPERIENCEID).ToList();
             List <EXPERIENCE> experiences = new List <EXPERIENCE>();
             foreach (long item in experienceIds)
             {
                 var experience = db.EXPERIENCES.Where(r => r.ID.Equals(item)).SingleOrDefault();
                 experiences.Add(experience);
             }
             return(experiences);
         }
         catch (Exception e)
         {
             return(new List <EXPERIENCE>());
         }
     }
 }
 public long Login(string Email, string Password)
 {
     try
     {
         using (KARYABDBEntities db = new KARYABDBEntities())
         {
             var EmailExist = db.PASSWORDS.Where(q => q.EMAIL.Equals(Email) && q.PASSWORD1.Equals(Password)).ToList();
             if (EmailExist.Any() && EmailExist.Count() == 1)
             {
                 var account = EmailExist.FirstOrDefault();
                 if (account.PASSWORD1.Equals(account.CONFIRMPASSWORD))
                 {
                     if (account.HUMANID != null && account.ANSWER != null)
                     {
                         return(account.HUMANID);
                     }
                     else
                     {
                         return(-3);
                     }
                 }
                 else
                 {
                     return(-2);
                 }
             }
             else
             {
                 return(-1);
             }
         }
     }
     catch (Exception e)
     {
         return(0);
     }
 }
        public bool DeleteCellPhone(CELLPHONE Entity)
        {
            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                try
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    CELLPHONE       entity = db.CELLPHONES.FirstOrDefault(q => q.ID == Entity.ID);
                    OWNERSCELLPHONE Owner  = db.OWNERSCELLPHONES.FirstOrDefault(q => q.CELLPHONEID == Entity.ID);
                    db.OWNERSCELLPHONES.Attach(Owner);
                    db.OWNERSCELLPHONES.Remove(Owner);
                    db.SaveChanges();
                    db.CELLPHONES.Attach(entity);
                    db.CELLPHONES.Remove(entity);
                    db.SaveChanges();

                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
        public bool DeleteEducation(EDUCATON Entity)
        {
            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                try
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    EDUCATON        entity = db.EDUCATONS.FirstOrDefault(q => q.ID == Entity.ID);
                    OWNERSEDUCATION Owner  = db.OWNERSEDUCATIONS.FirstOrDefault(q => q.EDUCATIONID == Entity.ID);
                    db.OWNERSEDUCATIONS.Attach(Owner);
                    db.OWNERSEDUCATIONS.Remove(Owner);
                    db.SaveChanges();
                    db.EDUCATONS.Attach(entity);
                    db.EDUCATONS.Remove(entity);
                    db.SaveChanges();

                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Пример #29
0
        public bool DeleteEmail(MAILADRESS Entity)
        {
            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                try
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    MAILADRESS entity = db.MAILADRESSES.FirstOrDefault(q => q.ID == Entity.ID);
                    OWNERSMAIL Owner  = db.OWNERSMAILS.FirstOrDefault(q => q.MAILADRESSID == Entity.ID);
                    db.OWNERSMAILS.Attach(Owner);
                    db.OWNERSMAILS.Remove(Owner);
                    db.SaveChanges();
                    db.MAILADRESSES.Attach(entity);
                    db.MAILADRESSES.Remove(entity);
                    db.SaveChanges();

                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
        public bool DeleteExperience(EXPERIENCE Entity)
        {
            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                try
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    EXPERIENCE       entity = db.EXPERIENCES.FirstOrDefault(q => q.ID == Entity.ID);
                    OWNERSEXPERIENCE Owner  = db.OWNERSEXPERIENCES.FirstOrDefault(q => q.EXPERIENCEID == Entity.ID);
                    db.OWNERSEXPERIENCES.Attach(Owner);
                    db.OWNERSEXPERIENCES.Remove(Owner);
                    db.SaveChanges();
                    db.EXPERIENCES.Attach(entity);
                    db.EXPERIENCES.Remove(entity);
                    db.SaveChanges();

                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }