public ActionResult Post(bool IsNew, PresentacionModel varPresentacion) { try { //if (ModelState.IsValid) //{ if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IPresentacionApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var PresentacionInfo = new Presentacion { Clave = varPresentacion.Clave , Descripcion = varPresentacion.Descripcion }; result = !IsNew? _IPresentacionApiConsumer.Update(PresentacionInfo, null, null).Resource.ToString() : _IPresentacionApiConsumer.Insert(PresentacionInfo, null, null).Resource.ToString(); Session["KeyValueInserted"] = result; return(Json(result, JsonRequestBehavior.AllowGet)); //} //return Json(false, JsonRequestBehavior.AllowGet); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
private void EliminarToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Seguro que desea Eliminar la Presentacion?", "Salir", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { PresentacionBusiness ctr = new PresentacionBusiness(); PresentacionModel model = new PresentacionModel(); int id = Convert.ToInt32(Dtg_Presentacion.CurrentRow.Cells["Id_Presentacion"].Value.ToString()); model.Id_Presentacion = id; ClassResult cr = ctr.Presentacion_Elim(model); if (cr.HuboError) { MessageBox.Show("error :" + cr.ErrorMsj); } else { Listar(); } } else if (result == DialogResult.No) { return; } else if (result == DialogResult.Cancel) { return; } }
public void BuscarPresentacion() { PresentacionBusiness ctr = new PresentacionBusiness(); PresentacionModel model = new PresentacionModel(); model.Nombre = txt_buscar.Text; Dtg_Presentacion.DataSource = ctr.BuscarPresentacion(model); //OcultarColumnas(); }
private void Dtg_Presentacion_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { PresentacionModel model = new PresentacionModel(); model.Id_Presentacion = Convert.ToInt32(Dtg_Presentacion.CurrentRow.Cells["Id_Presentacion"].Value.ToString()); model.Nombre = Dtg_Presentacion.CurrentRow.Cells["Nombre"].Value.ToString(); this.PresentacionModel = model; this.DialogResult = DialogResult.OK; this.Close(); }
private void Btn_guardar_Click(object sender, EventArgs e) { PresentacionBusiness ctr = new PresentacionBusiness(); PresentacionModel model = new PresentacionModel(); model.Nombre = txt_nombre.Text; model.Ncorto = txt_NCortoPresentacion.Text; if (!Validar()) { return; } if (Id_Presentacion == 0) { ClassResult cr = ctr.Presentacion_Crea(model); if (cr.HuboError) { MessageBox.Show("error: " + cr.ErrorMsj); } else { // MessageBox.Show("Marca Registrada."); incializarControles(); Listar(); } } else if (Id_Presentacion != 0) { model.Id_Presentacion = Id_Presentacion; ClassResult cr = ctr.Presentacion_Mdf(model); if (cr.HuboError) { MessageBox.Show("error: " + cr.ErrorMsj); } else { /// MessageBox.Show("Marca Editada."); incializarControles(); Listar(); } } else { MessageBox.Show("No se ha especificado el proceso cierre la ventana y vuelva a abrir."); } }
public ActionResult AddPresentacion(int rowIndex = 0, int functionMode = 0, string id = "0") { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; ViewBag.currentRowIndex = rowIndex; ViewBag.functionMode = functionMode; ViewBag.Consult = false; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 43970); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IPresentacionApiConsumer.SetAuthHeader(_tokenManager.Token); PresentacionModel varPresentacion = new PresentacionModel(); if (id.ToString() != "0") { var PresentacionsData = _IPresentacionApiConsumer.ListaSelAll(0, 1000, "Presentacion.Clave=" + id, "").Resource.Presentacions; if (PresentacionsData != null && PresentacionsData.Count > 0) { var PresentacionData = PresentacionsData.First(); varPresentacion = new PresentacionModel { Clave = PresentacionData.Clave , Descripcion = PresentacionData.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(PartialView("AddPresentacion", varPresentacion)); }
private void EditarToolStripMenuItem_Click(object sender, EventArgs e) { try { PresentacionBusiness ctr = new PresentacionBusiness(); PresentacionModel model = new PresentacionModel(); model.Id_Presentacion = Convert.ToInt32(Dtg_Presentacion.CurrentRow.Cells["Id_Presentacion"].Value.ToString()); ClassResult cr = ctr.Presentacion_ConsUn(model); if (cr.Dt1.Rows.Count > 0) { DataRow row = cr.Dt1.Rows[0]; txt_nombre.Text = row["Nombre"].ToString(); txt_NCortoPresentacion.Text = row["NCorto"].ToString(); Id_Presentacion = Convert.ToInt32(row["Id_Presentacion"].ToString()); btn_cancelar.Visible = true; } } catch (Exception ex) { MessageBox.Show("error :" + ex.Message + "-" + ex.StackTrace.ToString()); } }
public DataTable BuscarPresentacion(PresentacionModel presentacionModel) { PresentacionRepository _ventaRepository = new PresentacionRepository(); return(_ventaRepository.FiltrarPresentacion(presentacionModel)); }
public ClassResult Presentacion_ConsUn(PresentacionModel presentacionModel) { PresentacionRepository _ventaRepository = new PresentacionRepository(); return(_ventaRepository.Presentacion_ConsUn(presentacionModel)); }
public ActionResult Create(int Id = 0, int consult = 0, int ModuleId = 0) { if (ModuleId == 0) { ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; } else { Session["CurrentModuleId"] = ModuleId; } var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 43970, ModuleId); if ((!permission.New && Id.ToString() == "0") || (!permission.Edit && Id.ToString() != "0" && (!permission.Consult && consult == 1))) { Response.Redirect("~/"); } ViewBag.Permission = permission; var varPresentacion = new PresentacionModel(); varPresentacion.Clave = Id; ViewBag.ObjectId = "43970"; ViewBag.Operation = "New"; ViewBag.IsNew = true; if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0")) { ViewBag.IsNew = false; ViewBag.Operation = "Update"; _tokenManager.GenerateToken(); _ISpartane_FileApiConsumer.SetAuthHeader(_tokenManager.Token); _IPresentacionApiConsumer.SetAuthHeader(_tokenManager.Token); var PresentacionsData = _IPresentacionApiConsumer.ListaSelAll(0, 1000, "Presentacion.Clave=" + Id, "").Resource.Presentacions; if (PresentacionsData != null && PresentacionsData.Count > 0) { var PresentacionData = PresentacionsData.First(); varPresentacion = new PresentacionModel { Clave = PresentacionData.Clave , Descripcion = PresentacionData.Descripcion }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } var isPartial = false; var isMR = false; var nameMR = string.Empty; var nameAttribute = string.Empty; if (Request.QueryString["isPartial"] != null) { isPartial = Convert.ToBoolean(Request.QueryString["isPartial"]); } if (Request.QueryString["isMR"] != null) { isMR = Convert.ToBoolean(Request.QueryString["isMR"]); } if (Request.QueryString["nameMR"] != null) { nameMR = Request.QueryString["nameMR"].ToString(); } if (Request.QueryString["nameAttribute"] != null) { nameAttribute = Request.QueryString["nameAttribute"].ToString(); } ViewBag.isPartial = isPartial; ViewBag.isMR = isMR; ViewBag.nameMR = nameMR; ViewBag.nameAttribute = nameAttribute; return(View(varPresentacion)); }