/// <summary> /// Insertar, Editar y Eliminar Empresa /// </summary> /// <param name="ESGR_Empresa">Objecto de la Entidad Empresa</param> public void TransEmpresa(ESGR_Empresa ESGR_Empresa) { try { var objCmpSql = new CmpSql(SGRVariables.ConectionString); objCmpSql.CommandProcedure("spSGR_SET_Empresa"); objCmpSql.AddParameter("@Opcion", SqlDbType.Char, ESGR_Empresa.Opcion); objCmpSql.AddParameter("@IdEmpresa", SqlDbType.SmallInt, ESGR_Empresa.IdEmpresa); objCmpSql.AddParameter("@RazonSocial", SqlDbType.VarChar, ESGR_Empresa.RazonSocial); objCmpSql.AddParameter("@Ruc", SqlDbType.Char, ESGR_Empresa.Ruc); objCmpSql.AddParameter("@DireccionFiscal", SqlDbType.VarChar, ESGR_Empresa.DireccionFiscal); objCmpSql.AddParameter("@Rubro", SqlDbType.VarChar, ESGR_Empresa.Rubro); objCmpSql.AddParameter("@Telefono", SqlDbType.VarChar, ESGR_Empresa.Telefono); objCmpSql.AddParameter("@RegimenTributario", SqlDbType.VarChar, ESGR_Empresa.RegimenTributario); objCmpSql.AddParameter("@NombreComercial", SqlDbType.VarChar, ESGR_Empresa.NombreComercial); objCmpSql.AddParameter("@RepresentanteLegal", SqlDbType.VarChar, ESGR_Empresa.RepresentanteLegal); //objCmpSql.AddParameter("@IdCliProveedor", SqlDbType.Int, ESGR_Empresa.IdCliProveedor); objCmpSql.AddParameter("@ExoneradoIGV", SqlDbType.Bit, (ESGR_Empresa.ExoneradoIGV == null) ? false : ESGR_Empresa.ExoneradoIGV); objCmpSql.ExecuteNonQuery(); } catch (Exception) { throw; } }
/// <summary> /// Lista de Empresa Sucursal /// </summary> /// <returns>Colección de Empresa Sucursal</returns> public CmpObservableCollection <ESGR_EmpresaSucursal> GetCollectionEmpresaSucursal(ESGR_Empresa ESGR_Empresa) { try { var objCmpSql = new CmpSql(SGRVariables.ConectionString); var CollectionEmpresaSucursal = new CmpObservableCollection <ESGR_EmpresaSucursal>(); objCmpSql.CommandProcedure("spSGR_GET_BusquedaGeneral"); objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, "GetEmpSucursal"); objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, ""); objCmpSql.AddParameter("@ParameterId", SqlDbType.Int, ESGR_Empresa.IdEmpresa); DataTable dt = objCmpSql.ExecuteDataTable(); for (int x = 0; x < dt.Rows.Count; x++) { CollectionEmpresaSucursal.Add(new ESGR_EmpresaSucursal { IdEmpSucursal = (dt.Rows[x]["IdEmpSucursal"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpSucursal"]) : Convert.ToInt16(0), Principal = (dt.Rows[x]["Principal"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["Principal"]) : false, Sucursal = (dt.Rows[x]["Sucursal"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Sucursal"]) : string.Empty, ESGR_Empresa = new ESGR_Empresa() { IdEmpresa = (dt.Rows[x]["IdEmpresa"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdEmpresa"]) : Convert.ToInt16(0), }, }); } return(CollectionEmpresaSucursal); } catch (Exception) { throw; } }