Example #1
0
        public int deletetaskbyid(int id)
        {
            int retVal = 0;
            AccountSpecificTask _taskDtl = null;
            User tasks = new User();

            using (var db = new EvolutyzCornerDataEntities())
            {
                try
                {
                    tasks    = db.Set <User>().Where(s => s.Usr_TaskID == id).FirstOrDefault <User>();
                    _taskDtl = db.Set <AccountSpecificTask>().Where(s => s.Acc_SpecificTaskId == id).FirstOrDefault <AccountSpecificTask>();
                    if (tasks != null)
                    {
                        return(retVal = 2);
                    }
                    if (_taskDtl == null)
                    {
                        return(retVal);
                    }
                    _taskDtl.isDeleted       = true;
                    db.Entry(_taskDtl).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retVal = 1;
                }
                catch (Exception ex)
                {
                    retVal = -1;
                }
            }
            return(retVal);
        }
Example #2
0
        public List <UserProfileEntity> GetSocialmedia(int accountid, int userid)
        {
            List <UserProfileEntity> response = new List <UserProfileEntity>();

            using (var db = new EvolutyzCornerDataEntities())
            {
                try
                {
                    response = (from h in db.UserSocialMediaProfiles
                                where h.Usmp_UserID == userid && h.Url != null
                                select new UserProfileEntity
                    {
                        SocialMediaId = h.Usmp_SocialMediaId,
                        Url = "https://" + h.Url
                              //Url = h.Url
                    }).ToList();

                    for (int i = 0; i <= response.Count - 1; i++)
                    {
                        if (response[i].Url == "https://")
                        {
                            int?sid = response[i].SocialMediaId;
                            var url = db.Set <SocialMedia>().Where(s => s.SocialMediaId == sid).FirstOrDefault <SocialMedia>().Url;
                            response[i].Url = url;
                        }
                    }
                    return(response);
                }
                catch (Exception ex)
                {
                    return(null);
                }
            }
        }
