Example #1
0
        public static TopTenDelete GetModelView(TopTen topTen)
        {
            if (topTen == null)
                return null;

            var topTenDelete = new TopTenDelete(topTen);
            return topTenDelete;
        }
Example #2
0
        /// <summary>
        /// Deletes the specified db.
        /// </summary>
        /// <param name="db">The db.</param>
        /// <param name="topTenId">The top ten id.</param>
        /// <param name="fromUserId">From user id.</param>
        /// <param name="topTen">The top ten.</param>
        /// <returns>DeleteResult.</returns>
        public static DeleteResult Delete(DefaultContext db, int topTenId, int fromUserId, out TopTen topTen)
        {
            topTen = GetDetail(db, topTenId, fromUserId);
            if (topTen == null)
                return DeleteResult.AuthorizationFailed;

            try
            {
                db.TopTens.Remove(topTen);
                db.SaveChanges();
                return DeleteResult.Ok;
            }
            catch (Exception e)
            {
                Logger.SetLog(e);
                return DeleteResult.DbFailed;
            }
        }
Example #3
0
 private TopTenDetails(TopTen topTen)
 {
     TopTenId = topTen.TopTenId;
     ToUser = UserProfileDetails.GetModelView(topTen.ToUser);
     Status = topTen.Status;
     RoleLocalized = topTen.RoleLocalized;
     ShortTermCareerGoal = topTen.ShortTermCareerGoal;
     LongTermCareerGoal = topTen.LongTermCareerGoal;
     TrainingPhone = topTen.TrainingPhone;
     TrainingVideo = topTen.TrainingVideo;
     TrainingBiPresentation = topTen.TrainingBiPresentation;
     TrainingStLecture = topTen.TrainingStLecture;
     Od1 = topTen.Od1;
     Od2 = topTen.Od2;
     Rhetoric = topTen.Rhetoric;
     TeamLeadershipping = topTen.TeamLeadershipping;
     ConductingMeetings = topTen.ConductingMeetings;
     Sns = topTen.Sns;
     AdditionalTraining = topTen.AdditionalTraining;
     ActualCareerStage = topTen.ActualCareerStage;
     LastContact = topTen.LastContact;
     Note = topTen.Note;
     Tasks = topTen.Tasks;
 }
Example #4
0
 /// <summary>
 /// Prevents a default instance of the <see cref="TopTenIndex"/> class from being created.
 /// </summary>
 private TopTenIndex(TopTen topTen)
 {
     TopTenId = topTen.TopTenId;
     FirstName = topTen.ToUser.FirstName;
     LastName = topTen.ToUser.LastName;
     Status = topTen.Status;
     LastContact = topTen.LastContact;
     ActualCareerStage = topTen.ActualCareerStage;
     Role = topTen.Role;
     LyonessId = topTen.ToUser.LyonessId;
 }
Example #5
0
 public TopTen GetModel()
 {
     var topTen = new TopTen
                      {
                          TopTenId = TopTenId,
                          ToUserId = ToUserId,
                          LastContact = LastContact,
                          ShortTermCareerGoal = ShortTermCareerGoal,
                          LongTermCareerGoal = LongTermCareerGoal,
                          TrainingPhone = TrainingPhone,
                          TrainingVideo = TrainingVideo,
                          TrainingBiPresentation = TrainingBiPresentation,
                          TrainingStLecture = TrainingStLecture,
                          Od1 = Od1,
                          Od2 = Od2,
                          Rhetoric = Rhetoric,
                          TeamLeadershipping = TeamLeadershipping,
                          ConductingMeetings = ConductingMeetings,
                          Sns = Sns,
                          AdditionalTraining = AdditionalTraining,
                          ActualCareerStage = ActualCareerStage,
                          Tasks = Tasks,
                          Note = Note,
                          Status = Status
                      };
     return topTen;
 }
Example #6
0
        public static TopTenEdit GetModelView(TopTen topTen)
        {
            if (topTen == null)
                return null;

            var topTenEdit = new TopTenEdit(topTen);
            return topTenEdit;
        }
Example #7
0
 public TopTenDelete(TopTen topTen)
 {
     ToUser = UserProfileDetails.GetModelView(topTen.ToUser);
 }
Example #8
0
        public static TopTenDetails GetModelView(TopTen topTen)
        {
            if (topTen == null)
                return null;

            var topTenDetail = new TopTenDetails(topTen);
            return topTenDetail;
        }
Example #9
0
 private bool IsAccess(TopTen topTen)
 {
     return topTen != null;
 }
Example #10
0
 public void CopyFrom(TopTen topTen)
 {
     LastContact = topTen.LastContact;
     ShortTermCareerGoal = topTen.ShortTermCareerGoal;
     LongTermCareerGoal = topTen.LongTermCareerGoal;
     TrainingPhone = topTen.TrainingPhone;
     TrainingVideo = topTen.TrainingVideo;
     TrainingBiPresentation = topTen.TrainingBiPresentation;
     TrainingStLecture = topTen.TrainingStLecture;
     Od1 = topTen.Od1;
     Od2 = topTen.Od2;
     Rhetoric = topTen.Rhetoric;
     TeamLeadershipping = topTen.TeamLeadershipping;
     ConductingMeetings = topTen.ConductingMeetings;
     Sns = topTen.Sns;
     AdditionalTraining = topTen.AdditionalTraining;
     ActualCareerStage = topTen.ActualCareerStage;
     Tasks = topTen.Tasks;
     Note = topTen.Note;
     Status = topTen.Status;
 }
Example #11
0
        /// <summary>
        /// Updates the specified db.
        /// </summary>
        /// <param name="db">The db.</param>
        /// <param name="fromUserId">From user id.</param>
        /// <param name="topTen">The top ten.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        public static bool Update(DefaultContext db, int fromUserId, ref TopTen topTen)
        {
            TopTen dbTopTen = GetDetail(db, topTen.TopTenId, fromUserId);
            if (dbTopTen == null)
                return false;

            dbTopTen.CopyFrom(topTen);
            db.SaveChanges();

            topTen = dbTopTen;
            return true;
        }
Example #12
0
 /// <summary>
 /// Inserts the specified db.
 /// </summary>
 /// <param name="db">The db.</param>
 /// <param name="fromUserId">From user id.</param>
 /// <param name="topTen">The top ten.</param>
 public static void Insert(DefaultContext db, int fromUserId, ref TopTen topTen)
 {
     topTen.FromUserId = fromUserId;
     db.TopTens.Add(topTen);
     db.SaveChanges();
 }