public ActionResult Update(int ID_UNIDAD) { if (Session["Perfil"] != null) { NegocioUnidad obj = new NegocioUnidad(); UNIDAD aux = obj.Read().FirstOrDefault(a => a.ID_UNIDAD == ID_UNIDAD); ViewBag.Usuario = aux.RUT_USU; DataAcces.DaoCliente dc = new DataAcces.DaoCliente(); try { int rut_empresa = Convert.ToInt32(Session["rutempresa"]); List <USUARIO> list = dc.ObtenerListaUsuarios(0, rut_empresa, 1); ViewBag.ListaUsuarios = list; } catch (Exception ex) { new Exception("ERROR EN METODO LISTAR" + ex.Message); } return(View("Update", aux)); } else { return(View("../Mantenedor/LoginProcess")); } }
public ActionResult Read() { if (Session["Perfil"] != null) { NegocioUnidad obj = new NegocioUnidad(); return(View(obj.Read())); } else { return(View("../Mantenedor/LoginProcess")); } }
protected void Page_Load(object sender, EventArgs e) { ClientScript.GetPostBackEventReference(this, ""); if (!IsPostBack) { if (Session["jefeSuperior"] == null) { FormsAuthentication.SignOut(); Response.Redirect("../../Default.aspx"); } NegocioDepartamento negocioDepartamento = new NegocioDepartamento(); NegocioEmpleado negocioEmpleado = new NegocioEmpleado(); NegocioCuenta negocioCuenta = new NegocioCuenta(); NegocioUnidad negocioUnidad = new NegocioUnidad(); string user = Session["usuario"].ToString(); cmbUnidad.Items.Add(new ListItem { Value = "0", Text = "- Seleccione -" }); cmbAño.Items.Add(new ListItem { Value = "0", Text = "- Seleccione -" }); cmbMes.Items.Add(new ListItem { Value = "0", Text = "- Seleccione -" }); cmbMes.Items.Add(new ListItem { Value = DateTime.Now.AddMonths(-1).ToString("MM"), Text = DateTime.Now.AddMonths(-1).ToString("MMMM", CultureInfo.CurrentUICulture) }); int año = Convert.ToInt32(DateTime.Now.ToString("yyyy")); cmbAño.Items.Add(new ListItem { Value = (año).ToString(), Text = (año).ToString() }); int unidad = negocioDepartamento.retornarUnidadByDepartamento(negocioEmpleado.retornarDepartamentoByRut(negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(user)))); foreach (var item in negocioDepartamento.listado()) { if (item.idUnidad == unidad) { if (!item.nombreDepartamento.Equals("Solo Unidad")) { cmbUnidad.Items.Add(new ListItem { Value = item.idDepartamento.ToString(), Text = item.nombreDepartamento }); } } } } if (Request["__EVENTTARGET"] == "limpiar") { limpiar(); } }
public ActionResult Delete(string ID_UNIDAD) { if (Session["Perfil"] != null) { NegocioUnidad obj = new NegocioUnidad(); obj.Delete(ID_UNIDAD); return(RedirectToAction("Read")); } else { return(View("../Mantenedor/LoginProcess")); } }
public ActionResult Update(UNIDAD dto) { if (Session["Perfil"] != null) { NegocioUnidad obj = new NegocioUnidad(); obj.Update(dto); return(RedirectToAction("Read")); } else { return(View("../Mantenedor/LoginProcess")); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["jefeSuperior"] == null) { FormsAuthentication.SignOut(); Response.Redirect("../../Default.aspx"); } NegocioDepartamento negocioDepartamento = new NegocioDepartamento(); NegocioEmpleado negocioEmpleado = new NegocioEmpleado(); NegocioCuenta negocioCuenta = new NegocioCuenta(); NegocioUnidad negocioUnidad = new NegocioUnidad(); string user = Session["usuario"].ToString(); cmbUnidad.Items.Add(new ListItem { Value = "0", Text = "- Seleccione -" }); cmbAño.Items.Add(new ListItem { Value = "0", Text = "- Seleccione -" }); int unidad = negocioDepartamento.retornarUnidadByDepartamento(negocioEmpleado.retornarDepartamentoByRut(negocioEmpleado.retornarRutByCuentaID(negocioCuenta.retornarID(user)))); foreach (var item in negocioDepartamento.listado()) { if (item.idUnidad == unidad) { if (!item.nombreDepartamento.Equals("Solo Unidad")) { cmbUnidad.Items.Add(new ListItem { Value = item.idDepartamento.ToString(), Text = item.nombreDepartamento }); } } } for (int i = 0; i < 9; i++) { int año = Convert.ToInt32(DateTime.Now.ToString("yyyy")); cmbAño.Items.Add(new ListItem { Value = (año - i).ToString(), Text = (año - i).ToString() }); } } }
public ActionResult Insert(FormCollection fc) { UNIDAD dto = new UNIDAD(); dto.NOMBRE = fc["NOMBRE"]; dto.DETALLE = fc["DETALLE"]; dto.RUT_USU = Convert.ToInt32(fc["RUT_USU"]); dto.FechaEstimada = fc["FechaEstimada"]; if (Session["Perfil"] != null) { NegocioUnidad obj = new NegocioUnidad(); obj.Insert(dto); return(RedirectToAction("Read")); } else { return(View("../Mantenedor/LoginProcess")); } }
public ActionResult Replicar(int ID_UNIDAD) { if (Session["Perfil"] != null) { NegocioUnidad obj = new NegocioUnidad(); UNIDAD aux = obj.Read().FirstOrDefault(a => a.ID_UNIDAD == ID_UNIDAD); DataAcces.DaoUnidad du = new DataAcces.DaoUnidad(); try { du.Replicar(aux.ID_UNIDAD); } catch (Exception ex) { new Exception("ERROR EN METODO LISTAR" + ex.Message); } return(RedirectToAction("Read")); } else { return(View("../Mantenedor/LoginProcess")); } }