Example #3
0
        public string updateSkills(string SkillsTitle, string yearExp, string monthExp, int userskillid)
        {
            try
            {
                UserProjectdetailsEntity sessId = new UserProjectdetailsEntity();
                int    userID    = sessId.User_ID;
                int    skillid   = Convert.ToInt32(SkillsTitle);
                string yearMonth = yearExp + "." + monthExp;
                EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities();
                UserSkill skillcheck = evolutyzData.Set <UserSkill>().Where(s => (s.SkillId == skillid && s.Usr_UserId == userID && s.Is_Deleted == false && s.Usr_SkillId != userskillid)).FirstOrDefault <UserSkill>();
                if (skillcheck != null)
                {
                    return("Skill Already Exist");
                }
                UserSkill skills = evolutyzData.UserSkills.SingleOrDefault(u => u.Usr_SkillId == userskillid);
                skills.SkillId    = Convert.ToInt32(SkillsTitle);
                skills.Experience = yearMonth;


                int response = evolutyzData.SaveChanges();

                if (response > 0)
                {
                    return("Data Updated Successfully");
                }
                else
                {
                    return("Try Again!!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
        public string SaveQuestions(QuestionsEntity questions)
        {
            UserSessionInfo objinfo = new UserSessionInfo();

            string          strResponse = string.Empty;
            UserSessionInfo sessionInfo = new UserSessionInfo();

            //   int uid = sessionInfo.userid;
            using (EvolutyzCornerDataEntities db = new EvolutyzCornerDataEntities())
            {
                try
                {
                    db.Set <QuestionBank>().Add(new QuestionBank
                    {
                        TechnologyStackId = questions.TechnologyStackId,
                        Question          = questions.Question1,
                        Option1           = questions.Option1,
                        Option2           = questions.Option2,
                        Option3           = questions.Option3,
                        Option4           = questions.Option4,
                        Answer            = questions.Answer,
                        CreatedDate       = DateTime.Now,
                        CreatedBy         = objinfo.UserId
                    });
                    db.SaveChanges();
                    strResponse = "Record Sucessfully Created ";
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(strResponse);
        }
Example #5
0
        public string EditQues(QuestionsEntity questions)
        {
            UserSessionInfo sessionInfo = new UserSessionInfo();
            int             uid         = sessionInfo.UserId;
            object          input       = null;
            QuestionBank    qs          = null;
            string          strResponse = string.Empty;

            using (EvolutyzCornerDataEntities db = new EvolutyzCornerDataEntities())
            {
                qs = db.Set <QuestionBank>().Where(s => s.QBID == questions.Qid).FirstOrDefault <QuestionBank>();
                // change required details in disconnected mode (out of DBContext scope)
                if (qs != null)
                {
                    qs.QBID = questions.Qid;
                    qs.TechnologyStackId = questions.TechnologyStackId;
                    qs.Question          = questions.Question1;
                    qs.Option1           = questions.Option1;
                    qs.Option2           = questions.Option2;
                    qs.Option3           = questions.Option3;
                    qs.Option4           = questions.Option4;
                    qs.Answer            = questions.Answer;
                    qs.CreatedDate       = System.DateTime.Now;
                    qs.ModifiedBy        = uid;
                    qs.ModifiedDate      = System.DateTime.Now;
                    // db.Entry(qs).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    strResponse = "Record successfully updated";
                }
                return(strResponse);
            }
        }
Example #6
0
        public string SaveTasks(string Acc_AccountID, string tsk_TaskID, string Acc_SpecificTaskName, string StatusId)
        {
            string strresponse = "";
            int    accid       = Convert.ToInt32(Acc_AccountID);

            if (tsk_TaskID == "" || Acc_SpecificTaskName == "" || StatusId == "")
            {
                return(strresponse = "Please Fill All Mandatory Fields");
            }
            int             taskid  = Convert.ToInt32(tsk_TaskID);
            int             sttus   = Convert.ToInt32(StatusId);
            bool            b       = Convert.ToBoolean(sttus);
            UserSessionInfo infoobj = new UserSessionInfo();
            int             userid  = infoobj.UserId;

            try
            {
                using (var db = new EvolutyzCornerDataEntities())
                {
                    AccountSpecificTask orgCheck = db.Set <AccountSpecificTask>().Where(s => (s.Acc_SpecificTaskName == Acc_SpecificTaskName && s.AccountID == accid)).FirstOrDefault <AccountSpecificTask>();
                    if (orgCheck != null)
                    {
                        return(strresponse = "Already Task Existed");
                    }
                    db.Set <AccountSpecificTask>().Add(new AccountSpecificTask
                    {
                        AccountID            = accid,
                        Acc_SpecificTaskName = Acc_SpecificTaskName,
                        tsk_TaskID           = taskid,
                        //StatusId = ,
                        isDeleted   = b,
                        CreatedBy   = userid,
                        CreatedDate = DateTime.Now
                    });
                    db.SaveChanges();
                    strresponse = "Successfully Added";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(strresponse);
        }
Example #7
0
        public string AddSkills(string skill, string yearExp, string monthExp)
        {
            try
            {
                int response = 0;
                UserProjectdetailsEntity sessId = new UserProjectdetailsEntity();
                int userID  = sessId.User_ID;
                int skillid = Convert.ToInt32(skill);
                EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities();
                if (entities.UserSkills.Count((a) => a.Usr_UserId == userID) >= 0)
                {
                    string    yearMonth  = yearExp + "." + monthExp;
                    UserSkill skillcheck = evolutyzData.Set <UserSkill>().Where(s => (s.SkillId == skillid && s.Usr_UserId == userID && s.Is_Deleted == false)).FirstOrDefault <UserSkill>();
                    if (skillcheck != null)
                    {
                        return("Skill Already Exist");
                    }


                    UserSkill skills = new UserSkill();
                    skills.SkillId    = Convert.ToInt32(skill);
                    skills.Usr_UserId = userID;
                    //skills.Usr_SkillId = skill;
                    skills.Experience      = yearMonth;
                    skills.Usk_CreatedDate = System.DateTime.Now;

                    // skills.Usk_ModifiedDate = System.DateTime.Now;
                    skills.Is_Deleted = false;

                    evolutyzData.UserSkills.Add(skills);

                    response = evolutyzData.SaveChanges();
                }


                if (response > 0)
                {
                    return("Data Inserted Successfully");
                }
                else
                {
                    return("Try Again!!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #8
0
        public string UpdateTasks(int id, string ProjectId, string tsk_TaskID, string Proj_SpecificTaskName, string StatusId)
        {
            string strresponse = "";

            try
            {
                int             projectid = Convert.ToInt32(ProjectId);
                int             taskid    = Convert.ToInt32(tsk_TaskID);
                int             sttus     = Convert.ToInt32(StatusId);
                bool            b         = Convert.ToBoolean(sttus);
                UserSessionInfo infoobj   = new UserSessionInfo();
                int             userid    = infoobj.UserId;

                using (var db = new EvolutyzCornerDataEntities())
                {
                    AccountSpecificTask taskdetails = db.Set <AccountSpecificTask>().Where(s => s.Acc_SpecificTaskId == id).FirstOrDefault <AccountSpecificTask>();

                    if (taskdetails == null)
                    {
                        return(null);
                    }


                    taskdetails.AccountID            = projectid;
                    taskdetails.tsk_TaskID           = taskid;
                    taskdetails.isDeleted            = b;
                    taskdetails.Acc_SpecificTaskName = Proj_SpecificTaskName;

                    taskdetails.ModifiedBy   = userid;
                    taskdetails.ModifiedDate = System.DateTime.Now;

                    db.Entry(taskdetails).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    strresponse = "Tasks successfully updated";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(strresponse);
        }
Example #9
0
        public string gettoken(string uid)
        {
            User   userdtl  = null;
            string response = string.Empty;

            using (var db = new EvolutyzCornerDataEntities())
            {
                try
                {
                    userdtl = db.Set <User>().Where(s => s.Url_token == uid.Trim()).FirstOrDefault <User>();
                    if (userdtl != null)
                    {
                        response = "data";
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(response);
        }
Example #10
0
        public string UpdatePasswordandtoken(string token, string Newpassword)
        {
            User   userdtl  = null;
            string response = string.Empty;
            string Token    = token.Trim();

            using (var db = new EvolutyzCornerDataEntities())
            {
                try
                {
                    userdtl = db.Set <User>().Where(s => s.Url_token == Token).FirstOrDefault <User>();

                    if (userdtl == null)
                    {
                        response = "Please Reset Password again";
                        return(null);
                    }

                    //int roleid = db.Set<Role>().Where(r => (r.Rol_AccountID == accountid && r.Rol_RoleName == rolename)).FirstOrDefault<Role>().Rol_RoleID;

                    User u = new User();


                    userdtl.Url_token       = null;
                    userdtl.Usr_Password    = Newpassword;
                    db.Entry(userdtl).State = System.Data.Entity.EntityState.Modified;
                    //db.Set<User>().Add(u);
                    db.SaveChanges();


                    response = "Password Reseted Successfully";
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(response);
        }
Example #11
0
        public string SaveToken(string token, int uid)
        {
            User   userdtl  = null;
            string response = string.Empty;

            using (var db = new EvolutyzCornerDataEntities())
            {
                try
                {
                    userdtl = db.Set <User>().Where(s => s.Usr_UserID == uid).FirstOrDefault <User>();

                    if (userdtl == null)
                    {
                        response = "Please Reset Password again";
                        return(null);
                    }

                    //int roleid = db.Set<Role>().Where(r => (r.Rol_AccountID == accountid && r.Rol_RoleName == rolename)).FirstOrDefault<Role>().Rol_RoleID;

                    User u = new User();


                    userdtl.Url_token       = token;
                    db.Entry(userdtl).State = System.Data.Entity.EntityState.Modified;
                    //db.Set<User>().Add(u);
                    db.SaveChanges();


                    response = "Reset Link Send To Your Email ";
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(response);
        }
Example #12
0
        public ActionResult AddSkills(string skillTitle, string Description, string status)
        {
            using (var db = new EvolutyzCornerDataEntities())
            {
                try
                {
                    SkillEntity     nt     = new SkillEntity();
                    UserSessionInfo sessId = new UserSessionInfo();
                    //UserProjectdetailsEntity sessId = new UserProjectdetailsEntity();
                    int  userID   = sessId.UserId;
                    int  accid    = sessId.AccountId;
                    bool?statusid = Convert.ToBoolean(status);
                    //if (status == "True")
                    //{
                    //    statusid = 1;
                    //}
                    //else
                    //{
                    //    statusid = 0;
                    //}
                    //
                    EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities();

                    Skill skill  = new Skill();
                    Skill Skills = new Skill();
                    Skills = db.Set <Skill>().Where(s => (s.SkillTitle == skillTitle && s.Acc_AccountID == accid)).FirstOrDefault <Skill>();
                    if (Skills != null)
                    {
                        return(Json("Skill Already Exists", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        skill.SkillTitle       = skillTitle;
                        skill.ShortDescription = Description;
                        skill.Sk_CreatedBy     = userID;
                        skill.Sk_CreatedDate   = System.DateTime.Now;
                        //skill.Sk_ModifiedBy = userID;
                        //skill.Sk_ModifiedDate = System.DateTime.Now;
                        // skill.StatusID = statusid;
                        skill.Acc_AccountID = accid;
                        skill.Sk_isDeleted  = statusid;

                        evolutyzData.Skills.Add(skill);
                    }

                    int response = evolutyzData.SaveChanges();

                    if (response > 0)
                    {
                        return(Json("Skills Added Successfully", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json("Try Again!!", JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception EX)
                {
                    throw;
                }
            }
        }
Example #13
0
        public string UpdateProfile(UserProfileEntity user)
        {
            UsersProfile userData = null;
            //string ImageName = System.IO.Path.GetFileName(file.FileName);
            UserSessionInfo objSessioninfo = new UserSessionInfo();

            string strResponse       = string.Empty;
            short  UsTCurrentVersion = 0;
            string imagename         = string.Empty;

            if (Request.Files.Count > 0)
            {
                var file     = Request.Files[0];
                var fileName = "/uploadimages/Images/" + file.FileName;
                imagename = file.FileName;
                var imagepath = Server.MapPath(fileName);
                file.SaveAs(imagepath);
                user.Usrp_ProfilePicture = imagename;
                try
                {
                    var ProjectComponent      = new ProfileComponent();
                    var currentProjectDetails = ProjectComponent.GetProfileDetailid(user.UsrP_UserID);
                    int ProjectID             = currentProjectDetails.UsrP_UserProfileID;
                    UsTCurrentVersion = Convert.ToInt16(currentProjectDetails.UsrP_Version);
                    // bool _currentStatus = false;

                    //check for version and active status
                    //if (ModelState["UsrP_ActiveStatus"].Value == null)
                    //{
                    //    _currentStatus = user.UsrP_ActiveStatus == true;
                    //}

                    if (ModelState.IsValid)
                    {
                        UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
                        int             _userID         = _objSessioninfo.UserId;
                        user.UsrP_ModifiedBy = _userID;
                        //while udating increment version by1
                        user.UsrP_Version       = ++UsTCurrentVersion;
                        user.UsrP_ActiveStatus  = true;
                        user.UsrP_UserProfileID = ProjectID;
                        var Org = new ProfileComponent();
                        int r   = Org.UpdateProfileDetail(user);

                        if (r > 0)
                        {
                            strResponse = "Profile updated successfully";
                            objSessioninfo.Usrp_ProfilePicture = imagename;
                        }
                        else if (r == 0)
                        {
                            strResponse = "Profile does not exists";
                        }
                        else if (r < 0)
                        {
                            strResponse = "Error occured in UpdateProject";
                        }
                    }
                }

                catch (Exception ex)
                {
                    ex.Message.ToString();
                }
            }
            else
            {
                using (var db = new EvolutyzCornerDataEntities())
                {
                    try
                    {
                        userData = db.Set <UsersProfile>().Where(s => s.UsrP_UserID == user.UsrP_UserID).FirstOrDefault <UsersProfile>();

                        if (userData != null)
                        {
                            var ProjectComponent      = new ProfileComponent();
                            var currentProjectDetails = ProjectComponent.GetProfileDetailByID(user.UsrP_UserID);
                            int ProjectID             = currentProjectDetails.UsrP_UserProfileID;
                            UsTCurrentVersion = Convert.ToInt16(currentProjectDetails.UsrP_Version);
                            // bool _currentStatus = false;

                            //check for version and active status
                            //if (ModelState["UsrP_ActiveStatus"].Value == null)
                            //{
                            //    _currentStatus = user.UsrP_ActiveStatus == true;
                            //}

                            if (ModelState.IsValid)
                            {
                                UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
                                int             _userID         = _objSessioninfo.UserId;
                                user.UsrP_ModifiedBy = _userID;
                                //while udating increment version by1
                                user.UsrP_Version      = ++UsTCurrentVersion;
                                user.UsrP_ActiveStatus = true;

                                var Org = new ProfileComponent();
                                int r   = Org.UpdateProfileDetailByImage(user);

                                if (r > 0)
                                {
                                    strResponse = "Profile updated successfully";
                                }
                                else if (r == 0)
                                {
                                    strResponse = "Profile does not exists";
                                }
                                else if (r < 0)
                                {
                                    strResponse = "Error occured in UpdateProject";
                                }
                            }
                        }
                        else
                        {
                            //int retVal = 0;
                            UsersProfile profilesave = new UsersProfile();
                            try
                            {
                                //Project = db.Set<Project>().Where(s => s.Proj_ProjectID == _project.Proj_ProjectID).FirstOrDefault<Project>();

                                #region Saving ProjectAllocation info Table
                                profilesave.UsrP_UserID         = user.UsrP_UserID;
                                profilesave.UsrP_FirstName      = user.UsrP_FirstName;
                                profilesave.UsrP_LastName       = user.UsrP_LastName;
                                profilesave.Usrp_ProfilePicture = user.Usrp_ProfilePicture;
                                profilesave.Usrp_DOJ            = user.Usrp_DOJ;
                                profilesave.UsrP_DOB            = user.UsrP_DOB;
                                profilesave.Usrp_MobileNumber   = user.Usrp_MobileNumber;
                                profilesave.UsrP_EmailID        = user.UsrP_EmailID;
                                profilesave.TemporaryAddress    = user.TemporaryAddress;
                                profilesave.PermanentAddress    = user.PermanentAddress;
                                profilesave.UsrP_ActiveStatus   = user.UsrP_ActiveStatus;
                                profilesave.UsrP_Version        = user.UsrP_Version;
                                profilesave.UsrP_CreatedDate    = System.DateTime.Now;
                                profilesave.UsrP_CreatedBy      = user.UsrP_CreatedBy;
                                profilesave.UsrP_ModifiedDate   = System.DateTime.Now;
                                profilesave.UsrP_ModifiedBy     = user.UsrP_ModifiedBy;
                                profilesave.UsrP_isDeleted      = user.UsrP_isDeleted;
                                profilesave.Marital_Status      = user.Marital_Status;
                                profilesave.Usr_GenderId        = user.Usr_GenderId;
                                profilesave.Usr_Titleid         = user.Usr_Titleid;
                                profilesave.UsrP_EmployeeID     = user.UsrP_EmployeeID;
                                profilesave.Usrp_MobileNumber   = user.Usrp_PhoneNumber;
                                #endregion

                                //   db.UsersProfiles.up(profilesave);

                                db.Entry(profilesave).State = EntityState.Added;
                                //  db.Entry(profilesave).State = System.Data.Entity.EntityState.Modified;

                                db.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                //retVal = -1;
                            }
                        }
                    }

                    catch (Exception ex)
                    {
                        ex.Message.ToString();
                    }
                }
            }

            return(strResponse);
        }