public int Guardar(Pagos item, out List <Msj> msj) { int val = 1; ObjectParameter VV = new ObjectParameter("VValor_Mensaje", typeof(Int32)); ObjectParameter VM = new ObjectParameter("VMensaje", typeof(String)); msj = new List <Msj>(); Msj param; if (item.Id_Empresa == -1 || item.Id_Empresa == null) { param = new Msj(); param.Mnj = "El campo empresa es obligatorio"; msj.Add(param); item.Id_Empresa = -1; } if (item.Id_Proveedor == -1 || item.Id_Proveedor == null) { param = new Msj(); param.Mnj = "El campo proveedor es obligatorio"; msj.Add(param); item.Id_Proveedor = -1; } if (item.Id_Banco == -1 || item.Id_Banco == null) { param = new Msj(); param.Mnj = "El campo Banco es obligatorio"; msj.Add(param); item.Id_Banco = -1; } if (item.Id_Clabe == -1 || item.Id_Clabe == null) { param = new Msj(); param.Mnj = "El campo Clabe es obligatorio"; msj.Add(param); item.Id_Clabe = -1; } if (item.Importe_Total <= 0) { param = new Msj(); param.Mnj = "El importe debe de ser mayor a 0"; msj.Add(param); } if (!item.F_Compromiso_Pago.HasValue) { param = new Msj(); param.Mnj = "Indicar la fecha compromiso de pago"; msj.Add(param); } if (item.Id_Proyecto == -1 || item.Proyecto == null) { item.Proyecto = false; item.Id_Proyecto = -1; } else { item.Proyecto = true; if (item.Id_Rubro == -1) { param = new Msj(); param.Mnj = "El rubro es obligatorio"; msj.Add(param); item.Id_Rubro = -1; } } if (item.Id_Contrato == -1 || item.Id_Contrato == null) { item.Contrato = false; } else { item.Contrato = true; } item.Anticipo.ToString(); if (item.Id_Moneda == -1 || item.Id_Moneda == null) { param = new Msj(); param.Mnj = "El campo moneda es obligatorio"; msj.Add(param); item.Id_Moneda = -1; } if (string.IsNullOrWhiteSpace(item.Folio_Fiscal)) { param = new Msj(); param.Mnj = "Folio Fiscal es obligatorio"; msj.Add(param); } if (item.Id_N_Cuenta == -1) { param = new Msj(); param.Mnj = "El campo Cuenta es obligatorio"; msj.Add(param); item.Id_N_Cuenta = -1; } item.Fecha_Anticipo_Factura.ToString(); if (!item.F_Emision_Factura.HasValue) { param = new Msj(); param.Mnj = "Indicar fecha de emisión de la factura"; msj.Add(param); } if (item.Id_Tipo_Pago == -1 || item.Id_Tipo_Pago == null) { param = new Msj(); param.Mnj = "El tipo de pago es obligatorio"; msj.Add(param); item.Id_Tipo_Pago = -1; } if (item.Id_Solicitado_por == -1 || item.Id_Solicitado_por == null) { param = new Msj(); param.Mnj = "El Campo solicitado por es obligatorio"; msj.Add(param); item.Id_Solicitado_por = -1; } if (msj.Count == 0) { val = 0; } else { return(val); } try { using (ClusmextContext context = new ClusmextContext()) { context.spPupPagos(item.Id_Pago , item.Id_Estatus_Pago , item.Id_Empresa , item.Id_Proveedor , item.Id_Banco , item.Id_Clabe , item.Importe_Total , item.F_Compromiso_Pago , item.Proyecto , item.Id_Proyecto , item.Contrato , item.Id_Contrato , item.Anticipo , item.Id_Moneda , item.Id_Rubro , -1 , item.Retenciones , item.ISR , item.Folio_Fiscal , item.Id_N_Cuenta , item.Fecha_Anticipo_Factura , item.Otros , item.F_Emision_Factura , item.Creado_por , item.Comentarios , item.Id_Tipo_Pago , item.N_Cotizacion , item.Solicitado_por , item.Id_Clasificacion , item.IVA , item.Id_Solicitado_por , VV , VM); if (VV.Value.ToString() == "0") { } } } catch (Exception ex) { } return(val); }