Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }