public ActionResult Create(Agence agence, DRE dre) { //[Bind(Include = "idag,nomag,wilayaag,addressag,iddre")] if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } try { if (ModelState.IsValid) { agence.Dre = dre; agence.save(); return(RedirectToAction("index")); } } catch { } return(View()); }
public ActionResult Edit(TechnicienDre tech, DRE _dre) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } try { if (ModelState.IsValid) { tech.dre = _dre; tech.edit_by_id(); return(Content("" + _dre.NomDRE)); //return RedirectToAction("Index"); } return(View(tech)); } catch { return(View()); } }
public ActionResult Create(TechnicienDre tech, DRE dre) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } try { if (ModelState.IsValid) { tech.dre = dre; tech.save(); return(RedirectToAction("index")); } } catch { } return(View()); }
// GET: DRE/Details/5 public ActionResult Details(int?id) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Dictionary <String, String> data = new Dictionary <string, string>(); data["NumeroDRE"] = "" + id; DRE dre = new DRE(); dre = dre.find_by_id(data); if (dre == null) { return(HttpNotFound()); } return(View(dre)); }
// GET: DRE/Edit/5 public ActionResult Edit(int?id) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Dictionary <String, String> data = new Dictionary <string, string>(); data["NumeroDRE"] = "" + id; DRE d1 = new DRE(); d1 = d1.find_by_id(data); if (d1 == null) { return(HttpNotFound()); } return(View(d1)); }
public ActionResult Delete(int id, FormCollection collection) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } try { Dictionary <String, String> data = new Dictionary <string, string>(); data["NumeroDRE"] = "" + id; DRE d1 = new DRE(); d1 = d1.find_by_id(data); d1.remove(data); return(RedirectToAction("Index")); } catch { return(View()); } }
public List<DRE> ObterDRE(Departamento departamento) { var criterio = Session.CreateCriteria<Orcamento>(); criterio.Add(Expression.Eq("VersaoFinal", true)); criterio.Add(Expression.Eq("Setor", departamento)); List<Orcamento> orcamentos = criterio.List<Orcamento>().ToList(); DRE dre = new DRE(); List<DRE> dres = new List<DRE>(); foreach (var orcamento in orcamentos) { orcamento.CalcularTotalDRE(); DRE totalDeViagens = new DRE(); totalDeViagens.ValorTotal = Math.Round(orcamento.ValorTotalDRE, 2); totalDeViagens.Nome = orcamento.Legenda; dres.Add(totalDeViagens); } return dres; }
// GET: DRE public ActionResult Index() { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } DRE dre = new DRE(); return(View(dre)); }
public ActionResult Edit([Bind(Include = "NumeroDRE,NomDRE,Wilaya,AdresseDRE")] DRE dre1) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } try { // TODO: Add update logic here dre1.edit_by_id(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create([Bind(Include = "NumeroDRE,NomDRE,Wilaya,AdresseDRE")] DRE dre1) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if ((Session["user"] as Utilisateur).EtatUser != "Superviseur") { return(RedirectToAction("InvalidAccess", "Home")); } try { dre1.save(); } catch { } if (ModelState.IsValid) { return(RedirectToAction("index")); } return(View()); }