Esempio n. 1
0
 partial void Deletetbl_Training(tbl_Training instance);
Esempio n. 2
0
 partial void Updatetbl_Training(tbl_Training instance);
Esempio n. 3
0
		private void detach_tbl_Trainings(tbl_Training entity)
		{
			this.SendPropertyChanging();
			entity.tbl_USER = null;
		}
Esempio n. 4
0
 partial void Inserttbl_Training(tbl_Training instance);
Esempio n. 5
0
        public static bool DoMission(string usuario)
        {
            var FechaHoy = DateTime.Now;
            SessionDBDataContext db = new SessionDBDataContext();

            usuario = Desencriptar(usuario.Replace("Usuario=", ""));
            int UsuarioID = 0;
            try
            {
                UsuarioID = (from t in db.tbl_USERs
                             where t.Usr_Name.Equals(usuario)
                                           select t.Usr_id).Single();

                var ConsultaSiYaEntreno = (from t in db.tbl_Trainings
                                           where t.User_ID == UsuarioID
                                           && t.Train_Date.Month == FechaHoy.Month
                                           && t.Train_Date.Day == FechaHoy.Day
                                           && t.Train_Date.Year == FechaHoy.Year
                                           select t.Train_Date).Single();
                return false;
            }
            catch(Exception){}
            var PuntosGanados = (from u in db.tbl_USERs
                                 where u.Usr_id == UsuarioID
                                     select u).ToList().Single();
            int totalSesiones = Convert.ToInt32(PuntosGanados.Usr_TotalTrainingSessions);

            if (totalSesiones <= 21)
            {
                PuntosGanados.Usr_Strength += 20;
                PuntosGanados.Usr_TotalTrainingSessions = PuntosGanados.Usr_TotalTrainingSessions + 1;
            }
            else if (totalSesiones >= 22 && totalSesiones <= 60)
            {
                PuntosGanados.Usr_Strength += +10;
                PuntosGanados.Usr_TotalTrainingSessions = PuntosGanados.Usr_TotalTrainingSessions + 1;
            }
            else if (totalSesiones >= 61 && totalSesiones <= 141)
            {
                PuntosGanados.Usr_Strength += 5;
                PuntosGanados.Usr_TotalTrainingSessions = PuntosGanados.Usr_TotalTrainingSessions + 1;
            }
            else if (totalSesiones >= 141)
            {
                PuntosGanados.Usr_Strength += 2;
                PuntosGanados.Usr_TotalTrainingSessions = PuntosGanados.Usr_TotalTrainingSessions + 1;
            }
            PuntosGanados.Usr_Experience += 2;

            tbl_Training tra = new tbl_Training();
            tra.User_ID = UsuarioID;
            tra.Train_Date = DateTime.Now;

            db.tbl_Trainings.InsertOnSubmit(tra);
            db.SubmitChanges();
            return true;
        }