public async Task <ActionResult> mtdActualizaComerciante(int id, [FromBody] Comisiones comisiones) { try { ParametrosController par = new ParametrosController(context); ActionResult <DateTime> horadeTransaccion = par.mtdObtenerFechaMexico(); var response = await context.tbcomisiones.FirstOrDefaultAsync(x => x.id == id); if (response.id != id) { return(BadRequest()); } response.dcm_porcentaje = comisiones.dcm_porcentaje; response.dcm_valor_fijo = comisiones.dcm_valor_fijo; response.str_tipo = comisiones.str_tipo; response.last_modified_by = comisiones.last_modified_by; response.last_modified_date = horadeTransaccion.Value; response.intidconcesion_id = comisiones.intidconcesion_id; await context.SaveChangesAsync(); return(Ok()); } catch (Exception ex) { //ModelState.AddModelError("token", ex.Message); //return BadRequest(ModelState); return(Json(new { token = ex.Message })); } }
public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; UserFormBase activeForm = null; try { if (pVal.BeforeAction) { switch (pVal.MenuUID) { case "ComisionesVentas.Parametros": activeForm = new Parametros(); activeForm.Show(); break; case "ComisionesVentas.Comisiones": activeForm = new Comisiones(); activeForm.Show(); break; } } //if (pVal.BeforeAction && pVal.MenuUID == "ComisionesVentas.Comisiones") //{ // Comisiones activeForm = new Comisiones(); // activeForm.Show(); //} } catch (Exception ex) { Application.SBO_Application.MessageBox(ex.ToString(), 1, "Ok", "", ""); } }
protected void CargarComision() { Comisiones comision = new Comisiones(); bool registar = true; foreach (GridViewRow row in gridview.Rows) { if (row.Cells[1].Text == this.txtDesc_comision.Text) { registar = false; msgError.Text = "ya existe esa comision"; } } if (registar) { if (cbldPlan.SelectedItem.Text == "Seleccione un Plan") { msgError.Text = "Debe seleccionar un plan"; } else { comision.DescComision = this.txtDesc_comision.Text; comision.AnioEspecialidad = Convert.ToInt32(this.txtanio_especialidad.Text); comision.IdPlan = Convert.ToInt32(this.cbldPlan.SelectedValue); comision.Estado = BusinessEntity.Estados.Nuevo; Logic.Save(comision); this.Limpiar(); } } }
private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { if (Grid0.Rows.SelectedRows.Count > 0) { oUDS = oForm.DataSources.UserDataSources.Item("UD_0"); int nRow = Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder); string[] sVend = new string[2]; sVend[0] = Convert.ToString(Grid0.DataTable.GetValue(0, nRow)); sVend[1] = "(" + Convert.ToString(Grid0.DataTable.GetValue(1, nRow)) + ") - " + Convert.ToString(Grid0.DataTable.GetValue(2, nRow)); SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx); oForm.Close(); switch (sOrigf) { case "Pagos": Comisiones.Asigna_Vendedor_Grid_Pagos(sVend[0]); break; case "Premios": Comisiones.Asigna_Vendedor_Grid_Premios(sVend[0]); break; case "ComisionesA": case "ComisionesR": Comisiones.Agregar_Vendedor_Comisiones_Periodo(sVend); break; } } }
protected void Modificar() { Comisiones comision = new Comisiones(); comision.IdComision = (Convert.ToInt32(this.txtidComision.Text)); comision.DescComision = this.txtDesc_comision.Text; comision.AnioEspecialidad = Convert.ToInt32(this.txtanio_especialidad.Text); comision.IdPlan = Convert.ToInt32(this.cbldPlan.SelectedValue); comision.Estado = BusinessEntity.Estados.Modificar; Logic.Update(comision); this.Limpiar(); }
protected void Eliminar() { try { Comisiones comision = new Comisiones(); comision.IdComision = Convert.ToInt32(this.txtidComision.Text); comision.Estado = BusinessEntity.Estados.Eliminar; Logic.Delete(comision); } catch (Exception ex) { msgError.Text = ex.Message; } }
public Comisiones GetAll() { SqlConnection oCnn = this.CreateConnection(); using (oCnn) { oCnn.Open(); SqlCommand oCmd = new SqlCommand(); using (oCmd) { oCmd.Connection = oCnn; oCmd.CommandType = CommandType.StoredProcedure; oCmd.CommandText = "comisionesGetAll"; Comisiones oComisiones = new Comisiones(); try { SqlDataReader oReader = oCmd.ExecuteReader(); using (oCnn) { while (oReader.Read()) { Comision oComision = new Comision(); oComision.ID = Convert.ToInt32(oReader["id_comision"]); oComision.Descripcion = Convert.ToString(oReader["desc_comision"]); oComision.AnioEspecialidad = Convert.ToInt32(oReader["anio_especialidad"]); oComision.IDPlan= Convert.ToInt32(oReader["id_plan"]); oComisiones.Add(oComision); oComision = null; } return oComisiones; } } catch (Exception Ex) { Exception ExcepcionManejada = new Exception("Error al recuperar lista de comisiones", Ex); throw ExcepcionManejada; } finally { oComisiones = null; } } } }
public void AgregarComision(Decimal porcentajeComisionEncargado, Decimal porcentajeComisionVendedor) { if (Encargado == null) { throw new NegocioException($"Error al registrar la comision del encargado. No se cuentra un encargado en la venta."); } if (Vendedor == null) { throw new NegocioException($"Error al registrar la comision del vendedor. No se cuentra un vendedor en la venta."); } Comisiones.Add(new Comision(IdEncargado, IdSucursal, Id, porcentajeComisionEncargado, PagoTotal.Total)); Comisiones.Add(new Comision(IdVendedor, IdSucursal, Id, porcentajeComisionVendedor, PagoTotal.Total)); }
private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { try { if (Grid0.Rows.SelectedRows.Count > 0) { //oUDS = oForm.DataSources.UserDataSources.Item("UD_1"); string sPago = Convert.ToString(Grid0.DataTable.GetValue(0, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder))); Comisiones.Agregar_Documento_Grid_Pagos(sPago); oForm.Close(); } } catch (Exception) { } }
private void btnComision_Click(object sender, EventArgs e) { Comisiones vComisiones = new Comisiones(CursoActual.IdPlan); vComisiones.ShowDialog(); if (vComisiones.DialogResult != DialogResult.Cancel) { CursoActual.id_comision = vComisiones.SelectIdComision; CursoActual.DescComision = vComisiones.SelectDescComision; lblComision.Text = "Id: " + CursoActual.id_comision + "\n" + CursoActual.DescComision + "\n Espe. " + vComisiones.SelectDescEspecialidad; } else if (Modo != ModoForm.Modificacion) { Notificar("Comisiones", "Debe seleccionar una Comision.\nSi no hay debe crear uno", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { try { if (CheckBox0.Checked) { oForm.Close(); Comisiones.Agregar_Proyecto_Grid_Pagos(""); } if (Grid0.Rows.SelectedRows.Count > 0 && CheckBox0.Checked == false) { oUDS = oForm.DataSources.UserDataSources.Item("UD_1"); string sOrig = oUDS.ValueEx; oUDS = oForm.DataSources.UserDataSources.Item("UD_0"); string sProyecto = Convert.ToString(Grid0.DataTable.GetValue(0, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder))); SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx); oForm.Close(); switch (sOrigf) { case "Consultas": ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_23").Specific).String = sProyecto; break; case "Pagos": Comisiones.Agregar_Proyecto_Grid_Pagos(sProyecto); break; case "Premios": Comisiones.Agregar_Proyecto_Grid_Premios(sProyecto); break; } } } catch (Exception) { } }
private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { try { if (Grid0.Rows.SelectedRows.Count > 0) { oUDS = oForm.DataSources.UserDataSources.Item("UD_1"); string sPedido = Convert.ToString(Grid0.DataTable.GetValue(1, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder))); int TipoOperacion = OptionBtn0.Selected ? 1 : -1; int Vend = CheckBox0.Checked ? Convert.ToInt32(oUDS.ValueEx) : 0;//Si muestra todos los vendedores se pasa la info con el vendedor consultado. Comisiones.Agregar_Documento_Grid_Comisiones(sPedido, ref TipoOperacion, Vend); if (TipoOperacion != 0) { oForm.Close(); } } } catch (Exception) { } }
public async Task <ActionResult> mtdIngresarComerciante([FromBody] Comisiones comisiones) { try { ParametrosController par = new ParametrosController(context); ActionResult <DateTime> horadeTransaccion = par.mtdObtenerFechaMexico(); comisiones.created_date = horadeTransaccion.Value; comisiones.last_modified_date = horadeTransaccion.Value; context.tbcomisiones.Add(comisiones); await context.SaveChangesAsync(); return(Ok()); } catch (Exception ex) { //ModelState.AddModelError("token", ex.Message); //return BadRequest(ModelState); return(Json(new { token = ex.Message })); } }
static void SBO_Application_RightClickEvent(ref SAPbouiCOM.ContextMenuInfo eventInfo, out bool BubbleEvent) { BubbleEvent = true; try { oForm = Application.SBO_Application.Forms.ActiveForm; switch (oForm.TypeEx) { case "ComisionesVentas.Parametros": Parametros.Parametros_RightClickEvent(ref eventInfo, out BubbleEvent); break; case "ComisionesVentas.Comisiones": Comisiones.Comisiones_RightClickEvent(ref eventInfo, out BubbleEvent); break; } } catch (Exception) { } }
static void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try { oForm = Application.SBO_Application.Forms.ActiveForm; switch (oForm.TypeEx) { case "ComisionesVentas.Parametros": Parametros.Parametros_MenuEvent(ref pVal, out BubbleEvent); break; case "ComisionesVentas.Comisiones": Comisiones.Comisiones_MenuEvent(ref pVal, out BubbleEvent); break; } } catch (Exception) { } }
public Comisiones GetOne(int id) { SqlConnection oCnn = this.CreateConnection(); using (oCnn) { oCnn.Open(); SqlCommand oCmd = new SqlCommand(); using (oCmd) { oCmd.Connection = oCnn; oCmd.CommandType = CommandType.StoredProcedure; oCmd.CommandText = "comisionesGetOne"; oCmd.Parameters.AddWithValue("@id_comision", id); //Aunque debemos buscar solo un elemento, siempre devolvemos //una colección. Es más fácil de manipular y controlar Comisiones oComisiones = new Comisiones(); //No retornamos DataSets, siempre utilizamos objetos para hacernos //independientes de la estructura de las tablas en el resto //de las capas. Para ellos leemos con el DataReader y creamos //los objetos asociados que se esperan try { //Ejecutamos el comando y retornamos los valores SqlDataReader oReader = oCmd.ExecuteReader(); using (oReader) { while (oReader.Read()) { //si existe algun valor, creamos el objeto y lo almacenamos en la colección Comision oComision = new Comision(); oComision.ID = Convert.ToInt32(oReader["id_comision"]); oComision.Descripcion = Convert.ToString(oReader["desc_comision"]); oComision.AnioEspecialidad = Convert.ToInt32(oReader["anio_especialidad"]); oComision.IDPlan = Convert.ToInt32(oReader["id_plan"]); //Agregamos el objeto a la coleccion de resultados oComisiones.Add(oComision); oComision = null; } //retornamos los valores encontrados return oComisiones; } } catch (Exception Ex) { Exception ExcepcionManejada = new Exception("Error al recuperar datos de la comisión", Ex); throw ExcepcionManejada; } finally { //liberamos la memoria utilizada por los objetos oComisiones = null; } } } }
static void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try { if ((pVal.FormTypeEx != null) && (pVal.FormTypeEx == "ComisionesVentas.Parametros") && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK || pVal.EventType == SAPbouiCOM.BoEventTypes.et_RIGHT_CLICK || pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)) { Parametros.Parametros_ItemEvent(FormUID, ref pVal, oCompany, Application.SBO_Application, out BubbleEvent); } if ((pVal.FormTypeEx != null) && (pVal.FormTypeEx == "ComisionesVentas.Comisiones") && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED || pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK || pVal.EventType == SAPbouiCOM.BoEventTypes.et_RIGHT_CLICK || pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST || pVal.EventType == SAPbouiCOM.BoEventTypes.et_VALIDATE)) { Comisiones.Comisiones_ItemEvent(FormUID, ref pVal, oCompany, Application.SBO_Application, out BubbleEvent); } } catch (Exception) { } //'------------------------------------------------------------------------------------------------------------------------------------------------ //' ESTOS EVENTOS MANEJAN LA CONDICION MODAL DE LAS PANTALLAS DONDE ReportType = "Modal" //'------------------------------------------------------------------------------------------------------------------------------------------------ if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_VISIBLE && pVal.BeforeAction == false) { try { oForm = Application.SBO_Application.Forms.Item(pVal.FormUID); if (oForm.ReportType == "Modal") { esPantallaModal = true; IDPantallaModal = pVal.FormUID; } } catch (Exception) { } } if (esPantallaModal && FormUID != IDPantallaModal && IDPantallaModal.Trim().Length > 0 && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE || pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DEACTIVATE || pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK)) { oForm = Application.SBO_Application.Forms.Item(IDPantallaModal); oForm.Select(); // Selecciona la pantalla modal BubbleEvent = false; } //' If the modal from is closed... if (FormUID == IDPantallaModal && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE && esPantallaModal) { esPantallaModal = false; IDPantallaModal = ""; } //'------------------------------------------------------------------------------------------------------------------------------------------------ //if (pVal.FormTypeEx == "139" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST && pVal.BeforeAction == false) //{ // SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; // string sCFL_ID = oCFLEvento.ChooseFromListUID; // oForm = Application.SBO_Application.Forms.Item(pVal.FormUID); // SAPbouiCOM.ChooseFromList oCFL = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item(sCFL_ID); // SAPbouiCOM.DataTable oDataTable = oCFLEvento.SelectedObjects; // string val = ""; // try // { // val = oDataTable.GetValue(0, 0).ToString(); // oForm.DataSources.UserDataSources.Item("UDS_CFLPRO").ValueEx = val; // } // catch (Exception) // { // } // //string XX= ((SAPbouiCOM.IChooseFromListEvent)pVal).ChooseFromListUID; //} }
public Comisiones GetAllPorPlan(int id) { SqlConnection oCnn = this.CreateConnection(); using (oCnn) { oCnn.Open(); SqlCommand oCmd = new SqlCommand(); using (oCmd) { oCmd.Connection = oCnn; oCmd.CommandType = CommandType.StoredProcedure; oCmd.CommandText = "comisionesGetAllPorPlan"; oCmd.Parameters.AddWithValue("@id_plan", id); Comisiones oComisiones = new Comisiones(); try { SqlDataReader oReader = oCmd.ExecuteReader(); using (oReader) { while (oReader.Read()) { Comision oComision = new Comision(); oComision.ID = Convert.ToInt32(oReader["id_comision"]); oComision.Descripcion = Convert.ToString(oReader["desc_comision"]); oComision.AnioEspecialidad = Convert.ToInt32(oReader["anio_especialidad"]); oComision.IDPlan = Convert.ToInt32(oReader["id_plan"]); oComisiones.Add(oComision); oComision = null; } return oComisiones; } } catch (Exception Ex) { Exception ExcepcionManejada = new Exception("Error al recuperar datos de la comisión", Ex); throw ExcepcionManejada; } finally { //liberamos la memoria utilizada por los objetos oComisiones = null; } } } }