private void GetInfo() { try { info = new com_ConvenioPreciosPorProducto_Info { IdEmpresa = param.IdEmpresa, IdProducto = Convert.ToDecimal(cmbProducto.EditValue), IdUnidadMedida = cmbUnidad.EditValue.ToString(), IdProveedor = Convert.ToDecimal(cmbProveedor.EditValue), IdTerminoPago = cmbTermino.EditValue.ToString(), IdComprador = Convert.ToInt32(cmbComprador.EditValue), FechaFin = de_Fecha.DateTime, PrecioUnitario = Convert.ToDouble(string.IsNullOrEmpty(txtPrecioUni.Text) ? "0" : txtPrecioUni.Text), PorDescuento = Convert.ToDouble(string.IsNullOrEmpty(txtPorDesc.Text) ? "0" : txtPorDesc.Text), Descuento = Convert.ToDouble(string.IsNullOrEmpty(txtDescUni.Text) ? "0" : txtDescUni.Text), PrecioFinal = Convert.ToDouble(string.IsNullOrEmpty(txtPrecioFinal.Text) ? "0" : txtPrecioFinal.Text), TiempoEntrega = Convert.ToInt32(string.IsNullOrEmpty(txtDiasEntrega.Text) ? "0" : txtDiasEntrega.Text), SaltaPaso2 = chkPaso2.Checked, SaltaPaso3 = chkPaso3.Checked, SaltoPaso4 = chkPaso4.Checked, SaltoPaso5 = chkPaso5.Checked }; } catch (Exception) { throw; } }
public bool ModificarDB(com_ConvenioPreciosPorProducto_Info info) { try { using (EntitiesCompras db = new EntitiesCompras()) { var Entity = db.com_ConvenioPreciosPorProducto.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdProducto == info.IdProducto).FirstOrDefault(); if (Entity == null) { return(false); } Entity.IdProveedor = info.IdProveedor; Entity.IdComprador = info.IdComprador; Entity.IdTerminoPago = info.IdTerminoPago; Entity.IdUnidadMedida = info.IdUnidadMedida; Entity.PrecioUnitario = info.PrecioUnitario; Entity.PorDescuento = info.PorDescuento; Entity.Descuento = info.Descuento; Entity.PrecioFinal = info.PrecioFinal; Entity.TiempoEntrega = info.TiempoEntrega; Entity.FechaFin = info.FechaFin; Entity.SaltaPaso2 = info.SaltaPaso2; Entity.SaltaPaso3 = info.SaltaPaso3; Entity.SaltoPaso4 = info.SaltoPaso4; Entity.SaltoPaso5 = info.SaltoPaso5; db.SaveChanges(); } return(true); } catch (Exception) { throw; } }
private void Limpiar() { try { cmbProducto.EditValue = null; cmbUnidad.EditValue = null; cmbProveedor.EditValue = null; cmbTermino.EditValue = null; cmbComprador.EditValue = null; txtPrecioUni.Text = "0"; txtPorDesc.Text = "0"; txtDescUni.Text = "0"; txtPrecioFinal.Text = "0"; txtDiasEntrega.Text = "0"; de_Fecha.DateTime = DateTime.Now; chkPaso2.Checked = false; chkPaso3.Checked = false; chkPaso4.Checked = false; Accion = Cl_Enumeradores.eTipo_action.grabar; info = new com_ConvenioPreciosPorProducto_Info(); SetAccionInControls(); } catch (Exception) { throw; } }
public bool EliminarDB(com_ConvenioPreciosPorProducto_Info info) { try { return(odata.EliminarDB(info)); } catch (Exception) { throw; } }
public FrmCom_ConvenioPreciosMantenimiento() { param = cl_parametrosGenerales_Bus.Instance; info = new com_ConvenioPreciosPorProducto_Info(); bus_convenio = new com_ConvenioPreciosPorProducto_Bus(); bus_prov = new cp_proveedor_Bus(); bus_prod = new in_producto_Bus(); bus_termino = new com_TerminoPago_Bus(); bus_comp = new com_comprador_Bus(); bus_unidad = new in_UnidadMedida_Bus(); InitializeComponent(); event_delegate_FrmCom_ConvenioPreciosMantenimiento_FormClosing += FrmCom_ConvenioPreciosMantenimiento_event_delegate_FrmCom_ConvenioPreciosMantenimiento_FormClosing; }
public bool EliminarDB(com_ConvenioPreciosPorProducto_Info info) { try { using (EntitiesCompras db = new EntitiesCompras()) { db.com_ConvenioPreciosPorProducto.Remove(db.com_ConvenioPreciosPorProducto.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdProducto == info.IdProducto).FirstOrDefault()); db.SaveChanges(); } return(true); } catch (Exception) { throw; } }
private void LlamarFormulario(Cl_Enumeradores.eTipo_action Accion) { try { com_ConvenioPreciosPorProducto_Info row = (com_ConvenioPreciosPorProducto_Info)gv_Consulta.GetFocusedRow(); if (Accion != Cl_Enumeradores.eTipo_action.grabar && row == null) { MessageBox.Show("Seleccione un registro", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } FrmCom_ConvenioPreciosMantenimiento frm = new FrmCom_ConvenioPreciosMantenimiento(); frm.event_delegate_FrmCom_ConvenioPreciosMantenimiento_FormClosing += frm_event_delegate_FrmCom_ConvenioPreciosMantenimiento_FormClosing; frm.SetAccion(Accion, row ?? new com_ConvenioPreciosPorProducto_Info()); frm.MdiParent = this.MdiParent; frm.Show(); } catch (Exception) { throw; } }
public bool GuardarDB(com_ConvenioPreciosPorProducto_Info info) { try { using (EntitiesCompras db = new EntitiesCompras()) { var Entity = db.com_ConvenioPreciosPorProducto.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdProducto == info.IdProducto).FirstOrDefault(); if (Entity != null) { return(ModificarDB(info)); } db.com_ConvenioPreciosPorProducto.Add(new com_ConvenioPreciosPorProducto { IdEmpresa = info.IdEmpresa, IdProducto = info.IdProducto, IdProveedor = info.IdProveedor, IdComprador = info.IdComprador, IdTerminoPago = info.IdTerminoPago, IdUnidadMedida = info.IdUnidadMedida, PrecioUnitario = info.PrecioUnitario, PorDescuento = info.PorDescuento, Descuento = info.Descuento, PrecioFinal = info.PrecioFinal, TiempoEntrega = info.TiempoEntrega, FechaFin = info.FechaFin, SaltaPaso2 = info.SaltaPaso2, SaltaPaso3 = info.SaltaPaso3, SaltoPaso4 = info.SaltoPaso4, SaltoPaso5 = info.SaltoPaso5 }); db.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public void SetAccion(Cl_Enumeradores.eTipo_action _Accion, com_ConvenioPreciosPorProducto_Info _info) { Accion = _Accion; info = _info; }