示例#1
0
 public void addTaskFree(ClimaTask t)
 {
     if (db.tasks.FindAll(e2 => e2.Usuario.Hash == t.Usuario.Hash).Count < 5)
     {
         db.tasks.Add(t);
         guardardb();
     }
     else
     {
         throw new System.InvalidOperationException("Not premium");
     }
 }
示例#2
0
        public EmailNotification(ClimaTask t, Current c)
        {
            MailMessage msg = new MailMessage();

            msg.From = new MailAddress("*****@*****.**");
            msg.To.Add(t.Usuario.Mail);
            msg.Subject = " Soleado - Actualizacion climatica - " + t.Usuario.NombreDeUsuario + " - " + t.Name;;
            msg.Body    = c.ToString();
            //msg.Attachments.Add(new Attachment(attachedFile));

            SmtpClient smt = new SmtpClient();

            smt.Host = "smtp.gmail.com";
            System.Net.NetworkCredential ntcd = new NetworkCredential();
            ntcd.UserName   = "******";
            ntcd.Password   = "******";
            smt.Credentials = ntcd;
            smt.EnableSsl   = true;
            smt.Port        = 587;
            smt.Send(msg);

            System.Diagnostics.Debug.WriteLine("Your Mail is sended");
        }
示例#3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Convert.ToString(Session["Bearer Token"]).Length > 10)
     {
         try
         { Usuario   auth = Global.db.auth(Session["Bearer Token"].ToString());
           ClimaTask t    = new ClimaTask();
           t.Name    = localidad.Text;
           t.Delay   = Convert.ToInt32(DropDownList2.SelectedValue);
           t.Metodo  = Convert.ToInt32(DropDownList1.SelectedValue);
           t.Lat     = Convert.ToDouble(TextBox1.Text, CultureInfo.GetCultureInfoByIetfLanguageTag("en-US"));
           t.Lon     = Convert.ToDouble(TextBox2.Text, CultureInfo.GetCultureInfoByIetfLanguageTag("en-US"));
           t.Last    = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds - t.Delay;
           t.Usuario = auth;
           auth.addTask(t);
           Response.Redirect("Default.aspx"); }
         catch (Exception e2) {
         }
     }
     else
     {
         Response.Redirect("login.aspx");
     }
 }
示例#4
0
 public void removeTask(ClimaTask t)
 {
     db.tasks.Remove(t);
     guardardb();
 }
示例#5
0
 public void addTask(ClimaTask t)
 {
     db.tasks.Add(t);
     guardardb();
 }
示例#6
0
 public void removeCiudad(ClimaTask task)
 {
     Global.db.removeTask(task);
 }
示例#7
0
 public virtual void addTask(ClimaTask task)
 {
     Global.db.addTask(task);
 }
示例#8
0
 public override void addTask(ClimaTask task)
 {
     Global.db.addTaskFree(task);
 }