public Boolean AnularDB(in_Motivo_Inven_Borrar_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_Motivo_Inven_Borrar.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdMotivo_Inv == Info.IdMotivo_Inv);

                    contact.estado = Info.estado;

                    contact.FechaHoraAnul   = DateTime.Now;
                    contact.MotivoAnulacion = "anulado";
                    contact.IdUsuarioUltAnu = "sys";

                    context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                msg = ex.ToString();

                return(false);
            }
        }
        public Boolean ModificarDB(in_Motivo_Inven_Borrar_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_Motivo_Inven_Borrar.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdMotivo_Inv == Info.IdMotivo_Inv);

                    contact.Cod_Motivo_Inv    = Info.Cod_Motivo_Inv;
                    contact.Desc_mov_inv      = Info.Desc_mov_inv;
                    contact.estado            = Info.estado;
                    contact.Genera_Movi_Inven = Info.Genera_Movi_Inven;

                    contact.Fecha_UltMod    = DateTime.Now;
                    contact.IdUsuarioUltMod = "sys";



                    context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                msg = ex.ToString();

                return(false);
            }
        }
 public Boolean AnularDB(in_Motivo_Inven_Borrar_Info Info, ref string msg)
 {
     try
     {
         return(Odata.AnularDB(Info, ref msg));
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemple #4
0
        public void set_Info(in_Motivo_Inven_Borrar_Info _Info)
        {
            try
            {
                Info = _Info;

                txt_id.Text              = Info.IdMotivo_Inv.ToString();
                txt_codigo.Text          = Info.Cod_Motivo_Inv;
                txt_descripcion.Text     = Info.Desc_mov_inv;
                chk_estado.Checked       = (Info.estado == "A") ? true : false;
                chk_gen_movi_inv.Checked = (Info.Genera_Movi_Inven == "S") ? true : false;
            }
            catch (Exception ex)
            {
            }
        }
        public List <in_Motivo_Inven_Borrar_Info> consultar(int IdEmpresa)
        {
            try
            {
                List <in_Motivo_Inven_Borrar_Info> lista = new List <in_Motivo_Inven_Borrar_Info>();

                EntitiesInventario DBEnties = new EntitiesInventario();

                var QuerryResult = from C in DBEnties.in_Motivo_Inven_Borrar
                                   where C.IdEmpresa == IdEmpresa
                                   select C;

                foreach (var item in QuerryResult)
                {
                    in_Motivo_Inven_Borrar_Info Info = new in_Motivo_Inven_Borrar_Info();



                    Info.IdEmpresa         = item.IdEmpresa;
                    Info.IdMotivo_Inv      = item.IdMotivo_Inv;
                    Info.Cod_Motivo_Inv    = item.Cod_Motivo_Inv;
                    Info.Desc_mov_inv      = item.Desc_mov_inv;
                    Info.Genera_Movi_Inven = item.Genera_Movi_Inven;
                    Info.Fecha_Transac     = item.Fecha_Transac;
                    Info.estado            = item.estado;


                    lista.Add(Info);
                }



                return(lista);
            }
            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.InnerException + " " + ex.Message;
                return(new List <in_Motivo_Inven_Borrar_Info>());
            }
        }
        public Boolean GrabarDB(in_Motivo_Inven_Borrar_Info Info, ref int Id, ref string msg)
        {
            try
            {
                using (EntitiesInventario DBInven = new EntitiesInventario())
                {
                    var que = from C in DBInven.in_Motivo_Inven_Borrar
                              where C.IdEmpresa == Info.IdEmpresa &&
                              C.IdMotivo_Inv == Info.IdMotivo_Inv
                              select C;

                    if (que.Count() == 0)
                    {
                        var TablaDb = new  in_Motivo_Inven_Borrar();

                        TablaDb.IdEmpresa         = Info.IdEmpresa;
                        TablaDb.IdMotivo_Inv      = Info.IdMotivo_Inv = Id = getId(Info.IdEmpresa);
                        TablaDb.Cod_Motivo_Inv    = Info.Cod_Motivo_Inv;
                        TablaDb.Desc_mov_inv      = Info.Desc_mov_inv;
                        TablaDb.Genera_Movi_Inven = Info.Genera_Movi_Inven;
                        TablaDb.estado            = Info.estado;
                        TablaDb.Genera_CXP        = Info.Genera_CXP;
                        TablaDb.IdUsuarioUltMod   = "sys";
                        TablaDb.Fecha_Transac     = DateTime.Now;

                        DBInven.in_Motivo_Inven_Borrar.AddObject(TablaDb);
                        DBInven.SaveChanges();
                    }
                    else
                    {
                        msg = "";
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                msg = ex.ToString();

                return(false);
            }
        }
Exemple #7
0
        private void preparar_formulario(Cl_Enumeradores.eTipo_action _Accion)
        {
            frm = new FrmIn_Motivo_Inven_borrar_Mant();

            if (_Accion != Cl_Enumeradores.eTipo_action.grabar)
            {
                Info = (in_Motivo_Inven_Borrar_Info)gridViewTipoInve.GetFocusedRow();

                if (Info != null)
                {
                    if (Info.estado == "I")
                    {
                        MessageBox.Show("No se pueden modificar registros inactivos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                    }
                }
                else
                {
                    MessageBox.Show("debe seleccionar un registro ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                }
            }

            if (_Accion == Cl_Enumeradores.eTipo_action.borrar)
            {
                Info = (in_Motivo_Inven_Borrar_Info)gridViewTipoInve.GetFocusedRow();
                if (Info != null)
                {
                    if (Info.estado == "I")
                    {
                        MessageBox.Show("El registro ya se encuentra Anulado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                    }
                    else
                    {
                        frm = new FrmIn_Motivo_Inven_borrar_Mant();
                        frm.set_Acccion(Cl_Enumeradores.eTipo_action.borrar);

                        frm.Text = frm.Text + "***ANULAR REGISTRO***";
                        frm.Show();
                        frm.MdiParent = this.MdiParent;
                    }
                }
                else
                {
                    MessageBox.Show("Seleccione un Registro a Anular", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                }
            }


            switch (_Accion)
            {
            case Cl_Enumeradores.eTipo_action.actualizar:
                frm.set_Info(Info);
                break;

            case Cl_Enumeradores.eTipo_action.grabar:
                break;

            case Cl_Enumeradores.eTipo_action.consultar:
                frm.set_Info(Info);
                break;

            case Cl_Enumeradores.eTipo_action.borrar:
                frm.set_Info(Info);
                break;
            }


            frm.set_Acccion(_Accion);
            frm.MdiParent = this.MdiParent;
            frm.Show();
        }