示例#1
0
        public Boolean EliminarDB(ct_cbtecble_Plantilla_Info info)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_cbtecble_Plantilla.FirstOrDefault(tb => tb.IdEmpresa == info.IdEmpresa && tb.IdTipoCbte == info.IdTipoCbte && tb.IdPlantilla == info.IdPlantilla);
                    if (contact != null)
                    {
                        contact.cb_Estado      = "I";
                        contact.IdUsuarioAnu   = info.IdUsuarioAnu;
                        contact.cb_MotivoAnu   = info.cb_MotivoAnu;
                        contact.cb_Observacion = "*** ANULADO *** - " + info.cb_Observacion;
                        contact.cb_FechaAnu    = DateTime.Now;
                        context.SaveChanges();

                        ct_cbtecble_Plantilla_det_Data        PLa_Data      = new ct_cbtecble_Plantilla_det_Data();
                        List <ct_cbtecble_Plantilla_det_Info> Lista_detalle = new List <ct_cbtecble_Plantilla_det_Info>();
                        Lista_detalle = PLa_Data.Get_list_Planilla_det(info.IdEmpresa, info.IdTipoCbte, info.IdPlantilla);

                        foreach (var item in Lista_detalle)
                        {
                            item.dc_Observacion = "***ANULADO*** - " + item.dc_Observacion;
                            PLa_Data.ModificarDB(item);
                        }
                    }
                }
                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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }