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"); } }
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"); }
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"); } }
public void removeTask(ClimaTask t) { db.tasks.Remove(t); guardardb(); }
public void addTask(ClimaTask t) { db.tasks.Add(t); guardardb(); }
public void removeCiudad(ClimaTask task) { Global.db.removeTask(task); }
public virtual void addTask(ClimaTask task) { Global.db.addTask(task); }
public override void addTask(ClimaTask task) { Global.db.addTaskFree(task); }