public void Delete(Enl_SubCategoriaClientes enlSubCategoriaClientes) { try { SqlCommand command = new SqlCommand("CxC.Spr_Delete_CategoriaClientes", Connection.Get); command.CommandType = CommandType.StoredProcedure; Connection.Get.Open(); command.Parameters.Add(new SqlParameter("@Codigo", enlSubCategoriaClientes.Codigo) { SqlDbType = SqlDbType.NVarChar }); command.ExecuteNonQuery(); } catch (Exception) { //Guardar Error en la tabla de Erroes V.2 throw; } finally { if (Connection.Get.State != ConnectionState.Closed) { Connection.Get.Close(); } } }
public string Insert(Enl_SubCategoriaClientes enlSubCategoriaClientes) { //Validaciones De Lugar if (dalNumeracion.ObtenerTipo("SubCategoria de Clientes") == "Automatico") { if (!string.IsNullOrEmpty(dalNumeracion.ObtenerPrefijo("SubCategoria de Clientes"))) { enlSubCategoriaClientes.Codigo = dalNumeracion.ObtenerPrefijo("SubCategoria de Clientes") + dalNumeracion.ObtenerNumero("Categoria de Clientes").ToString("00000000"); } else { enlSubCategoriaClientes.Codigo = dalNumeracion.ObtenerNumero("SubCategoria de Clientes").ToString("00000000"); } } if (dalSubCategoriaCliente.Search(enlSubCategoriaClientes).Count == 0) { dalSubCategoriaCliente.Insert(enlSubCategoriaClientes); MessageBox.Show("Registro Guardado Correctamente", "SGF"); } else { MessageBox.Show("Registro ya Existe", "SGF"); } return(enlSubCategoriaClientes.Codigo); }
public string IsExiste(Enl_SubCategoriaClientes enlSubCategoriaClientes) { try { SqlCommand command = new SqlCommand("CxC.Spr_IsExiste_SubCategoriaClientes", Connection.Get); command.CommandType = CommandType.StoredProcedure; Connection.Get.Open(); command.Parameters.Add(new SqlParameter("@Codigo", enlSubCategoriaClientes.Codigo) { SqlDbType = SqlDbType.NVarChar }); command.Parameters.Add("@IsExiste", SqlDbType.Bit); command.Parameters["@IsExiste"].Direction = ParameterDirection.Output; command.ExecuteNonQuery(); return(command.Parameters["@IsExiste"].Value.ToString()); } catch (Exception) { throw; } finally { if (Connection.Get.State != ConnectionState.Closed) { Connection.Get.Close(); } } }
public IList <Enl_SubCategoriaClientes> Search(Enl_SubCategoriaClientes entSubCategoriaClientes) { try { SqlCommand command = new SqlCommand("CxC.Spr_Search_SubCategoriaClientes", Connection.Get); command.CommandType = CommandType.StoredProcedure; Connection.Get.Open(); command.Parameters.Add(new SqlParameter() { ParameterName = "@Codigo", SqlDbType = SqlDbType.NVarChar, Value = entSubCategoriaClientes.Codigo }); command.Parameters.Add(new SqlParameter() { ParameterName = "@Nombre", SqlDbType = SqlDbType.NVarChar, Value = entSubCategoriaClientes.Codigo }); var dr = command.ExecuteReader(); var list = new List <Enl_SubCategoriaClientes>(); while (dr.Read()) { list.Add(new Enl_SubCategoriaClientes { Codigo = dr.GetString(dr.GetOrdinal("Codigo")), Nombre = dr.GetString(dr.GetOrdinal("Nombre")), Nota = dr.GetString(dr.GetOrdinal("Nota")), }); } return(list); } catch (Exception) { //Guardar Error en Tabla throw; } finally { if (Connection.Get.State != ConnectionState.Closed) { Connection.Get.Close(); } } }
public IList <Enl_SubCategoriaClientes> Search(Enl_SubCategoriaClientes enlSubCategoriaClientes) { //Validaciones de Luga var ListaSubCategoriacliente = dalSubCategoriaCliente.Search(enlSubCategoriaClientes); if (ListaSubCategoriacliente.Count != 0) { return(ListaSubCategoriacliente); } else { return(null); } }
public bool Delete(Enl_SubCategoriaClientes enlSubCategoriaClientes) { //Validaciones De Lugar if (!string.IsNullOrEmpty(enlSubCategoriaClientes.Codigo)) { if (MessageBox.Show("Realmente Desea Eliminar El Registro", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { dalSubCategoriaCliente.Delete(enlSubCategoriaClientes); MessageBox.Show("Registro Eliminado Exitosamente", "SGF"); return(true); } } return(false); }
public string IsExiste(Enl_SubCategoriaClientes enlSubCategoriaClientes) { return(dalSubCategoriaCliente.IsExiste(enlSubCategoriaClientes)); }
public void Update(Enl_SubCategoriaClientes enlSubCategoriaClientes) { //Validaciones De Lugar dalSubCategoriaCliente.Update(enlSubCategoriaClientes); }