Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            OtherUsers otherUsers = db.otherusers.Find(id);

            db.otherusers.Remove(otherUsers);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id")] OtherUsers otherUsers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(otherUsers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(otherUsers));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "Id")] OtherUsers otherUsers)
        {
            if (ModelState.IsValid)
            {
                db.otherusers.Add(otherUsers);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(otherUsers));
        }
Пример #4
0
        private void onStructChanged(int activeTopic, int initiaterId, DeviceType devType)
        {
            if (initiaterId == SessionInfo.Get().person.Id&& devType == DeviceType.Wpf)
            {
                return;
            }

            BusyWndSingleton.Show("Fetching changes...");
            try
            {
                //save selected topic
                int topicUnderSelectionId = -1;
                var sel = lstTopics.SelectedItem as Topic;
                if (sel != null)
                {
                    topicUnderSelectionId = sel.Id;
                }

                //save selected list of points
                var selectedAp = theBadge.DataContext as ArgPoint;

                ForgetDBDiscussionState();
                DiscussionSelectionChanged();

                //select previously selected topic
                if (topicUnderSelectionId != -1)
                {
                    lstTopics.SelectedItem = PrivateCenterCtx.Get().Topic.FirstOrDefault(t0 => t0.Id == topicUnderSelectionId);
                }

                //select previously selected point
                if (selectedAp != null)
                {
                    //own list
                    if (selectedAp.Person.Id == SessionInfo.Get().person.Id)
                    {
                        lstPoints.SelectedItem = null;
                        lstPoints.SelectedItem = OwnArgPoints.FirstOrDefault(ap0 => ap0.Ap.Id == selectedAp.Id);
                    }
                    else
                    {
                        lstOtherUsers.SelectedItem = OtherUsers.FirstOrDefault(u0 => u0.Pers.Id == selectedAp.Person.Id);

                        lstBadgesOfOtherUser.SelectedItem =
                            ArgPointsOfOtherUser.FirstOrDefault(ap0 => ap0.Ap.Id == selectedAp.Id);
                    }
                }
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
Пример #5
0
        public void DeleteTransactionUser()
        {
            if (SelectedTransactionUser != null)
            {
                OtherUsers.Add(SelectedTransactionUser.User);

                db.TransactionUsers.Remove(SelectedTransactionUser);

                TransactionUsersCollection.Remove(SelectedTransactionUser);
                SelectedUser = OtherUsers.FirstOrDefault();
            }
        }
 public bool VerifyUser(string username, string password, out object userData)
 {
     userData = username;
     if (username.ToLower() == "admin" && password == AdminPassword)
     {
         return(true);
     }
     else if (OtherUsers.Contains(username.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Пример #7
0
        // GET: OtherUsers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OtherUsers otherUsers = db.otherusers.Find(id);

            if (otherUsers == null)
            {
                return(HttpNotFound());
            }
            return(View(otherUsers));
        }
Пример #8
0
        public void AddTransactionUser()
        {
            if (SelectedUser != null)
            {
                var thisTu = TransactionUsersCollection.First();
                var tu     = db.TransactionUsers.Create();
                tu.Transaction = thisTu.Transaction;
                tu.User        = SelectedUser;
                db.TransactionUsers.Add(tu);

                TransactionUsersCollection.Add(tu);
                OtherUsers.Remove(SelectedUser);
                SelectedUser = OtherUsers.FirstOrDefault();
            }
        }
Пример #9
0
        private void UpdateOtherUsersDots(DiscCtx ctx, int singleUserId = -1)
        {
            if (_otherUsersDots.IsDuplicate())
            {
                return;
            }
            _otherUsersDots.RecordEvent();

            var topic = lstTopics.SelectedItem as Topic;

            if (topic == null)
            {
                return;
            }

            List <int> usersWithUnreadComments;

            if (singleUserId == -1)
            {
                usersWithUnreadComments = DaoUtils.SubsetOfPersonsWithDots(ctx,
                                                                           OtherUsers.Select(u0 => u0.Pers.Id).ToArray(),
                                                                           topic.Id);
            }
            else
            {
                usersWithUnreadComments = DaoUtils.SubsetOfPersonsWithDots(ctx,
                                                                           new [] { singleUserId },
                                                                           topic.Id);
            }

            foreach (var otherUser in OtherUsers)
            {
                if (singleUserId != -1 && otherUser.Pers.Id != singleUserId)
                {
                    continue;
                }

                otherUser.HasPointsWithUnreadComments =
                    usersWithUnreadComments != null &&
                    usersWithUnreadComments.Contains(otherUser.Pers.Id);
            }
        }
Пример #10
0
        private void UpdateOtherUsers(int discussionId, int ownId)
        {
            OtherUsers.Clear();

            var q = from p in PrivateCenterCtx.Get().Person
                    where p.Topic.Any(t0 => t0.Discussion.Id == discussionId) && !p.Name.StartsWith(DaoUtils.MODER_SUBNAME) &&
                    p.Id != ownId
                    select p;

            foreach (var p in q)
            {
                OtherUsers.Add(new PersonExt(p));
            }

            if (OtherUsers.Count > 0)
            {
                _otherUserSelectedManually  = false;
                lstOtherUsers.SelectedIndex = 0;
                _otherUserSelectedManually  = true;

                UpdateOtherUsersDots(PrivateCenterCtx.Get());
            }
        }
Пример #11
0
        // GET: OtherUsers/Details/5
        public ActionResult PersonProfile(string id, OtherUsers otherusers)
        {
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}

            var user = db.Users.Find(id);

            if (user.Id != null)
            {
                var timezones = TimeZoneInfo.GetSystemTimeZones();
                ViewBag.TimeZone = new SelectList(timezones, "Id", "Id");
                var Profile = db.Users.Find(user.Id);
                return(View(Profile));
            }


            //if (otherusers == null)
            //{
            //    return HttpNotFound();
            //}
            return(View());
        }
Пример #12
0
 public IEnumerable <string> GetSelectableOtherUserNames()
 {
     return(OtherUsers.Select(x => x.UserName));
 }