Exemple #1
0
        private void LlamarFormulario(Cl_Enumeradores.eTipo_action Accion)
        {
            try
            {
                com_OrdenPedidoPlantilla_Info row = (com_OrdenPedidoPlantilla_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;
                }

                if (Accion == Cl_Enumeradores.eTipo_action.Anular && row.Estado == false)
                {
                    MessageBox.Show("El registro se encuentra anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                frmCom_OrdenPedidoPlantillaMantenimiento frm = new frmCom_OrdenPedidoPlantillaMantenimiento();
                frm.SetInfo(row ?? new com_OrdenPedidoPlantilla_Info(), Accion);
                frm.MdiParent = this.MdiParent;
                frm.event_delegate_frmCom_OrdenPedidoPlantillaMantenimiento_FormClosing += event_delegate_frmCom_OrdenPedidoPlantillaMantenimiento_FormClosing;
                frm.Show();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
 private void cmb_Imagen_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         info_plantilla = (com_OrdenPedidoPlantilla_Info)gv_Consulta.GetFocusedRow();
         this.Close();
     }
     catch (Exception)
     {
     }
 }
Exemple #3
0
 public bool AnularDB(com_OrdenPedidoPlantilla_Info info)
 {
     try
     {
         return(odata.AnularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #4
0
        public bool ModificarDB(com_OrdenPedidoPlantilla_Info info)
        {
            try
            {
                using (EntitiesCompras db = new EntitiesCompras())
                {
                    var Entity = db.com_OrdenPedidoPlantilla.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdPlantilla == info.IdPlantilla).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.op_Codigo        = info.op_Codigo;
                    Entity.op_Observacion   = info.op_Observacion;
                    Entity.EsCompraUrgente  = info.EsCompraUrgente;
                    Entity.IdPunto_cargo    = info.IdPunto_cargo;
                    Entity.FechaUltModi     = DateTime.Now;
                    Entity.IdUsuarioUltModi = info.IdUsuarioCreacion;

                    var lst = db.com_OrdenPedidoPlantillaDet.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdPlantilla == info.IdPlantilla).ToList();
                    foreach (var item in lst)
                    {
                        db.com_OrdenPedidoPlantillaDet.Remove(item);
                    }

                    int Secuencia = 1;
                    foreach (var item in info.ListaDetalle)
                    {
                        db.com_OrdenPedidoPlantillaDet.Add(new com_OrdenPedidoPlantillaDet
                        {
                            IdEmpresa         = info.IdEmpresa,
                            IdPlantilla       = info.IdPlantilla,
                            Secuencia         = Secuencia++,
                            IdProducto        = item.IdProducto,
                            pr_descripcion    = item.pr_descripcion,
                            IdUnidadMedida    = item.IdUnidadMedida,
                            IdSucursalDestino = item.IdSucursalDestino,
                            IdSucursalOrigen  = item.IdSucursalOrigen,
                            IdPunto_cargo     = item.IdPunto_cargo,
                            opd_Cantidad      = item.opd_Cantidad,
                            opd_Detalle       = item.opd_Detalle
                        });
                    }

                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #5
0
 public void SetInfo(com_OrdenPedidoPlantilla_Info _info, Cl_Enumeradores.eTipo_action _Accion)
 {
     try
     {
         info_pedido = _info;
         Accion      = _Accion;
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #6
0
 public bool GuardarDB(com_OrdenPedidoPlantilla_Info info)
 {
     try
     {
         using (EntitiesCompras db = new EntitiesCompras())
         {
             db.com_OrdenPedidoPlantilla.Add(new com_OrdenPedidoPlantilla
             {
                 IdEmpresa         = info.IdEmpresa,
                 IdPlantilla       = info.IdPlantilla = GetId(info.IdEmpresa),
                 op_Codigo         = info.op_Codigo,
                 op_Observacion    = info.op_Observacion,
                 Estado            = true,
                 IdUsuarioCreacion = info.IdUsuarioCreacion,
                 FechaCreacion     = DateTime.Now,
                 EsCompraUrgente   = info.EsCompraUrgente,
                 IdPunto_cargo     = info.IdPunto_cargo,
             });
             int Secuencia = 1;
             foreach (var item in info.ListaDetalle)
             {
                 db.com_OrdenPedidoPlantillaDet.Add(new com_OrdenPedidoPlantillaDet
                 {
                     IdEmpresa         = info.IdEmpresa,
                     IdPlantilla       = info.IdPlantilla,
                     Secuencia         = Secuencia++,
                     IdProducto        = item.IdProducto,
                     pr_descripcion    = item.pr_descripcion,
                     IdUnidadMedida    = item.IdUnidadMedida,
                     IdSucursalDestino = item.IdSucursalDestino,
                     IdSucursalOrigen  = item.IdSucursalOrigen,
                     IdPunto_cargo     = item.IdPunto_cargo,
                     opd_Cantidad      = item.opd_Cantidad,
                     opd_Detalle       = item.opd_Detalle
                 });
             }
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #7
0
 private void gv_Consulta_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
 {
     try
     {
         com_OrdenPedidoPlantilla_Info row = (com_OrdenPedidoPlantilla_Info)gv_Consulta.GetRow(e.RowHandle);
         if (row != null)
         {
             if (!row.Estado)
             {
                 e.Appearance.ForeColor = Color.Red;
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #8
0
 private void gv_Consulta_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         com_OrdenPedidoPlantilla_Info row = (com_OrdenPedidoPlantilla_Info)gv_Consulta.GetRow(e.FocusedRowHandle);
         if (row != null)
         {
             if (!row.Estado)
             {
                 gv_Consulta.Appearance.FocusedRow.ForeColor  = Color.Red;
                 gv_Consulta.Appearance.FocusedCell.ForeColor = Color.Red;
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #9
0
 private void limpiar()
 {
     try
     {
         info_pedido            = new com_OrdenPedidoPlantilla_Info();
         txt_IdOrdenPedido.Text = string.Empty;
         txt_Observacion.Text   = string.Empty;
         Accion                      = Cl_Enumeradores.eTipo_action.grabar;
         txt_codigo.Text             = string.Empty;
         blst_det                    = new BindingList <com_OrdenPedidoPlantillaDet_Info>();
         gc_detalle.DataSource       = blst_det;
         chk_EsCompraUrgente.Checked = false;
         cmb_PuntoCargoCab.EditValue = null;
         SetAccionInControls();
     }
     catch (Exception)
     {
     }
 }
Exemple #10
0
 public void GetInfo()
 {
     try
     {
         txt_codigo.Focus();
         info_pedido = new com_OrdenPedidoPlantilla_Info
         {
             IdEmpresa         = param.IdEmpresa,
             IdPlantilla       = Accion == Cl_Enumeradores.eTipo_action.grabar ? 0 : Convert.ToDecimal(txt_IdOrdenPedido.Text),
             IdUsuarioCreacion = param.IdUsuario,
             op_Codigo         = txt_codigo.Text,
             op_Observacion    = txt_Observacion.Text,
             EsCompraUrgente   = chk_EsCompraUrgente.Checked,
             IdPunto_cargo     = cmb_PuntoCargoCab.EditValue == null ? null : (int?)cmb_PuntoCargoCab.EditValue,
             ListaDetalle      = new List <com_OrdenPedidoPlantillaDet_Info>(blst_det)
         };
     }
     catch (Exception)
     {
     }
 }
Exemple #11
0
 private void SetInfoInControls()
 {
     try
     {
         info_pedido = bus_orden.GetInfo(info_pedido.IdEmpresa, info_pedido.IdPlantilla);
         if (info_pedido != null)
         {
             txt_IdOrdenPedido.Text      = info_pedido.IdPlantilla.ToString();
             txt_Observacion.Text        = info_pedido.op_Observacion;
             txt_codigo.Text             = info_pedido.op_Codigo;
             chk_EsCompraUrgente.Checked = info_pedido.EsCompraUrgente;
             cmb_PuntoCargoCab.EditValue = info_pedido.IdPunto_cargo;
             blst_det = new BindingList <com_OrdenPedidoPlantillaDet_Info>(bus_detalle.GetList(info_pedido.IdEmpresa, info_pedido.IdPlantilla));
             gc_detalle.DataSource = blst_det;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #12
0
        public bool AnularDB(com_OrdenPedidoPlantilla_Info info)
        {
            try
            {
                using (EntitiesCompras db = new EntitiesCompras())
                {
                    var Entity = db.com_OrdenPedidoPlantilla.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdPlantilla == info.IdPlantilla).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Estado       = false;
                    Entity.FechaUltAnu  = DateTime.Now;
                    Entity.IdUsuarioAnu = info.IdUsuarioCreacion;
                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }