public Boolean AnularDB(com_ListadoDiseno_Info Info, ref string msg) { try { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { var address = context.com_ListadoDiseno.First (A => A.IdEmpresa == Info.IdEmpresa && A.IdListadoDiseno == Info.IdListadoDiseno ); address.Estado = "I"; address.Usuario = Info.Usuario; address.lm_Observacion = Info.lm_Observacion; //contact = address; context.SaveChanges(); } msg = "Guardado con exito"; 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; msg = "Error no se guardó " + ex.Message + " "; throw new Exception(ex.ToString()); } }
public Boolean EliminarDB(List <com_ListadoDiseno_Det_Info> LstInfo, ref string msg) { try { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { foreach (var item in LstInfo) { var address = context.com_ListadoDiseno_Det.FirstOrDefault (A => A.IdEmpresa == item.IdEmpresa && A.IdOrdenTaller == item.IdOrdenTaller && A.IdListadoDiseno == item.IdListadoDiseno); if (address != null) { context.com_ListadoDiseno_Det.Remove(address); context.SaveChanges(); } } } msg = "Guardado con exito"; 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; msg = "Error no se guardó " + ex.Message + " "; throw new Exception(ex.ToString()); } }
public Boolean ActualizarEstadoAprob(com_ListadoElementos_x_OT_Det_Info Info, ref string msg) { try { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { var contact = context.com_ListadoElementos_x_OT_Det.FirstOrDefault(obj => obj.IdEmpresa == Info.IdEmpresa && obj.IdListadoElementos_x_OT == Info.IdListadoElementos_x_OT && obj.IdDetalle == Info.IdDetalle); if (contact != null) { contact.IdEstadoAprob = Info.lm_IdEstadoAprobado; context.SaveChanges(); msg = "Se ha procedido actualizar elListado de Elementos #: " + Info.IdListadoElementos_x_OT.ToString() + " exitosamente."; } } 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; msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(List <com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det_Info> LstInfo, string IdEstado) { try { int sec = 1; foreach (var item in LstInfo) { using (EntitiesCompras_Edehsa Context = new EntitiesCompras_Edehsa()) { var Address = new com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Det(); Address.IdEmpresa = item.IdEmpresa; Address.IdSucursal = item.IdSucursal; Address.IdBodega = item.IdBodega; Address.IdMovi_inven_tipo = item.IdMovi_inven_tipo; Address.IdNumMovi = item.IdNumMovi; Address.CodigoBarra = item.CodigoBarra; Address.CodObra_preasignada = item.CodObra_preasignada; sec++; Address.IdProducto = item.IdProducto; Address.dm_cantidad = item.dm_cantidad; Address.Det_Kg = item.Det_Kg; Address.pr_largo = item.pr_largo; Address.largo_total = item.largo_total; Address.largo_restante = item.largo_restante; Address.largo_pieza_entera = item.largo_pieza_entera; Address.cantidad_pieza_entera = item.cantidad_pieza_entera; Address.largo_pieza_complementaria = item.largo_pieza_complementaria; Address.cantidad_pieza_complementaria = item.cantidad_pieza_complementaria; Address.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria; Address.largo_despunte1 = item.largo_despunte1; Address.cantidad_despunte1 = item.cantidad_despunte1; Address.es_despunte_usable1 = item.es_despunte_usable1; Address.largo_despunte2 = item.largo_despunte2; Address.cantidad_despunte2 = item.cantidad_despunte2; Address.es_despunte_usable2 = item.es_despunte_usable2; Address.IdEstadoAprob = IdEstado; Context.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_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(); throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(List <com_ListadoElementos_x_OT_Det_Info> LstInfo, string IdEstado) { try { int sec = 1; foreach (var item in LstInfo) { using (EntitiesCompras_Edehsa Context = new EntitiesCompras_Edehsa()) { var Address = new com_ListadoElementos_x_OT_Det(); Address.IdEmpresa = item.IdEmpresa; Address.IdOrdenTaller = item.IdOrdenTaller; Address.IdListadoElementos_x_OT = item.IdListadoElementos_x_OT; Address.CodObra = item.CodObra; Address.IdDetalle = sec; sec++; Address.IdProducto = item.IdProducto; Address.Unidades = item.Unidades; Address.Det_Kg = item.Det_Kg; Address.pr_largo = item.pr_largo; Address.largo_total = item.largo_total; Address.largo_restante = item.largo_restante; Address.largo_pieza_entera = item.largo_pieza_entera; Address.cantidad_pieza_entera = item.cantidad_pieza_entera; Address.largo_pieza_complementaria = item.largo_pieza_complementaria; Address.cantidad_pieza_complementaria = item.cantidad_pieza_complementaria; Address.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria; Address.largo_despunte1 = item.largo_despunte1; Address.cantidad_despunte1 = item.cantidad_despunte1; Address.es_despunte_usable1 = item.es_despunte_usable1; Address.largo_despunte2 = item.largo_despunte2; Address.cantidad_despunte2 = item.cantidad_despunte2; Address.es_despunte_usable2 = item.es_despunte_usable2; Address.IdEstadoAprob = IdEstado; Context.com_ListadoElementos_x_OT_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(); throw new Exception(ex.ToString()); } }
public Boolean GrabarDB(com_ListadoDiseno_Info info, ref int id, ref string msg) { try { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { var address = new com_ListadoDiseno(); int idEmp = GetId(info.IdEmpresa, ref mensaje); id = idEmp; address.IdListadoDiseno = id; address.IdEmpresa = info.IdEmpresa; address.ot_IdSucursal = info.IdSucursal; address.CodObra = info.CodObra; //address.IdOrdenTaller = (decimal)info.IdOrdenTaller; address.FechaReg = info.FechaReg; address.Estado = info.Estado; address.Usuario = info.Usuario; address.Motivo = info.Motivo.Trim(); address.tipo_listado = info.tipo_listado; address.lm_Observacion = info.lm_Observacion; context.com_ListadoDiseno.Add(address); context.SaveChanges(); msg = "Se ha procedido a grabar el Listado de Diseno #: " + id.ToString() + " exitosamente."; } 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; // msg = "Se ha producido el siguiente error: " + ex.Message; // throw new Exception(ex.ToString()); //} catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } throw new Exception(dbEx.ToString()); } }
public Boolean GrabarDB(List <com_Registro_OrdenCompra_x_Cotizacion_Info> lista, ref string mensaje) { try { int sec = 0; foreach (var item in lista) { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { var address = new com_Registro_OrdenCompra_x_Cotizacion(); //int idpv = GetSecuencia(info.IdEmpresa,); // id = idpv; address.IdEmpresa = item.IdEmpresa; //address.Secuencia = GetSecuencia(info.IdEmpresa,1); address.IdSucursal = item.IdSucursal; address.IdOrdenCompra = item.IdOrdenCompra; address.IdCotizacion = item.IdCotizacion; address.SecuenciaDetalleCotizacion = item.SecuenciaDetalleCotizacion; address.IdListadoMateriales = item.IdListadoMateriales; address.estado = item.estado; context.com_Registro_OrdenCompra_x_Cotizacion.Add(address); context.SaveChanges(); } } mensaje = "Se ha procedido a grabar el registro de Ordenes de Compra por Cotizacion" //+ info.tp_descripcion + " exitosamente."; 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; mensaje = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(mensaje); } }
//public Boolean AnularDB(in_movi_inve_Info MoviInfo, ref string mensaje) //{ // try // { // using (EntitiesInventario context = new EntitiesInventario()) // { // var contact = context.in_movi_inve.FirstOrDefault(prod1 => prod1.IdEmpresa == MoviInfo.IdEmpresa && prod1.IdSucursal == MoviInfo.IdSucursal && prod1.IdBodega == MoviInfo.IdBodega && prod1.IdMovi_inven_tipo == MoviInfo.IdMovi_inven_tipo && prod1.IdNumMovi == MoviInfo.IdNumMovi); // //no elimino el registro solo cambia el estado de activo a inactivo // if (contact != null) // { // contact.Estado = "I"; //cambio el estado de activo por inactivo // contact.cm_observacion = " ***ANULADO***" + contact.cm_observacion; // contact.IdusuarioUltAnu = MoviInfo.IdusuarioUltAnu; // contact.Fecha_UltAnu = DateTime.Now; // contact.Fecha_UltMod = DateTime.Now; // contact.IdUsuarioUltModi = MoviInfo.IdUsuarioUltModi; // contact.MotivoAnulacion = MoviInfo.MotivoAnulacion; // contact.IdEmpresa_x_Anu = MoviInfo.IdEmpresa_x_Anu; // contact.IdSucursal_x_Anu = MoviInfo.IdSucursal_x_Anu; // contact.IdBodega_x_Anu = MoviInfo.IdBodega_x_Anu; // contact.IdMovi_inven_tipo_x_Anu = MoviInfo.IdMovi_inven_tipo_x_Anu; // contact.IdNumMovi_x_Anu = MoviInfo.IdNumMovi_x_Anu; // contact.MotivoAnulacion = MoviInfo.MotivoAnulacion; // context.SaveChanges(); // mensaje = "Anulacion Exitosa.."; // } // } // 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; // mensaje = "Error al Anular: " + ex.Message; // throw new Exception(ex.ToString()); // } //} public Boolean GrabarDB(com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info info, ref decimal id, ref string msg) { try { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { var address = new com_ListadoMaterialesDisponibles_PreAsignado_a_Obra(); decimal idEmp = GetIdMovi_Inven(info.IdEmpresa, info.IdSucursal, info.IdBodega, info.IdMovi_inven_tipo); id = idEmp; address.IdNumMovi = id; address.IdEmpresa = info.IdEmpresa; address.CodObra_preasignada = info.CodObra_preasignada; address.FechaReg = info.FechaReg; address.Estado = info.Estado; address.Usuario = info.Usuario; address.Motivo = info.Motivo.Trim(); address.lm_Observacion = info.lm_Observacion; context.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra.Add(address); context.SaveChanges(); msg = "Se ha procedido a grabar el Listado de Materiales #: " + id.ToString() + " exitosamente."; } 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; msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean GrabarDB(com_ListadoElementos_x_OT_Info info, ref int id, ref string msg) { try { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { var address = new com_ListadoElementos_x_OT(); int idEmp = GetId(info.IdEmpresa, ref mensaje); id = idEmp; address.IdListadoElementos_x_OT = id; address.IdEmpresa = info.IdEmpresa; address.ot_IdSucursal = info.IdSucursal; address.CodObra = info.CodObra; address.IdOrdenTaller = (decimal)info.IdOrdenTaller; address.FechaReg = info.FechaReg; address.Estado = info.Estado; address.Usuario = info.Usuario; address.Motivo = info.Motivo.Trim(); address.lm_Observacion = info.lm_Observacion; context.com_ListadoElementos_x_OT.Add(address); context.SaveChanges(); msg = "Se ha procedido a grabar el Listado de Elementos por OT #: " + id.ToString() + " exitosamente."; } 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; msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(List <com_ListadoDiseno_Det_Info> LstInfo, string IdEstado) { try { int sec = 1; foreach (var item in LstInfo) { using (EntitiesCompras_Edehsa Context = new EntitiesCompras_Edehsa()) { var Address = new com_ListadoDiseno_Det(); Address.IdEmpresa = item.IdEmpresa; Address.IdOrdenTaller = item.IdOrdenTaller; Address.IdListadoDiseno = item.IdListadoDiseno; Address.CodObra = item.CodObra; Address.IdDetalle = sec; sec++; Address.IdProducto = item.IdProducto; Address.Unidades = item.Unidades; Address.Det_Kg = item.Det_Kg; Address.IdEstadoAprob = IdEstado; Context.com_ListadoDiseno_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(); throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(com_ListadoMaterialesDisponibles_PreAsignado_a_Obra_Info info, ref string msg) { try { using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa()) { var contact = context.com_ListadoMaterialesDisponibles_PreAsignado_a_Obra.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdMovi_inven_tipo == info.IdMovi_inven_tipo && obj.IdNumMovi == info.IdNumMovi); if (contact != null) { contact.FechaReg = info.FechaReg; contact.Motivo = info.Motivo; contact.Usuario = info.Usuario; contact.lm_Observacion = info.lm_Observacion; contact.Estado = info.Estado; context.SaveChanges(); msg = "Se ha procedido actualizar el Listado de Materiales #: " + info.IdNumMovi.ToString() + " exitosamente."; } } 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; msg = "Se ha producido el siguiente error: " + ex.Message; throw new Exception(ex.ToString()); } }