コード例 #1
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        // GET: Profile
        public ActionResult Index()
        {
            UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
            int             UserId          = _objSessioninfo.UserId;

            ViewBag.UserId = UserId;
            int accountid = _objSessioninfo.AccountId;

            HomeController   hm      = new HomeController();
            var              obj     = hm.GetAdminMenu();
            ProfileComponent compobj = new ProfileComponent();

            var UserSocialMediaurls = compobj.GetUserSocialMediaurls(UserId, accountid);

            if (UserSocialMediaurls.Count() == 0)
            {
                var SocialMediaIcons = compobj.GetAllSocialMediaIcons(accountid);
                ViewBag.SocialMediaIcons = SocialMediaIcons;
            }
            else
            {
                var SocialMediaIcons = compobj.GetUserSocialMediaurls(UserId, accountid);
                ViewBag.SocialMediaIcons = SocialMediaIcons;
            }

            ViewBag.UserSocialMediaurls = UserSocialMediaurls.Count();

            return(View());
        }
コード例 #2
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        public string UpdateUserSocialMedia(List <UserProfileEntity> jsonobj)
        {
            string           Response = string.Empty;
            ProfileComponent compobj  = new ProfileComponent();

            Response = compobj.UpdateUserSocialMedia(jsonobj);
            return(Response);
        }
コード例 #3
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        public string CheckPassword(string oldpassword, string newpassowrd)
        {
            string           Response = string.Empty;
            ProfileComponent pcomp    = new ProfileComponent();

            Response = pcomp.CheckPassword(oldpassword, newpassowrd);
            return(Response);
        }
コード例 #4
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        public string DeleteSkills(int id)
        {
            string           response = string.Empty;
            ProfileComponent pcomp    = new ProfileComponent();

            response = pcomp.DeleteSkills(id);
            return(response);
        }
コード例 #5
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        public JsonResult GetProfiletByID(int catID)
        {
            UserProfileEntity ProjectDetails = null;

            try
            {
                var objDtl = new ProfileComponent();
                ProjectDetails = objDtl.GetProfileDetailByID(catID);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(ProjectDetails, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        public ActionResult getUsers()
        {
            UserSessionInfo    info      = new UserSessionInfo();
            int                accid     = info.AccountId;
            List <SkillEntity> SkillList = new List <SkillEntity>();

            try
            {
                var objDtl = new ProfileComponent();
                SkillList = objDtl.GetSkillList(accid);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(SkillList, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        public string CreateProfile([Bind(Exclude = "UsrP_UserID")] UserProfileEntity ProfileDtl)
        {
            string strResponse = string.Empty;

            try
            {
                var ProfileComponent = new ProfileComponent();

                if (ModelState.IsValid)
                {
                    UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
                    int             _userID         = _objSessioninfo.UserId;
                    ProfileDtl.UsrP_CreatedBy = _userID;

                    var Org = new ProfileComponent();
                    int r   = Org.AddProfile(ProfileDtl);
                    if (r > 0)
                    {
                        strResponse = "Profile created successfully";
                    }
                    else if (r == 0)
                    {
                        strResponse = "Profile already exists";
                    }
                    else if (r < 0)
                    {
                        strResponse = "Error occured in CreateRole";
                    }
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
コード例 #8
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        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);
        }
コード例 #9
0
 public ProfileController(ProfileContext context,ProfileModel model , ProfileComponent component)
 {
     _context = context;
     _component = component;
     _model = model;
 }