comparison Agendas/trunk/src/Agendas.Web/Controllers/EventoController.cs @ 182:beeb48ddb44a

Warning con los errores que se guarden en el log del track de un evento durante una notificación (twitter, calendar, blog)
author nelopauselli
date Mon, 08 Aug 2011 21:57:10 -0300
parents 1deccd6c3cb2
children 212c664db5aa
comparison
equal deleted inserted replaced
181:6ee05ceea8c3 182:beeb48ddb44a
54 var r = agenda.Agendar(model.Titulo, model.Ponente, model.Fecha, 54 var r = agenda.Agendar(model.Titulo, model.Ponente, model.Fecha,
55 model.UrlInvitacion, (TipoEvento)model.TipoEvento); 55 model.UrlInvitacion, (TipoEvento)model.TipoEvento);
56 if (r.Succeful) 56 if (r.Succeful)
57 { 57 {
58 this.AddNotification("Evento creado"); 58 this.AddNotification("Evento creado");
59 foreach (var log in r.Warnings)
60 this.AddWarning(log.WarningMessage);
59 return RedirectToAction("Index"); 61 return RedirectToAction("Index");
60 } 62 }
61 ModelState.AddModelError("error", r.ToString()); 63 ModelState.AddModelError("error", r.ToString());
62 } 64 }
63 return View("Defaulteditor", model); 65 return View("Defaulteditor", model);
68 { 70 {
69 var agenda = AgendaFactory.GetAgenda(); 71 var agenda = AgendaFactory.GetAgenda();
70 72
71 var r = agenda.Confirmar(new Guid(id)); 73 var r = agenda.Confirmar(new Guid(id));
72 if (r.Succeful) 74 if (r.Succeful)
75 {
73 this.AddNotification("Evento confirmado"); 76 this.AddNotification("Evento confirmado");
77 foreach (var log in r.Warnings)
78 this.AddWarning(log.WarningMessage);
79 }
74 else 80 else
75 this.AddError("Evento confirmado"); 81 this.AddError("Evento confirmado");
76 82
77 return RedirectToAction("Index"); 83 return RedirectToAction("Index");
78 } 84 }
104 110
105 var r = agenda.Publicar(new Guid(model.Id), model.NroOrden, model.UrlWiki, model.DuracionReal); 111 var r = agenda.Publicar(new Guid(model.Id), model.NroOrden, model.UrlWiki, model.DuracionReal);
106 if (r.Succeful) 112 if (r.Succeful)
107 { 113 {
108 this.AddNotification(string.Format("Evento publicado {0}", model.Titulo)); 114 this.AddNotification(string.Format("Evento publicado {0}", model.Titulo));
115 foreach (var log in r.Warnings)
116 this.AddWarning(log.WarningMessage);
109 return RedirectToAction("Index"); 117 return RedirectToAction("Index");
110 } 118 }
111 ModelState.AddModelError("error", r.ToString()); 119 ModelState.AddModelError("error", r.ToString());
112 } 120 }
113 return View("Defaulteditor", model); 121 return View("Defaulteditor", model);
140 148
141 var r = agenda.ModificarEvento(new Guid(model.Id), model.Titulo, model.Ponente, model.Fecha.Value, model.UrlInvitacion); 149 var r = agenda.ModificarEvento(new Guid(model.Id), model.Titulo, model.Ponente, model.Fecha.Value, model.UrlInvitacion);
142 if (r.Succeful) 150 if (r.Succeful)
143 { 151 {
144 this.AddNotification("evento modificado"); 152 this.AddNotification("evento modificado");
153 foreach (var log in r.Warnings)
154 this.AddWarning(log.WarningMessage);
145 return RedirectToAction("Index"); 155 return RedirectToAction("Index");
146 } 156 }
147 ModelState.AddModelError("error", r.ToString()); 157 ModelState.AddModelError("error", r.ToString());
148 } 158 }
149 return View("Defaulteditor", model); 159 return View("Defaulteditor", model);
176 186
177 var r = agenda.ModificarEvento(new Guid(model.Id), model.Titulo, model.Ponente, model.Fecha.Value, model.UrlInvitacion); 187 var r = agenda.ModificarEvento(new Guid(model.Id), model.Titulo, model.Ponente, model.Fecha.Value, model.UrlInvitacion);
178 if (r.Succeful) 188 if (r.Succeful)
179 { 189 {
180 this.AddNotification("evento agendado"); 190 this.AddNotification("evento agendado");
191 foreach (var log in r.Warnings)
192 this.AddWarning(log.WarningMessage);
181 return RedirectToAction("Index"); 193 return RedirectToAction("Index");
182 } 194 }
183 ModelState.AddModelError("error", r.ToString()); 195 ModelState.AddModelError("error", r.ToString());
184 } 196 }
185 return View("Defaulteditor", model); 197 return View("Defaulteditor", model);
204 216
205 var r = agenda.Proponer(model.Titulo, model.Ponente, model.UrlInvitacion, (TipoEvento)model.TipoEvento); 217 var r = agenda.Proponer(model.Titulo, model.Ponente, model.UrlInvitacion, (TipoEvento)model.TipoEvento);
206 if (r.Succeful) 218 if (r.Succeful)
207 { 219 {
208 this.AddNotification("Evento propuesto"); 220 this.AddNotification("Evento propuesto");
221 foreach (var log in r.Warnings)
222 this.AddWarning(log.WarningMessage);
209 return RedirectToAction("Index"); 223 return RedirectToAction("Index");
210 } 224 }
211 ModelState.AddModelError("error", r.ToString()); 225 ModelState.AddModelError("error", r.ToString());
212 } 226 }
213 return View("Defaulteditor", model); 227 return View("Defaulteditor", model);
215 229
216 [CustomAuthorize(Roles = Roles.Administrador)] 230 [CustomAuthorize(Roles = Roles.Administrador)]
217 public ActionResult Cancelar(string id) 231 public ActionResult Cancelar(string id)
218 { 232 {
219 var agenda = AgendaFactory.GetAgenda(); 233 var agenda = AgendaFactory.GetAgenda();
220 agenda.Cancelar(new Guid(id)); 234 var r = agenda.Cancelar(new Guid(id));
221 235
222 this.AddNotification("Evento cancelado"); 236 if (r.Succeful)
237 {
238 this.AddNotification("Evento cancelado");
239 foreach (var log in r.Warnings)
240 this.AddWarning(log.WarningMessage);
241 }
242 else
243 this.AddError(r.Message);
244 return RedirectToAction("Index");
245 }
246
247 [CustomAuthorize(Roles = Roles.Administrador)]
248 public ActionResult Descartar(string id)
249 {
250 var agenda = AgendaFactory.GetAgenda();
251 var r = agenda.Descartar(new Guid(id));
252
253 if (r.Succeful)
254 {this.AddNotification("Evento descartado");
255 foreach (var log in r.Warnings)
256 this.AddWarning(log.WarningMessage);
257 }
258 else
259 this.AddError(r.Message);
223 return RedirectToAction("Index"); 260 return RedirectToAction("Index");
224 } 261 }
225 262
226 [CustomAuthorize(Roles = Roles.Administrador)] 263 [CustomAuthorize(Roles = Roles.Administrador)]
227 public ActionResult Descartar(string id) 264 public ActionResult ReAgendar(string id)
228 { 265 {
229 var agenda = AgendaFactory.GetAgenda(); 266 var agenda = AgendaFactory.GetAgenda();
230 agenda.Descartar(new Guid(id)); 267 var r = agenda.ReAgendar(new Guid(id));
231 268
232 this.AddNotification("Evento descartado"); 269 if (r.Succeful)
270 {this.AddNotification("Evento re-agendado");
271 foreach (var log in r.Warnings)
272 this.AddWarning(log.WarningMessage);
273 }
274 else
275 this.AddError(r.Message);
276
233 return RedirectToAction("Index"); 277 return RedirectToAction("Index");
234 } 278 }
235 279
236 [CustomAuthorize(Roles = Roles.Administrador)] 280 [CustomAuthorize(Roles = Roles.Administrador)]
237 public ActionResult ReAgendar(string id)
238 {
239 var agenda = AgendaFactory.GetAgenda();
240 agenda.ReAgendar(new Guid(id));
241
242 this.AddNotification("Evento re-agendado");
243 return RedirectToAction("Index");
244 }
245
246 [CustomAuthorize(Roles = Roles.Administrador)]
247 public ActionResult ReProponer(string id) 281 public ActionResult ReProponer(string id)
248 { 282 {
249 var agenda = AgendaFactory.GetAgenda(); 283 var agenda = AgendaFactory.GetAgenda();
250 agenda.ReProponer(new Guid(id)); 284 var r = agenda.ReProponer(new Guid(id));
251 285
252 this.AddNotification("Evento re-propuesto"); 286 if (r.Succeful)
287 {
288 this.AddNotification("Evento re-propuesto");
289 foreach (var log in r.Warnings)
290 this.AddWarning(log.WarningMessage);
291 }
292 else
293 this.AddError(r.Message);
253 return RedirectToAction("Index"); 294 return RedirectToAction("Index");
254 } 295 }
255 } 296 }
256 } 297 }