Beispiel #1
0
        private void get_pedido_det()
        {
            try
            {
                LstPedido_det.Clear();

                for (int i = 0; i < gridView_Pedido.RowCount; i++)
                {
                    pre_PedidoXPresupuesto_det_Info info = (pre_PedidoXPresupuesto_det_Info)gridView_Pedido.GetRow(i);
                    if (info != null)
                    {
                        info.IdEmpresa = param.IdEmpresa;
                        var pre = LstPresu.First(var => var.IdPresupuestoCompuesto == info.IdPresupuesto_pre);
                        info.IdPresupuesto_pre = pre.IdPresupuesto;
                        info.IdAnio_pre        = Convert.ToInt32(pre.IdAnio);
                        info.Secuencia_pre     = pre.Secuencia;
                        LstPedido_det.Add(info);
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
Beispiel #2
0
 public Boolean ModificarDBEstadoAprobacion(pre_PedidoXPresupuesto_det_Info info)
 {
     try
     {
         using (EntitiesPresupuesto context = new EntitiesPresupuesto())
         {
             var contact = context.pre_PedidoXPresupuesto_det.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdPedidoXPre == info.IdPedidoXPre && minfo.Secuencia_reg == info.Secuencia_reg);
             if (contact != null)
             {
                 contact.CodEstadoAprobacion = info.CodEstadoAprobacion;
                 contact.Cotizado            = (info.CotizadoB == true) ? "S" : "N";
                 contact.UltiFechaEstadoApro = info.UltiFechaEstadoApro;
                 contact.IdUsuarioEstadoApro = info.IdUsuarioEstadoApro;
                 context.SaveChanges();
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                   "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #3
0
 public Boolean EliminarDB(pre_PedidoXPresupuesto_det_Info info)
 {
     try
     {
         using (EntitiesPresupuesto context = new EntitiesPresupuesto())
         {
             var contact = context.pre_PedidoXPresupuesto_det.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdPedidoXPre == info.IdPedidoXPre && minfo.Secuencia_reg == info.Secuencia_reg);
             if (contact != null)
             {
                 context.pre_PedidoXPresupuesto_det.Add(contact);
                 context.SaveChanges();
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Beispiel #4
0
        private bool  Validar()
        {
            try
            {
                if (searchLookUpEdit_Depart.EditValue == null || searchLookUpEdit_Depart.EditValue == "")
                {
                    MessageBox.Show("Antes de Continuar debe Seleccionar el Departamento  ", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                if (searchLookUpEdit_Prove1.EditValue == null || searchLookUpEdit_Prove1.EditValue == "")
                {
                    MessageBox.Show("Antes de Continuar debe Seleccionar el Proveedor 1  ", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                if (txt_observacion.Text == "")
                {
                    MessageBox.Show("Antes de Continuar ingrese la Observación ", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                if (gridView_Pedido.RowCount <= 1)
                {
                    MessageBox.Show("No se puede continuar porque no ha registrado Productos. Por favor verifiqué eh intente nuevamente  ", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                for (int i = 0; i < gridView_Pedido.RowCount; i++)
                {
                    pre_PedidoXPresupuesto_det_Info info = (pre_PedidoXPresupuesto_det_Info)gridView_Pedido.GetRow(i);
                    if (info != null)
                    {
                        if (info.Cant <= 0.0)
                        {
                            MessageBox.Show("No se puede continuar porque existen registros con cantidad 0. Por favor verifiqué eh intente nuevamente  ", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }
                        if (info.Producto == "")
                        {
                            MessageBox.Show("No se puede continuar porque existen registros Sin Producto. Por favor verifiqué eh intente nuevamente  ", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                return(false);
            }
        }
Beispiel #5
0
        public List <pre_PedidoXPresupuesto_det_Info> ObtenerListPedidoDet(int IdEmpresa, string CodAprobacion = "T", string join = "N")
        {
            try
            {
                string query = "";
                List <pre_PedidoXPresupuesto_det_Info> Lst = new List <pre_PedidoXPresupuesto_det_Info>();
                EntitiesPresupuesto oEnti = new EntitiesPresupuesto();

                if (CodAprobacion == "T")
                {
                    query = "select * from vwpre_PedidoXPresupuesto_det where IdEmpresa=" + IdEmpresa;
                }
                else if (join == "S" && CodAprobacion != "T")
                {
                    query = "select * from vwpre_PedidoXPresupuesto_det where IdEmpresa=" + IdEmpresa + "and  (cast(IdPedidoXPre as varchar(25)) + cast(Secuencia_reg as varchar(25)) + cast(IdPresupuesto_pre as varchar(25)) + cast(IdAnio_pre as varchar(25)) + cast(Secuencia_pre as varchar(25)))  not in(select cast(IdPedidoXPre as varchar(25)) + cast(Secuencia_reg_ped as varchar(25)) + cast(IdPresupuesto_pre as varchar(25)) + cast(IdAnio_pre as varchar(25)) + cast(Secuencia_pre as varchar(25)) from pre_ordencompra_local_det ) and CodEstadoAprobacion = '" + CodAprobacion + "'";
                }
                else
                {
                    query = "select * from vwpre_PedidoXPresupuesto_det where IdEmpresa=" + IdEmpresa + " and CodEstadoAprobacion ='" + CodAprobacion + "' ";
                }

                var Query = oEnti.Database.SqlQuery <pre_PedidoXPresupuesto_det_Info>(query).ToList();

                foreach (var item in Query)
                {
                    pre_PedidoXPresupuesto_det_Info Obj = new pre_PedidoXPresupuesto_det_Info();
                    Obj.IdEmpresa         = item.IdEmpresa;
                    Obj.IdPedidoXPre      = item.IdPedidoXPre;
                    Obj.Secuencia_reg     = item.Secuencia_reg;
                    Obj.IdPresupuesto_pre = item.IdPresupuesto_pre;
                    Obj.IdAnio_pre        = item.IdAnio_pre;
                    Obj.Secuencia_pre     = item.Secuencia_pre;
                    Obj.Producto          = item.Producto;
                    Obj.Cant             = item.Cant;
                    Obj.NPresupuesto_pre = item.NPresupuesto_pre;

                    Lst.Add(Obj);
                }

                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #6
0
 public Boolean GrabarDB(pre_PedidoXPresupuesto_det_Info Info)
 {
     try
     {
         return(data.GrabarDB(Info));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarDB", ex.Message), ex)
               {
                   EntityType = typeof(pre_PedidoXPresupuesto_det_Bus)
               };
     }
 }
 private void gridView_Pedido_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     try
     {
         pre_PedidoXPresupuesto_det_Info c = (pre_PedidoXPresupuesto_det_Info)gridView_Pedido.GetFocusedRow();
         c.UltiFechaEstadoApro = Convert.ToDateTime(param.Fecha_Transac.ToShortDateString());
         c.IdUsuarioEstadoApro = param.IdUsuario;
         //  MessageBox.Show("ijij");
         LstPedido.Add(c);
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
     }
 }
Beispiel #8
0
        public List <pre_PedidoXPresupuesto_det_Info> ObtenerList(int IdEmpresa, decimal IdPedidoXPre)
        {
            try
            {
                List <pre_PedidoXPresupuesto_det_Info> Lst = new List <pre_PedidoXPresupuesto_det_Info>();
                EntitiesPresupuesto oEnti = new EntitiesPresupuesto();

                var Query = from q in oEnti.pre_PedidoXPresupuesto_det
                            where q.IdEmpresa == IdEmpresa && q.IdPedidoXPre == IdPedidoXPre
                            select q;
                foreach (var item in Query)
                {
                    pre_PedidoXPresupuesto_det_Info Obj = new pre_PedidoXPresupuesto_det_Info();
                    Obj.IdEmpresa         = item.IdEmpresa;
                    Obj.IdPedidoXPre      = item.IdPedidoXPre;
                    Obj.Secuencia_reg     = item.Secuencia_reg;
                    Obj.IdPresupuesto_pre = item.IdPresupuesto_pre;
                    Obj.IdAnio_pre        = item.IdAnio_pre;
                    Obj.Secuencia_pre     = item.Secuencia_pre;
                    Obj.Producto          = item.Producto;
                    Obj.Cant = item.Cant;
                    Obj.CodEstadoAprobacion = item.CodEstadoAprobacion;
                    Obj.CotizadoB           = (item.Cotizado == "S") ? true : false;;
                    Obj.Cotizado            = item.Cotizado;
                    Obj.UltiFechaEstadoApro = item.UltiFechaEstadoApro;
                    Obj.IdUsuarioEstadoApro = item.IdUsuarioEstadoApro;

                    Lst.Add(Obj);
                }

                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #9
0
 private void ValidaREgi()
 {
     try
     {
         LstDicPresu.Clear();
         for (int i = 0; i < gridView_Pedido.RowCount; i++)
         {
             pre_PedidoXPresupuesto_det_Info info = (pre_PedidoXPresupuesto_det_Info)gridView_Pedido.GetRow(i);
             if (info != null)
             {
                 string c = info.IdPresupuesto_pre.ToString() + info.Producto;
                 LstDicPresu.Add(c, 1);
             }
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show("El Registro está repetido, \n Se procedio con su eliminación", "Eliminacion de registro repetido", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         gridView_Pedido.DeleteRow(gridView_Pedido.FocusedRowHandle);
     }
 }
Beispiel #10
0
        public Boolean GrabarDB(pre_PedidoXPresupuesto_det_Info Info)
        {
            try
            {
                List <pre_PedidoXPresupuesto_det_Info> Lst = new List <pre_PedidoXPresupuesto_det_Info>();
                using (EntitiesPresupuesto Context = new EntitiesPresupuesto())
                {
                    var Address = new pre_PedidoXPresupuesto_det();

                    Address.IdEmpresa         = Info.IdEmpresa;
                    Address.IdPedidoXPre      = Info.IdPedidoXPre;
                    Address.Secuencia_reg     = Info.Secuencia_reg;
                    Address.IdPresupuesto_pre = Info.IdPresupuesto_pre;
                    Address.IdAnio_pre        = Info.IdAnio_pre;
                    Address.Secuencia_pre     = Info.Secuencia_pre;
                    Address.Producto          = Info.Producto;
                    Address.Cant = Info.Cant;
                    Address.CodEstadoAprobacion = "PEN";
                    Address.Cotizado            = "N";

                    Context.pre_PedidoXPresupuesto_det.Add(Address);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }