public CubeWindow(ClientMainWindow window, User user)
 {
     InitializeComponent();
     _mw = window;
     this.user = user;
     modifierBox.Items.Add("Bez Modyfikatora");
     modifierBox.SelectedIndex = 0;
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Story"/> class.
        /// </summary>
        /// <param name="project">The project.</param>  
        /// <param name="createdBy">The user that created this story.</param>
        /// <param name="impact">The impact.</param>
        /// <param name="storyType">Type of the story.</param>
        public Story(Project project, User createdBy, Impact? impact, StoryType storyType)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project", "Project can't be null.");
            }

            if (createdBy == null)
            {
                throw new ArgumentNullException("createdBy", "The user creating this story can't be null.");
            }

            project.AddStory(this);
            this.createdBy = createdBy;
            this.impact = impact;
            this.storyType = storyType;
        }
 public IServiceResults<Guid> AddUser(User user, Tasks task)
 {
     user.IsActive = true;
     user.RegisterDate = DateTime.Now;
     user.LastLoginDate = DateTime.Now;
     _user.Add(user);
     _uow.SaveChanges();
     #region Add Default Role
     _roleManagementService.Value.AddRole(new UserInRole { RoleId = _roleManagementService.Value.GetDefaultRole(), UserId = user.UserId });
     #endregion
     _taskService.Value.AddUserTask(task);
     return new ServiceResults<Guid>
     {
         IsSuccessfull = true,
         Message = string.Empty,
         Result = user.UserId
     };
 }
        public void InitializeServer(DuplexChannelFactory<IService> c, IService s)
        {
            channelFactory = c;
            server = s;
            user = server.User;
            isGM = user.isGM;
            this.DataContext = user;

            if (isGM) {
                tabAtrybuty.Visibility = System.Windows.Visibility.Hidden;
                tabUmiejetnosci.Visibility = System.Windows.Visibility.Hidden;
                tabWyposazenie.Visibility = System.Windows.Visibility.Hidden;
                tabControl.SelectedIndex = 3;
                classPanel.Visibility = System.Windows.Visibility.Hidden;
                labelRace.Visibility = System.Windows.Visibility.Hidden;
                labelGender.Visibility = System.Windows.Visibility.Hidden;

            }
        }
        public IView Register(string username, string password, string confirmPassword, string role)
        {
            if (password != confirmPassword)
            {
                throw new ArgumentException("The provided passwords do not match.");
            }

            this.EnsureNoLoggedInUser();

            var existingUser = this.Data.users.GetByUsername(username);
            if (existingUser != null)
            {
                throw new ArgumentException(string.Format("A user with username {0} already exists.", username));
            }

            Role userRole = (Role)Enum.Parse(typeof(Role), role, true);
            var user = new User(username, password, userRole);
            this.Data.users.Add(user);
            return View(user);
        }
        public Boolean Login(String userName, String userPass)
        {
            var dbUser = db.Select("`users`", "`login`='" + userName + "' AND `pass`='" + userPass + "'");

            if (dbUser.Count > 0) {
                var connection = OperationContext.Current.GetCallbackChannel<IClient>();
                var user = new User();
                user.Initialize(dbUser[0], DateTime.Now);

                // Remove duplicate users (in case of client crash/unsuccesful logout)
                foreach (var _user in _users)
                    if (_user.Value.Name == userName)
                        _users.Remove(_user.Key);

                // Add connection
                _users[connection] = user;

                // Succesful login
                window.Message(user.Name + " logged in.");
                return true;

            } else return false;
        }
Beispiel #7
0
 /// <summary>
 /// Calculates the total time spent on this task by the given user on the given date.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="date">The date.</param>
 /// <returns></returns>
 public virtual TimeSpan TotaalBestedeTijd(User user, DateTime date)
 {
     TimeSpan total = new TimeSpan(0);
     foreach (TimeRegistration timeRegistration in timeRegistrations)
     {
         if (timeRegistration.User == user && timeRegistration.Date.Date == date.Date)
         {
             total = total.Add(timeRegistration.Time);
         }
     }
     return total;
 }
Beispiel #8
0
 /// <summary>
 /// Calculates the total time spent on this task by the given user in the given daterange.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="dateRange">The date range.</param>
 /// <returns></returns>
 public virtual TimeSpan TotalTimeSpent(User user, DateRange? dateRange)
 {
     TimeSpan total = new TimeSpan(0);
     foreach (TimeRegistration timeRegistration in timeRegistrations)
     {
         if ((user != null || timeRegistration.User == user) && (dateRange == null || dateRange.Value.Overlap(timeRegistration.Date.Date)))
         {
             total = total.Add(timeRegistration.Time);
         }
     }
     return total;
 }
Beispiel #9
0
 /// <summary>
 /// Gets all timeregistrations of the given user for the given sprint and date.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="sprint">The sprint.</param>
 /// <param name="date">The date.</param>
 /// <returns></returns>
 public virtual IList<TimeRegistration> GetTimeRegistrationsFor(User user, Sprint sprint, DateTime date)
 {
     IList<TimeRegistration> userTimeRegistrations = new List<TimeRegistration>();
     foreach (TimeRegistration timeRegistration in timeRegistrations)
     {
         if (timeRegistration.User == user && timeRegistration.Sprint == sprint && timeRegistration.Date.ToShortDateString() == date.ToShortDateString())
         {
             userTimeRegistrations.Add(timeRegistration);
         }
     }
     return userTimeRegistrations;
 }
Beispiel #10
0
        /// <summary>
        /// Register time spent on this task.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="date">The date.</param>
        /// <param name="sprint">De sprint.</param>
        /// <param name="time">The time.</param>
        public virtual void RegisterTime(User user, DateTime date, Sprint sprint, TimeSpan time)
        {
            if (!story.Project.Sprints.Contains(sprint))
            {
                throw new ArgumentException("The given sprint does not belong to this project.", "sprint");
            }

            foreach (TimeRegistration registratie in GetTimeRegistrationsFor(user, sprint, date))
            {
                RemoveTimeRegistration(registratie);
            }

            //only add timeregistrations that actually contain time
            if (time.TotalSeconds == 0)
                return;

            TimeRegistration timeRegistration = new TimeRegistration(user, date, sprint, this, time);
            AddTimeRegistration(timeRegistration);
        }
 public void refreshPlayer()
 {
     user = server.User;
 }
Beispiel #12
0
 /// <summary>
 /// Gets all timeregistrations of the given user.
 /// </summary>
 /// <param name="user">The user.</param>
 /// <returns></returns>
 public virtual IList<TimeRegistration> GetTimeRegistrationsFor(User user)
 {
     IList<TimeRegistration> userTimeRegistrations = new List<TimeRegistration>();
     foreach (TimeRegistration timeRegistration in timeRegistrations)
     {
         if (timeRegistration.User == user)
         {
             userTimeRegistrations.Add(timeRegistration);
         }
     }
     return userTimeRegistrations;
 }
 public CoursesController(IBangaloreUniversityDate data, User user)
 {
     Data = data;
     usr = user;
 }
 public void AddLoginDate(User model)
 {
     model.LastLoginDate = DateTime.Now;
     _uow.SaveChanges();
 }
 public IServiceResults<bool> EditBasicInfo(User model)
 {
     var result = FindUser(model.UserId);
     if (result.Result == null)
     {
         return new ServiceResults<bool>
         {
             IsSuccessfull = true,
             Message = BusinessMessage.UserNotExist,
             Result = false
         };
     }
     result.Result.FullName = model.FullName;
     result.Result.Sex = model.Sex;
     result.Result.BirthDate = model.BirthDate;
     result.Result.CvColor = model.CvColor;
     var resultSave = _uow.SaveChanges();
     _taskService.Value.EditUserTaskProgress(result.Result.UserId, TaskType.Profile, result.Result.ProgressRegisterCompleted());
     return new ServiceResults<bool>
     {
         IsSuccessfull = resultSave.ToBool(),
         Message = string.Empty,
         Result = resultSave.ToBool()
     };
 }
        public IServiceResults<bool> EditCallInfo(User model)
        {
            var result = FindUser(model.UserId);
            if (result.Result == null)
            {
                return new ServiceResults<bool>
                {
                    IsSuccessfull = true,
                    Message = BusinessMessage.UserNotExist,
                    Result = false
                };
            }

            result.Result.Facebook = model.Facebook;
            result.Result.Twitter = model.Twitter;
            result.Result.Mobile = model.Mobile;
            result.Result.Email = model.Email;
            result.Result.Latitude = model.Latitude;
            result.Result.Longitude = model.Longitude;
            var resultSave = _uow.SaveChanges();
            _taskService.Value.EditUserTaskProgress(result.Result.UserId, TaskType.Profile, result.Result.ProgressRegisterCompleted());
            return new ServiceResults<bool>
            {
                IsSuccessfull = resultSave.ToBool(),
                Message = resultSave.ToMessage(BusinessMessage.Error),
                Result = resultSave.ToBool()
            };
        }
 public IServiceResults<IEnumerable<User>> GetUsers(User predicate, Guid? classId)
 {
     var model = _user.AsQueryable();
     if (predicate != null)
     {
         model = _user.Where(X => (predicate.FullName == string.Empty || X.FullName.Contains(predicate.FullName)) &&
                       (predicate.Mobile == string.Empty || X.Mobile.Contains(predicate.Mobile)) && X.IsActive == predicate.IsActive)
                      .OrderByDescending(X => X.RegisterDate).AsQueryable();
     }
     if (classId != null)
     {
         model = (from o in model
                  join ucls in _uow.Set<UserInClass>() on o.UserId equals ucls.UserId
                  join cls in _uow.Set<Class>() on ucls.ClassId equals cls.ClassId
                  where cls.ClassId == classId
                  select o);
     }
     return new ServiceResults<IEnumerable<User>>
     {
         IsSuccessfull = true,
         Message = string.Empty,
         Result = model.ToList()
     };
 }